Hello community,
here is the log from the commit of package perl-SQL-Statement for openSUSE:Factory
checked in at Tue Aug 10 12:39:54 CEST 2010.
--------
--- perl-SQL-Statement/perl-SQL-Statement.changes 2010-07-20 15:10:22.000000000 +0200
+++ perl-SQL-Statement/perl-SQL-Statement.changes 2010-08-10 10:39:37.000000000 +0200
@@ -1,0 +2,19 @@
+Tue Aug 10 08:35:21 UTC 2010 - chris@computersalat.de
+
+- update to 1.30
+ - [Bug fixes]
+ * remove blib directory from distfile
+- Version 1.29, released August 1st, 2010
+ - [Bug fixes]
+ * add some getters as documented in SQL::Statement::Structure
+ (fixes RT#59834, thanks John Wiersba)
+ * add missing import of function croak to SQL::Statement::Term::ColumnValue
+ * fix assignment of parser result (doesn't run with perl-5.13.3)
+- spec mods
+ o rpmlint wrong-file-end-of-line-encoding
+ replaced dos2unix with %{__perl} -p -i -e "s|\r\n|\n|"
+ o removed BuildReq perl-macros
+ pkg only build for suse_version >= 1120, and perl-macros
+ is delivered with perl
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
SQL-Statement-1.28.tar.bz2
New:
----
SQL-Statement-1.30.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-SQL-Statement.spec ++++++
--- /var/tmp/diff_new_pack.DDGwVQ/_old 2010-08-10 12:38:05.000000000 +0200
+++ /var/tmp/diff_new_pack.DDGwVQ/_new 2010-08-10 12:38:05.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package perl-SQL-Statement (Version 1.28)
+# spec file for package perl-SQL-Statement (Version 1.30)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -17,12 +17,12 @@
# norootforbuild
-%bcond_with testsuite
+%bcond_with opt
Name: perl-SQL-Statement
%define cpan_name SQL-Statement
Summary: SQL parsing and processing engine
-Version: 1.28
+Version: 1.30
Release: 1
License: GPL+ or Artistic
Group: Development/Libraries/Perl
@@ -31,11 +31,7 @@
Source: %{cpan_name}-%{version}.tar.bz2
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: dos2unix
BuildRequires: perl
-%if 0%{?suse_version} < 1120
-BuildRequires: perl-macros
-%endif
BuildRequires: perl(Carp)
BuildRequires: perl(Clone) >= 0.30
BuildRequires: perl(Data::Dumper)
@@ -44,8 +40,9 @@
BuildRequires: perl(DBI::DBD::SqlEngine) >= 0.01
BuildRequires: perl(Params::Util) >= 1.00
BuildRequires: perl(Scalar::Util) >= 1.0
-# for testsuite
-%if %{with testsuite}
+BuildRequires: perl(Test::Simple) >= 0.90
+# optional for build
+%if %{with opt}
BuildRequires: perl(Test::Pod) >= 1.00
BuildRequires: perl(Test::Pod::Coverage) >= 1.00
BuildRequires: perl(DBD::CSV)
@@ -79,7 +76,7 @@
%prep
%setup -q -n %{cpan_name}-%{version}
# rpmlint wrong-file-end-of-line-encoding
-dos2unix README
+%{__perl} -p -i -e "s|\r\n|\n|" README
# rpmlint: spurious-executable-perm
%{__chmod} a-x Changes README
# rpmlint: script-without-shebang
++++++ SQL-Statement-1.28.tar.bz2 -> SQL-Statement-1.30.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/Changes new/SQL-Statement-1.30/Changes
--- old/SQL-Statement-1.28/Changes 2010-07-15 16:27:42.000000000 +0200
+++ new/SQL-Statement-1.30/Changes 2010-08-01 23:17:57.000000000 +0200
@@ -1,6 +1,21 @@
Changes log for Perl extension SQL::Statement
-Version 1.28
+Version 1.30, released August 1st, 2010
+----------------------------------------------
+
+[Bug fixes]
+* remove blib directory from distfile
+
+Version 1.29, released August 1st, 2010
+----------------------------------------------
+
+[Bug fixes]
+* add some getters as documented in SQL::Statement::Structure
+ (fixes RT#59834, thanks John Wiersba)
+* add missing import of function croak to SQL::Statement::Term::ColumnValue
+* fix assignment of parser result (doesn't run with perl-5.13.3)
+
+Version 1.28, released July 15th, 2010
----------------------------------------------
[Improvements]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/META.yml new/SQL-Statement-1.30/META.yml
--- old/SQL-Statement-1.28/META.yml 2010-07-15 16:35:27.000000000 +0200
+++ new/SQL-Statement-1.30/META.yml 2010-08-01 23:19:40.000000000 +0200
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: SQL-Statement
-version: 1.28
+version: 1.30
abstract: SQL parsing and processing engine
author:
- Jeff Zucker , Jens Rehsack
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Dialects/ANSI.pm new/SQL-Statement-1.30/lib/SQL/Dialects/ANSI.pm
--- old/SQL-Statement-1.28/lib/SQL/Dialects/ANSI.pm 2010-07-02 08:40:41.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Dialects/ANSI.pm 2010-08-01 23:18:25.000000000 +0200
@@ -1,7 +1,7 @@
package SQL::Dialects::ANSI;
use vars qw($VERSION);
-$VERSION = '1.28';
+$VERSION = '1.30';
use SQL::Dialects::Role;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Dialects/AnyData.pm new/SQL-Statement-1.30/lib/SQL/Dialects/AnyData.pm
--- old/SQL-Statement-1.28/lib/SQL/Dialects/AnyData.pm 2010-07-02 08:40:41.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Dialects/AnyData.pm 2010-08-01 23:18:25.000000000 +0200
@@ -1,7 +1,7 @@
package SQL::Dialects::AnyData;
use vars qw($VERSION);
-$VERSION = '1.28';
+$VERSION = '1.30';
use SQL::Dialects::Role;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Dialects/CSV.pm new/SQL-Statement-1.30/lib/SQL/Dialects/CSV.pm
--- old/SQL-Statement-1.28/lib/SQL/Dialects/CSV.pm 2010-07-02 08:40:41.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Dialects/CSV.pm 2010-08-01 23:18:25.000000000 +0200
@@ -1,7 +1,7 @@
package SQL::Dialects::CSV;
use vars qw($VERSION);
-$VERSION = '1.28';
+$VERSION = '1.30';
use SQL::Dialects::Role;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Dialects/Role.pm new/SQL-Statement-1.30/lib/SQL/Dialects/Role.pm
--- old/SQL-Statement-1.28/lib/SQL/Dialects/Role.pm 2010-07-02 08:40:41.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Dialects/Role.pm 2010-08-01 23:18:25.000000000 +0200
@@ -5,7 +5,7 @@
use base qw(Exporter);
our @EXPORT = qw(get_config_as_hash);
-our $VERSION = '1.28';
+our $VERSION = '1.30';
sub get_config_as_hash
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Eval.pm new/SQL-Statement-1.30/lib/SQL/Eval.pm
--- old/SQL-Statement-1.28/lib/SQL/Eval.pm 2010-07-07 14:10:18.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Eval.pm 2010-08-01 23:18:23.000000000 +0200
@@ -7,7 +7,7 @@
use warnings;
use vars qw($VERSION);
-$VERSION = '1.28';
+$VERSION = '1.30';
use Carp qw(croak);
@@ -93,12 +93,15 @@
my ( $self, $capname ) = @_;
return $self->{capabilities}->{$capname} if ( defined( $self->{capabilities}->{$capname} ) );
- $capname eq "insert_new_row" and $self->{capabilities}->{insert_new_row} = $self->can("insert_new_row");
- $capname eq "delete_one_row" and $self->{capabilities}->{delete_one_row} = $self->can("delete_one_row");
+ $capname eq "insert_new_row"
+ and $self->{capabilities}->{insert_new_row} = $self->can("insert_new_row");
+ $capname eq "delete_one_row"
+ and $self->{capabilities}->{delete_one_row} = $self->can("delete_one_row");
$capname eq "delete_current_row"
and $self->{capabilities}->{delete_current_row} =
( $self->can("delete_current_row") and $self->capability("inplace_delete") );
- $capname eq "update_one_row" and $self->{capabilities}->{update_one_row} = $self->can("update_one_row");
+ $capname eq "update_one_row"
+ and $self->{capabilities}->{update_one_row} = $self->can("update_one_row");
$capname eq "update_current_row"
and $self->{capabilities}->{update_current_row} =
( $self->can("update_current_row") and $self->capability("inplace_update") );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Parser.pm new/SQL-Statement-1.30/lib/SQL/Parser.pm
--- old/SQL-Statement-1.28/lib/SQL/Parser.pm 2010-07-07 14:10:18.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Parser.pm 2010-08-01 23:18:22.000000000 +0200
@@ -20,7 +20,7 @@
use Params::Util qw(_ARRAY0 _ARRAY _HASH);
use Scalar::Util qw(looks_like_number);
-$VERSION = '1.28';
+$VERSION = '1.30';
BEGIN
{
@@ -106,7 +106,8 @@
$self->replace_quoted_ids();
- my @tables = @{ $self->{struct}->{table_names} } if ( defined( _ARRAY0( $self->{struct}->{table_names} ) ) );
+ my @tables = @{ $self->{struct}->{table_names} }
+ if ( defined( _ARRAY0( $self->{struct}->{table_names} ) ) );
push( @{ $self->{struct}->{org_table_names} }, @tables );
# REMOVE schema.table infor if present
@tables = map { s/^.*\.([^\.]+)$/$1/; ( -1 == index( $_, '"' ) ) ? lc $_ : $_ } @tables;
@@ -120,20 +121,27 @@
$self->{struct}->{join}->{table_order} = $self->{struct}->{table_names}
if ( defined( $self->{struct}->{join}->{table_order} )
&& !defined( _ARRAY0( $self->{struct}->{join}->{table_order} ) ) );
- @{ $self->{struct}->{join}->{keycols} } = map { lc $_ } @{ $self->{struct}->{join}->{keycols} }
+ @{ $self->{struct}->{join}->{keycols} } =
+ map { lc $_ } @{ $self->{struct}->{join}->{keycols} }
if ( $self->{struct}->{join}->{keycols} );
- @{ $self->{struct}->{join}->{shared_cols} } = map { lc $_ } @{ $self->{struct}->{join}->{shared_cols} }
+ @{ $self->{struct}->{join}->{shared_cols} } =
+ map { lc $_ } @{ $self->{struct}->{join}->{shared_cols} }
if ( $self->{struct}->{join}->{shared_cols} );
}
- if ( defined( $self->{struct}->{column_defs} ) && defined( _ARRAY( $self->{struct}->{column_defs} ) ) )
+ if ( defined( $self->{struct}->{column_defs} )
+ && defined( _ARRAY( $self->{struct}->{column_defs} ) ) )
{
foreach my $col ( @{ $self->{struct}->{column_defs} } )
{
- next unless ( defined( $col->{fullorg} ) && ( -1 == index( $col->{fullorg}, '*' ) ) );
+ next
+ unless ( defined( $col->{fullorg} ) && ( -1 == index( $col->{fullorg}, '*' ) ) );
my $cn = $col->{fullorg};
#$cn = lc $cn unless ( $cn =~ m/^(?:\w+\.)?"/ );
- push( @{ $self->{struct}->{org_col_names} }, $self->{struct}->{ORG_NAME}->{$cn} || $cn );
+ push(
+ @{ $self->{struct}->{org_col_names} },
+ $self->{struct}->{ORG_NAME}->{$cn} || $cn
+ );
}
unless ( $com eq 'CREATE' )
@@ -143,14 +151,15 @@
foreach my $col ( @{ $self->{struct}->{column_defs} } )
{
next
- unless ( defined( $col->{fullorg} ) && ( -1 == index( $col->{fullorg}, '*' ) ) )
- ; # FIXME SUBSTR('*')
+ unless ( defined( $col->{fullorg} )
+ && ( -1 == index( $col->{fullorg}, '*' ) ) ); # FIXME SUBSTR('*')
my $orgname = $col->{fullorg};
my $colname = $orgname;
$colname = lc $colname unless ( $colname =~ m/^(?:\p{Word}+\.)?"/ );
unless ( defined( $self->{struct}->{ORG_NAME}->{$colname} ) )
{
- $self->{struct}->{ORG_NAME}->{$colname} = $self->{struct}->{ORG_NAME}->{$orgname};
+ $self->{struct}->{ORG_NAME}->{$colname} =
+ $self->{struct}->{ORG_NAME}->{$orgname};
}
}
#my @uCols = map { ( $_ =~ /^(\w+\.)?"/ ) ? $_ : lc $_ } @{ $self->{struct}->{column_names} };
@@ -339,7 +348,8 @@
push( @notops, $_ )
if /NOT/i;
}
- $self->{opts}->{valid_comparison_NOT_ops_regex} = '^\s*(.+)\s+(' . join( '|', @notops ) . ')\s+(.*)\s*$'
+ $self->{opts}->{valid_comparison_NOT_ops_regex} =
+ '^\s*(.+)\s+(' . join( '|', @notops ) . ')\s+(.*)\s*$'
if scalar @notops;
#
@@ -351,13 +361,15 @@
push( @compops, $_ )
if /<=|>=|<>/;
}
- $self->{opts}->{valid_comparison_twochar_ops_regex} = '^\s*(.+)\s+(' . join( '|', @compops ) . ')\s+(.*)\s*$'
+ $self->{opts}->{valid_comparison_twochar_ops_regex} =
+ '^\s*(.+)\s+(' . join( '|', @compops ) . ')\s+(.*)\s*$'
if scalar @compops;
#
# everything
#
- $self->{opts}->{valid_comparison_ops_regex} = '^\s*(.+)\s+(' . join( '|', @allops ) . ')\s+(.*)\s*$'
+ $self->{opts}->{valid_comparison_ops_regex} =
+ '^\s*(.+)\s+(' . join( '|', @allops ) . ')\s+(.*)\s*$'
if scalar @allops;
#
@@ -702,7 +714,8 @@
my ( $table_name, $val_str ) = $str =~ m/^INSERT\s+(.+?)\s+VALUES\s+(\(.+?\))$/i;
if ( $table_name and $table_name =~ m/[()]/ )
{
- ( $table_name, $col_str, $val_str ) = $str =~ m/^INSERT\s+(.+?)\s+\((.+?)\)\s+VALUES\s+(\(.+?\))$/i;
+ ( $table_name, $col_str, $val_str ) =
+ $str =~ m/^INSERT\s+(.+?)\s+\((.+?)\)\s+VALUES\s+(\(.+?\))$/i;
}
return $self->do_err('No table name specified!') unless ($table_name);
return $self->do_err('Missing values list!') unless ( defined $val_str );
@@ -1087,7 +1100,8 @@
# it seems, perl 5.6 isn't greedy enough .. let's help a bit
my ($data_types_regex) =
- join( '|', sort { length($b) <=> length($a) } keys %{ $self->{opts}->{valid_data_types} } );
+ join( '|',
+ sort { length($b) <=> length($a) } keys %{ $self->{opts}->{valid_data_types} } );
$data_types_regex =~ s/ /\\ /g; # backslash spaces to allow the /x modifier below
my ( $name, $type, $constraints ) = (
$col =~ m/\s*(\S+)\s+ # capture the column name
@@ -1123,7 +1137,8 @@
return $self->do_err(qq{Can't have two PRIMARY KEYs in a table!});
}
$constr =~ s/_/ /g;
- push @{ $self->{struct}->{table_defs}->{columns}->{$name}->{constraints} }, $constr;
+ push @{ $self->{struct}->{table_defs}->{columns}->{$name}->{constraints} },
+ $constr;
}
else
@@ -1179,7 +1194,8 @@
push( @cols, $col );
push( @vals, $val );
}
- return undef unless ( $self->{struct}->{column_defs} = $self->ROW_VALUE_LIST( join ',', @cols ) );
+ return undef
+ unless ( $self->{struct}->{column_defs} = $self->ROW_VALUE_LIST( join ',', @cols ) );
return undef unless ( $self->LITERAL_LIST( join ',', @vals ) );
return 1;
}
@@ -1327,7 +1343,9 @@
# need better alias test here, since AS is a common
# keyword that might be used in a function
my ( $fld, $alias ) =
- ( $col =~ m/^(.+?)\s+(?:AS\s+)?([A-Z]\p{Word}*|\?QI\d+\?)$/i ) ? ( $1, $2 ) : ( $col, undef );
+ ( $col =~ m/^(.+?)\s+(?:AS\s+)?([A-Z]\p{Word}*|\?QI\d+\?)$/i )
+ ? ( $1, $2 )
+ : ( $col, undef );
$col = $fld;
if ( $col =~ m/^(\S+)\.\*$/ )
{
@@ -1336,8 +1354,10 @@
{
return $self->do_err("'$table.*' cannot be aliased");
}
- $table = $self->{tmp}->{is_table_alias}->{$table} if ( $self->{tmp}->{is_table_alias}->{$table} );
- $table = $self->{tmp}->{is_table_alias}->{"\L$table"} if ( $self->{tmp}->{is_table_alias}->{"\L$table"} );
+ $table = $self->{tmp}->{is_table_alias}->{$table}
+ if ( $self->{tmp}->{is_table_alias}->{$table} );
+ $table = $self->{tmp}->{is_table_alias}->{"\L$table"}
+ if ( $self->{tmp}->{is_table_alias}->{"\L$table"} );
return undef unless ( $self->TABLE_NAME($table) );
$table = $self->replace_quoted_ids($table);
push(
@@ -1355,19 +1375,21 @@
return if ( $self->{struct}->{errstr} );
$newcol ||= $self->ROW_VALUE($col);
return if ( $self->{struct}->{errstr} );
- return $self->do_err("Invalid SELECT entry '$col'") unless ( defined( _HASH($newcol) ) );
+ return $self->do_err("Invalid SELECT entry '$col'")
+ unless ( defined( _HASH($newcol) ) );
# FIXME this might be better done later and only if not 2 functions with the same name are selected
- if ( !defined($alias) && ( ( 'function' eq $newcol->{type} ) || ( 'setfunc' eq $newcol->{type} ) ) )
+ if ( !defined($alias)
+ && ( ( 'function' eq $newcol->{type} ) || ( 'setfunc' eq $newcol->{type} ) ) )
{
$alias = $newcol->{name};
}
if ( defined($alias) )
{
- $alias = $self->replace_quoted_ids($alias);
- $newcol->{alias} = $alias;
- $aliases{ $newcol->{fullorg} } = $alias;
+ $alias = $self->replace_quoted_ids($alias);
+ $newcol->{alias} = $alias;
+ $aliases{ $newcol->{fullorg} } = $alias;
$self->{struct}->{ORG_NAME}->{ $newcol->{fullorg} } = $alias;
}
push( @newcols, $newcol );
@@ -1396,7 +1418,8 @@
my $set_function_arg;
if ($count_star)
{
- return $self->do_err("Keyword DISTINCT is not allowed for COUNT(*)") if ( 'DISTINCT' eq $distinct );
+ return $self->do_err("Keyword DISTINCT is not allowed for COUNT(*)")
+ if ( 'DISTINCT' eq $distinct );
$set_function_arg = {
type => 'column',
value => '*'
@@ -1581,7 +1604,8 @@
my $lparens = ( $str =~ tr/\(// );
my $rparens = ( $str =~ tr/\)// );
- return $self->do_err( 'Unmatched ' . ( ( $lparens > $rparens ) ? 'left' : 'right' ) . " parentheses in '$str'!" )
+ return $self->do_err(
+ 'Unmatched ' . ( ( $lparens > $rparens ) ? 'left' : 'right' ) . " parentheses in '$str'!" )
unless ( $lparens == $rparens );
return $self->non_parens_search( $str, $predicates )
@@ -1689,7 +1713,8 @@
my $parens = 1;
my $spos = $-[1];
my $epos = 0;
- $epos = $-[1], $parens += ( $1 eq '[' ) ? 1 : -1 while ( ( $parens > 0 ) && ( $str =~ /\G.*?([\[\]])/gcs ) );
+ $epos = $-[1], $parens += ( $1 eq '[' ) ? 1 : -1
+ while ( ( $parens > 0 ) && ( $str =~ /\G.*?([\[\]])/gcs ) );
$k = substr( $str, $spos, $epos - $spos + 1 );
$k =~ s/\?(\d+)\?/$self->{struct}{literals}[$1]/g;
@@ -1900,10 +1925,12 @@
my ( $arg1, $op, $arg2, $opexp );
- $opexp = $self->{opts}{valid_comparison_NOT_ops_regex}, ( $arg1, $op, $arg2 ) = $str =~ /$opexp/i
+ $opexp = $self->{opts}{valid_comparison_NOT_ops_regex},
+ ( $arg1, $op, $arg2 ) = $str =~ /$opexp/i
if $self->{opts}{valid_comparison_NOT_ops_regex};
- $opexp = $self->{opts}{valid_comparison_twochar_ops_regex}, ( $arg1, $op, $arg2 ) = $str =~ /$opexp/i
+ $opexp = $self->{opts}{valid_comparison_twochar_ops_regex},
+ ( $arg1, $op, $arg2 ) = $str =~ /$opexp/i
if ( !defined($op)
&& $self->{opts}{valid_comparison_twochar_ops_regex} );
@@ -2230,12 +2257,14 @@
}
$start = $self->ROW_VALUE($start);
$str =~ s/\?(\d+)\?/$self->{struct}->{literals}->[$1]/g;
- if ( ( $start->{type} eq 'string' ) or ( $start->{length} && ( $start->{length}->{type} eq 'string' ) ) )
+ if ( ( $start->{type} eq 'string' )
+ or ( $start->{length} && ( $start->{length}->{type} eq 'string' ) ) )
{
return $self->do_err("Can't use a string as a SUBSTRING position: '$str'!");
}
return undef unless ($value);
- return $self->do_err("Can't use a number in SUBSTRING: '$str'!") if $value->{type} eq 'number';
+ return $self->do_err("Can't use a number in SUBSTRING: '$str'!")
+ if $value->{type} eq 'number';
return {
type => 'function',
name => $name,
@@ -2280,7 +2309,8 @@
$str =~ s/\?(\d+)\?/$self->{struct}->{literals}->[$1]/g;
my $value_type = $value->{type} if ref $value eq 'HASH';
$value_type = $value->[0] if ( defined( _ARRAY($value) ) );
- return $self->do_err("Can't use a number in TRIM: '$str'!") if ( $value_type and $value_type eq 'number' );
+ return $self->do_err("Can't use a number in TRIM: '$str'!")
+ if ( $value_type and $value_type eq 'number' );
return {
type => 'function',
@@ -2640,18 +2670,23 @@
if ( !$self->{tmp}->{is_table_name}->{$table_name}
and !$self->{tmp}->{is_table_alias}->{$table_name} )
{
- return $self->do_err("Table '$table_name' referenced$location but not found in FROM list!");
+ return $self->do_err(
+ "Table '$table_name' referenced$location but not found in FROM list!");
}
}
else
{
- my @tblnamelist = ( keys( %{ $self->{tmp}->{is_table_name} } ), keys( %{ $self->{tmp}->{is_table_alias} } ) );
+ my @tblnamelist = (
+ keys( %{ $self->{tmp}->{is_table_name} } ),
+ keys( %{ $self->{tmp}->{is_table_alias} } )
+ );
my $tblnames = join( "|", @tblnamelist );
unless ( $table_name =~ m/^(?:$tblnames)$/i )
{
- return $self->do_err( "Table '$table_name' referenced$location but not found in FROM list ("
- . join( ",", @tblnamelist )
- . ")!" );
+ return $self->do_err(
+ "Table '$table_name' referenced$location but not found in FROM list ("
+ . join( ",", @tblnamelist )
+ . ")!" );
}
}
@@ -2764,7 +2799,8 @@
if ( defined $select )
{
delete $self->{select};
- $self->{opts}->{valid_options}->{SELECT_MULTIPLE_TABLES} = $self->{opts}->{select}->{join} = $select->{join};
+ $self->{opts}->{valid_options}->{SELECT_MULTIPLE_TABLES} = $self->{opts}->{select}->{join} =
+ $select->{join};
}
if ( defined $create )
{
@@ -2773,7 +2809,8 @@
{
my $type = $key;
$type =~ s/type_(.*)/\U$1/;
- $self->{opts}->{valid_data_types}->{$type} = $self->{opts}->{create}->{$key} = $create->{$key};
+ $self->{opts}->{valid_data_types}->{$type} = $self->{opts}->{create}->{$key} =
+ $create->{$key};
}
}
}
@@ -2847,18 +2884,18 @@
$sql =~ s/\n/ /g;
$sql =~ s/\s+/ /g;
- $sql =~ s/(\S)\(/$1 (/g; # ensure whitespace before (
- $sql =~ s/\)(\S)/) $1/g; # ensure whitespace after )
- $sql =~ s/\(\s*/(/g; # trim whitespace after (
- $sql =~ s/\s*\)/)/g; # trim whitespace before )
- #
- # $sql =~ s/\s*\(/(/g; # trim whitespace before (
- # $sql =~ s/\)\s*/)/g; # trim whitespace after )
- # for my $op (qw(= <> < > <= >= \|\|))
- # {
- # $sql =~ s/(\S)$op/$1 $op/g;
- # $sql =~ s/$op(\S)/$op $1/g;
- # }
+ $sql =~ s/(\S)\(/$1 (/g; # ensure whitespace before (
+ $sql =~ s/\)(\S)/) $1/g; # ensure whitespace after )
+ $sql =~ s/\(\s*/(/g; # trim whitespace after (
+ $sql =~ s/\s*\)/)/g; # trim whitespace before )
+ #
+ # $sql =~ s/\s*\(/(/g; # trim whitespace before (
+ # $sql =~ s/\)\s*/)/g; # trim whitespace after )
+ # for my $op (qw(= <> < > <= >= \|\|))
+ # {
+ # $sql =~ s/(\S)$op/$1 $op/g;
+ # $sql =~ s/$op(\S)/$op $1/g;
+ # }
$sql =~ s/(\S)(=|<>|<|>|<=|>=|\|\|)/$1 $2/g;
$sql =~ s/(=|<>|<|>|<=|>=|\|\|)(\S)/$1 $2/g;
$sql =~ s/< >/<>/g;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement/Function.pm new/SQL-Statement-1.30/lib/SQL/Statement/Function.pm
--- old/SQL-Statement-1.28/lib/SQL/Statement/Function.pm 2010-07-02 08:40:41.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement/Function.pm 2010-08-01 23:18:23.000000000 +0200
@@ -1,9 +1,13 @@
package SQL::Statement::Function;
+use strict;
+use warnings;
+use vars qw(@ISA $VERSION);
+
require SQL::Statement::Term;
@ISA = qw(SQL::Statement::Term);
-our $VERSION = '1.28';
+$VERSION = '1.30';
=pod
@@ -205,7 +209,8 @@
{
my ( $self, $eval ) = @_;
my $expr = $self->{EXPR};
- my @vals = map { _INSTANCE( $_, 'SQL::Statement::Term' ) ? $_->value($eval) : $_ } @{ $self->{PARAMS} };
+ my @vals =
+ map { _INSTANCE( $_, 'SQL::Statement::Term' ) ? $_->value($eval) : $_ } @{ $self->{PARAMS} };
foreach my $val (@vals)
{
return $self->do_err(qq~Bad numeric expression '$val'!~)
@@ -391,9 +396,10 @@
sub value($)
{
- my $val = $_[0]->{PARAMS}->[0]->value( $_[1] );
- my $start = $_[0]->{START}->value( $_[1] ) - 1;
- my $length = defined( $_[0]->{LENGTH} ) ? $_[0]->{LENGTH}->value( $_[1] ) : length($val) - $start;
+ my $val = $_[0]->{PARAMS}->[0]->value( $_[1] );
+ my $start = $_[0]->{START}->value( $_[1] ) - 1;
+ my $length =
+ defined( $_[0]->{LENGTH} ) ? $_[0]->{LENGTH}->value( $_[1] ) : length($val) - $start;
return substr( $val, $start, $length );
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement/Functions.pm new/SQL-Statement-1.30/lib/SQL/Statement/Functions.pm
--- old/SQL-Statement-1.28/lib/SQL/Statement/Functions.pm 2010-07-12 12:01:24.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement/Functions.pm 2010-08-01 23:18:23.000000000 +0200
@@ -198,7 +198,7 @@
=cut
use vars qw($VERSION);
-$VERSION = '1.28';
+$VERSION = '1.30';
=pod
@@ -257,7 +257,8 @@
sub SQL_FUNCTION_CURRENT_TIMESTAMP
{
my ( $sec, $min, $hour, $day, $mon, $year ) = localtime;
- return sprintf( '%4s-%02s-%02s %02s::%02s::%02s', $year + 1900, $mon + 1, $day, $hour, $min, $sec );
+ return
+ sprintf( '%4s-%02s-%02s %02s::%02s::%02s', $year + 1900, $mon + 1, $day, $hour, $min, $sec );
}
=pod
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement/GetInfo.pm new/SQL-Statement-1.30/lib/SQL/Statement/GetInfo.pm
--- old/SQL-Statement-1.28/lib/SQL/Statement/GetInfo.pm 2010-07-02 08:40:41.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement/GetInfo.pm 2010-08-01 23:18:24.000000000 +0200
@@ -1,10 +1,12 @@
package SQL::Statement::GetInfo;
-use vars qw($VERSION);
-$VERSION = '1.28';
+use strict;
+use warnings;
+
+use vars qw($VERSION %info);
+$VERSION = '1.30';
use SQL::Statement();
-use vars qw(%info);
my @Keywords = qw(
INTEGERVAL STRING REALVAL IDENT NULLVAL PARAM OPERATOR IS AND OR ERROR
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement/Operation.pm new/SQL-Statement-1.30/lib/SQL/Statement/Operation.pm
--- old/SQL-Statement-1.28/lib/SQL/Statement/Operation.pm 2010-07-12 12:01:24.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement/Operation.pm 2010-08-01 23:18:25.000000000 +0200
@@ -1,11 +1,14 @@
package SQL::Statement::Operation;
+use strict;
+use warnings;
+
use vars qw(@ISA);
require Carp;
require SQL::Statement::Term;
-our $VERSION = '1.28';
+our $VERSION = '1.30';
@ISA = qw(SQL::Statement::Term);
@@ -49,6 +52,18 @@
I<Abstract> method which will do the operation of the term. Must be
overridden by derived classes.
+=head2 op
+
+Returns the name of the executed operation.
+
+=head2 left
+
+Returns the left operand (if any).
+
+=head2 right
+
+Returns the right operand (if any).
+
=head2 DESTROY
Destroys the term and undefines the weak reference to the owner as well
@@ -68,10 +83,19 @@
return $self;
}
+sub op { return $_[0]->{OP}; }
+sub left { return $_[0]->{LEFT}; }
+sub right { return $_[0]->{RIGHT}; }
+
sub operate($)
{
Carp::confess(
- sprintf( q{pure virtual function 'operate' called on %s for %s}, ref( $_[0] ) || __PACKAGE__, $_[0]->{OP} ) );
+ sprintf(
+ q{pure virtual function 'operate' called on %s for %s},
+ ref( $_[0] ) || __PACKAGE__,
+ $_[0]->{OP}
+ )
+ );
}
sub DESTROY
@@ -382,7 +406,9 @@
foreach my $r (@right)
{
- last if $expr |= ( looks_like_number($left) && looks_like_number($r) ) ? $left == $r : $left eq $r;
+ last
+ if $expr |=
+ ( looks_like_number($left) && looks_like_number($r) ) ? $left == $r : $left eq $r;
}
return $expr;
@@ -438,7 +464,9 @@
my @right = map { $_->value($eval); } @{ $self->{RIGHT} };
my $expr = 0;
- if ( looks_like_number($left) && looks_like_number( $right[0] ) && looks_like_number( $right[1] ) )
+ if ( looks_like_number($left)
+ && looks_like_number( $right[0] )
+ && looks_like_number( $right[1] ) )
{
$expr = ( $left >= $right[0] ) && ( $left <= $right[1] );
}
@@ -516,13 +544,23 @@
sub numcmp($)
{
Carp::confess(
- sprintf( q{pure virtual function 'numcmp' called on %s for %s}, ref( $_[0] ) || __PACKAGE__, $_[0]->{OP} ) );
+ sprintf(
+ q{pure virtual function 'numcmp' called on %s for %s},
+ ref( $_[0] ) || __PACKAGE__,
+ $_[0]->{OP}
+ )
+ );
}
sub strcmp($)
{
Carp::confess(
- sprintf( q{pure virtual function 'strcmp' called on %s for %s}, ref( $_[0] ) || __PACKAGE__, $_[0]->{OP} ) );
+ sprintf(
+ q{pure virtual function 'strcmp' called on %s for %s},
+ ref( $_[0] ) || __PACKAGE__,
+ $_[0]->{OP}
+ )
+ );
}
package SQL::Statement::Operation::Equal;
@@ -867,7 +905,12 @@
sub regexp($)
{
Carp::confess(
- sprintf( q{pure virtual function 'regexp' called on %s for %s}, ref( $_[0] ) || __PACKAGE__, $_[0]->{OP} ) );
+ sprintf(
+ q{pure virtual function 'regexp' called on %s for %s},
+ ref( $_[0] ) || __PACKAGE__,
+ $_[0]->{OP}
+ )
+ );
}
sub operate($)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement/Placeholder.pm new/SQL-Statement-1.30/lib/SQL/Statement/Placeholder.pm
--- old/SQL-Statement-1.28/lib/SQL/Statement/Placeholder.pm 2010-07-02 08:40:41.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement/Placeholder.pm 2010-08-01 23:18:25.000000000 +0200
@@ -1,11 +1,14 @@
package SQL::Statement::Placeholder;
+use strict;
+use warnings;
+
use vars qw(@ISA);
require Carp;
require SQL::Statement::Term;
-our $VERSION = '1.28';
+our $VERSION = '1.30';
@ISA = qw(SQL::Statement::Term);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement/RAM.pm new/SQL-Statement-1.30/lib/SQL/Statement/RAM.pm
--- old/SQL-Statement-1.28/lib/SQL/Statement/RAM.pm 2010-07-12 12:01:24.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement/RAM.pm 2010-08-01 23:18:24.000000000 +0200
@@ -2,13 +2,19 @@
package SQL::Statement::RAM;
############################
+use strict;
+use warnings;
+
use vars qw($VERSION);
-$VERSION = '1.28';
+$VERSION = '1.30';
####################################
package SQL::Statement::RAM::Table;
####################################
+use strict;
+use warnings;
+
require SQL::Eval;
use vars qw(@ISA);
@@ -59,7 +65,7 @@
sub insert_new_row
{
my ( $self, $data, $fields ) = @_;
- push @{$self->{records}}, clone($fields);
+ push @{ $self->{records} }, clone($fields);
return 1;
}
##################################
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement/Structure.pod new/SQL-Statement-1.30/lib/SQL/Statement/Structure.pod
--- old/SQL-Statement-1.28/lib/SQL/Statement/Structure.pod 2010-07-12 12:01:24.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement/Structure.pod 2010-08-01 18:57:06.000000000 +0200
@@ -6,22 +6,21 @@
=head1 SYNOPSIS
- use SQL::Statement;
- my $sql = "SELECT a FROM b JOIN c WHERE c=? AND e=7 ORDER BY f DESC LIMIT 5,2";
- my $parser = SQL::Parser->new();
- $parser->{RaiseError}=1;
- $parser->{PrintError}=0;
- $parser->parse("LOAD 'MyLib::MySyntax' ");
- my $stmt = SQL::Statement->new($sql,$parser);
- printf "Command %s\n",$stmt->command;
- printf "Num of Placeholders %s\n",scalar $stmt->params;
- printf "Columns %s\n",join( ',', map {$_->name} $stmt->column_defs() );
- printf "Tables %s\n",join( ',', map {$_->name} $stmt->tables() );
- printf "Where operator %s\n",join( ',', $stmt->where->op() );
- printf "Limit %s\n",$stmt->limit();
- printf "Offset %s\n",$stmt->offset();
- printf "Order Columns %s\n",join(',', map {$_->column} $stmt->order() );
- __END__
+ use SQL::Statement;
+ my $sql = "SELECT a FROM b JOIN c WHERE c=? AND e=7 ORDER BY f DESC LIMIT 5,2";
+ my $parser = SQL::Parser->new();
+ $parser->{RaiseError}=1;
+ $parser->{PrintError}=0;
+ $parser->parse("LOAD 'MyLib::MySyntax' ");
+ my $stmt = SQL::Statement->new($sql,$parser);
+ printf "Command %s\n",$stmt->command;
+ printf "Num of Placeholders %s\n",scalar $stmt->params;
+ printf "Columns %s\n",join( ',', map {$_->name} $stmt->column_defs() );
+ printf "Tables %s\n",join( ',', map {$_->name} $stmt->tables() );
+ printf "Where operator %s\n",join( ',', $stmt->where->op() );
+ printf "Limit %s\n",$stmt->limit();
+ printf "Offset %s\n",$stmt->offset();
+ printf "Order Columns %s\n",join(',', map {$_->column} $stmt->order() );
=head1 DESCRIPTION
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement/Term.pm new/SQL-Statement-1.30/lib/SQL/Statement/Term.pm
--- old/SQL-Statement-1.28/lib/SQL/Statement/Term.pm 2010-07-02 08:40:41.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement/Term.pm 2010-08-01 23:18:23.000000000 +0200
@@ -1,8 +1,12 @@
package SQL::Statement::Term;
-our $VERSION = '1.28';
+use strict;
+use warnings;
+
+our $VERSION = '1.30';
use Scalar::Util qw(weaken);
+use Carp ();
=pod
@@ -61,7 +65,11 @@
undef $self->{OWNER};
}
-sub value($) { Carp::confess( sprintf( q{pure virtual function '%s->value' called}, ref( $_[0] ) || __PACKAGE__ ) ); }
+sub value($)
+{
+ Carp::confess(
+ sprintf( q{pure virtual function '%s->value' called}, ref( $_[0] ) || __PACKAGE__ ) );
+}
package SQL::Statement::ConstantTerm;
@@ -121,6 +129,7 @@
use vars qw(@ISA);
@ISA = qw(SQL::Statement::Term);
+use Carp qw(croak);
use Params::Util qw(_INSTANCE _ARRAY0 _SCALAR);
use Scalar::Util qw(looks_like_number);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement/TermFactory.pm new/SQL-Statement-1.30/lib/SQL/Statement/TermFactory.pm
--- old/SQL-Statement-1.28/lib/SQL/Statement/TermFactory.pm 2010-07-02 08:40:41.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement/TermFactory.pm 2010-08-01 23:18:24.000000000 +0200
@@ -1,5 +1,8 @@
package SQL::Statement::TermFactory;
+use strict;
+use warnings;
+
require SQL::Statement::Term;
require SQL::Statement::Operation;
require SQL::Statement::Placeholder;
@@ -9,7 +12,7 @@
use Params::Util qw(_HASH _ARRAY0 _INSTANCE);
use Scalar::Util qw(blessed weaken);
-our $VERSION = '1.28';
+our $VERSION = '1.30';
my %oplist = (
'=' => 'Equal',
@@ -47,7 +50,8 @@
{
my $opBase = 'SQL::Statement::Operation';
my $opDialect = join( '::', $opBase, $self->{OWNER}->{dialect}, $oplist{$op} );
- $opClasses{$op} = UNIVERSAL::isa( $opDialect, $opBase ) ? $opDialect : join( '::', $opBase, $oplist{$op} );
+ $opClasses{$op} =
+ $opDialect->isa($opBase) ? $opDialect : join( '::', $opBase, $oplist{$op} );
}
return $opClasses{$op};
@@ -82,9 +86,11 @@
my $right = $self->buildCondition( $pred->{arg2} );
$term =
- SQL::Statement::Function::UserFunc->new( $self->{OWNER}, $op,
- $self->{OWNER}->{opts}->{function_names}->{$op},
- [ $left, $right ] );
+ SQL::Statement::Function::UserFunc->new(
+ $self->{OWNER}, $op,
+ $self->{OWNER}->{opts}->{function_names}->{$op},
+ [ $left, $right ]
+ );
}
else
{
@@ -121,7 +127,8 @@
if ( $pred->{name} eq 'numeric_exp' )
{
- $term = SQL::Statement::Function::NumericEval->new( $self->{OWNER}, $pred->{str}, \@params );
+ $term = SQL::Statement::Function::NumericEval->new( $self->{OWNER}, $pred->{str},
+ \@params );
}
elsif ( $pred->{name} eq 'str_concat' )
{
@@ -129,19 +136,21 @@
}
elsif ( $pred->{name} eq 'TRIM' )
{
- $term = SQL::Statement::Function::Trim->new( $self->{OWNER}, $pred->{trim_spec}, $pred->{trim_char},
- \@params );
+ $term = SQL::Statement::Function::Trim->new( $self->{OWNER}, $pred->{trim_spec},
+ $pred->{trim_char}, \@params );
}
elsif ( $pred->{name} eq 'SUBSTRING' )
{
- my $start = $self->buildCondition( $pred->{start} );
- my $length = $self->buildCondition( $pred->{length} ) if ( _HASH( $pred->{length} ) );
- $term = SQL::Statement::Function::SubString->new( $self->{OWNER}, $start, $length, \@params );
+ my $start = $self->buildCondition( $pred->{start} );
+ my $length = $self->buildCondition( $pred->{length} )
+ if ( _HASH( $pred->{length} ) );
+ $term = SQL::Statement::Function::SubString->new( $self->{OWNER}, $start, $length,
+ \@params );
}
else
{
- $term =
- SQL::Statement::Function::UserFunc->new( $self->{OWNER}, $pred->{name}, $pred->{subname}, \@params );
+ $term = SQL::Statement::Function::UserFunc->new( $self->{OWNER}, $pred->{name},
+ $pred->{subname}, \@params );
}
}
else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement/Util.pm new/SQL-Statement-1.30/lib/SQL/Statement/Util.pm
--- old/SQL-Statement-1.28/lib/SQL/Statement/Util.pm 2010-07-02 08:40:41.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement/Util.pm 2010-08-01 23:18:24.000000000 +0200
@@ -1,7 +1,10 @@
package SQL::Statement::Util;
+use strict;
+use warnings;
+
use vars qw($VERSION);
-$VERSION = '1.28';
+$VERSION = '1.30';
sub type
{
@@ -23,7 +26,8 @@
$display_name ||= $col_name;
# print " $col_name !\n";
- if ( $col_name && ( ( $col_name =~ m/^(".+")\.(.*)$/ ) || ( $col_name =~ m/^([^.]*)\.(.*)$/ ) ) )
+ if ( $col_name
+ && ( ( $col_name =~ m/^(".+")\.(.*)$/ ) || ( $col_name =~ m/^([^.]*)\.(.*)$/ ) ) )
{
$table_name = $1;
$col_name = $2;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/lib/SQL/Statement.pm new/SQL-Statement-1.30/lib/SQL/Statement.pm
--- old/SQL-Statement-1.28/lib/SQL/Statement.pm 2010-07-07 14:10:18.000000000 +0200
+++ new/SQL-Statement-1.30/lib/SQL/Statement.pm 2010-08-01 23:18:18.000000000 +0200
@@ -30,7 +30,7 @@
#use locale;
-$VERSION = '1.28';
+$VERSION = '1.30';
sub new
{
@@ -40,7 +40,8 @@
# USE THE ANYDATA DIALECT RATHER THAN THE CSV DIALECT
# WITH DBD::CSV
- if ( ( defined($main::extend_csv) && $main::extend_csv ) || ( defined($main::extend_sql) && $main::extend_sql ) )
+ if ( ( defined($main::extend_csv) && $main::extend_csv )
+ || ( defined($main::extend_sql) && $main::extend_sql ) )
{
$flags = SQL::Parser->new('AnyData');
}
@@ -49,14 +50,14 @@
$flags->{PrintError} = 1 unless defined $flags->{PrintError};
$flags->{text_numbers} = 1 unless defined $flags->{text_numbers};
$flags->{alpha_compare} = 1 unless defined $flags->{alpha_compare};
-
- unless( blessed( $flags ) ) # avoid copying stale data from earlier parsing sessions
+
+ unless ( blessed($flags) ) # avoid copying stale data from earlier parsing sessions
{
- %$self = ( %$self, %{ clone( $flags ) } );
+ %$self = ( %$self, %{ clone($flags) } );
}
else
{
- $self->{$_} = $flags->{$_} for qw(RaiseError PrintError opts);
+ $self->{$_} = $flags->{$_} for qw(RaiseError PrintError opts);
}
$self->{dlm} = '~';
@@ -80,11 +81,15 @@
{
my ( $self, $sql, $parser ) = @_;
return $self if ( $self->{already_prepared}->{$sql} );
- $self->{already_prepared} = {}; # delete earlier preparations, they're overwritten after this prepare run
+ $self->{already_prepared} =
+ {}; # delete earlier preparations, they're overwritten after this prepare run
my $rv = $parser->parse($sql);
if ($rv)
{
- %$self = ( %$self, %{ clone( $parser->{struct} ) } );
+ while ( my ( $k, $v ) = each( %{ $parser->{struct} } ) )
+ {
+ $self->{$k} = $v;
+ }
undef $self->{where_terms};
undef $self->{columns};
$self->{argnum} = 0;
@@ -111,7 +116,8 @@
$self->{where_terms} = $self->{termFactory}->buildCondition( $self->{where_clause} );
if ( $self->{where_clause}->{combiners} )
{
- $self->{has_OR} = 1 if ( first { -1 != index( $_, 'OR' ) } @{ $self->{where_clause}->{combiners} } );
+ $self->{has_OR} = 1
+ if ( first { -1 != index( $_, 'OR' ) } @{ $self->{where_clause}->{combiners} } );
}
}
@@ -136,8 +142,9 @@
my ( $table, $msg );
my ($command) = $self->command();
return $self->do_err('No command found!') unless ($command);
- ( $self->{NUM_OF_ROWS}, $self->{NUM_OF_FIELDS}, $self->{data} ) = $self->$command( $data, $params );
- return unless( defined( $self->{NUM_OF_ROWS} ) );
+ ( $self->{NUM_OF_ROWS}, $self->{NUM_OF_FIELDS}, $self->{data} ) =
+ $self->$command( $data, $params );
+ return unless ( defined( $self->{NUM_OF_ROWS} ) );
@{ $self->{NAME} } = map { $_->display_name() } @{ $self->{columns} };
@@ -238,7 +245,9 @@
local $SIG{__WARN__} = sub { push @err, @_ };
($eval) = $self->open_tables( $data, 0, 1 );
};
- if ( $self->{ignore_missing_table} and ( $@ or @err ) and grep { $_ =~ $enoentrx } ( @err, $@ ) )
+ if ( $self->{ignore_missing_table}
+ and ( $@ or @err )
+ and grep { $_ =~ $enoentrx } ( @err, $@ ) )
{
$@ = '';
return ( -1, 0 );
@@ -362,7 +371,8 @@
if (@rows)
{
- if ( $table->capability('rowwise_delete') ) # @rows is empty in case of inplace_delete capability
+ if ( $table->capability('rowwise_delete')
+ ) # @rows is empty in case of inplace_delete capability
{
foreach my $array (@rows)
{
@@ -465,7 +475,8 @@
elsif ( $table->capability('rowwise_update') )
{
push( @rows, $array ) unless ( $table->capability('update_specific_row') );
- push( @rows, [ $array, $originalValues ] ) if ( $table->capability('update_specific_row') );
+ push( @rows, [ $array, $originalValues ] )
+ if ( $table->capability('update_specific_row') );
}
}
@@ -474,7 +485,8 @@
if (@rows)
{
- if ( $table->capability('rowwise_update') ) # @rows is empty in case of inplace_update capability
+ if ( $table->capability('rowwise_update')
+ ) # @rows is empty in case of inplace_update capability
{
foreach my $array (@rows)
{
@@ -602,7 +614,8 @@
and ( scalar( @{ $self->{join}->{table_order} } ) == 0 ) )
{
$self->{join}->{table_order} = $self->order_joins( $self->{join}->{keycols} );
- $self->{join}->{table_order} = $self->{table_names} unless ( defined( $self->{join}->{table_order} ) );
+ $self->{join}->{table_order} = $self->{table_names}
+ unless ( defined( $self->{join}->{table_order} ) );
}
my @tables = $self->tables;
@@ -650,7 +663,8 @@
$share_type = 'NATURAL' if ( -1 != index( $self->{join}->{type}, 'NATURAL' ) );
$share_type = 'USING' if ( -1 != index( $self->{join}->{clause}, 'USING' ) );
$share_type = 'ON' if ( -1 != index( $self->{join}->{clause}, 'ON' ) );
- $share_type = 'USING' if ( ( $share_type eq 'ON' ) && ( scalar( @{ $self->{join}->{keycols} } ) == 1 ) );
+ $share_type = 'USING'
+ if ( ( $share_type eq 'ON' ) && ( scalar( @{ $self->{join}->{keycols} } ) == 1 ) );
my $join_type = 'INNER';
$join_type = 'LEFT' if ( -1 != index( $self->{join}->{type}, 'LEFT' ) );
$join_type = 'RIGHT' if ( -1 != index( $self->{join}->{type}, 'RIGHT' ) );
@@ -663,10 +677,12 @@
$tableBobj = $tmpTbl;
}
- my $tableA = ( 0 == index( $tableAobj->{NAME}, '"' ) ) ? $tableAobj->{NAME} : lc( $tableAobj->{NAME} );
- my $tableB = ( 0 == index( $tableBobj->{NAME}, '"' ) ) ? $tableBobj->{NAME} : lc( $tableBobj->{NAME} );
- my @colsA = @{ $tableAobj->col_names };
- my @colsB = @{ $tableBobj->col_names };
+ my $tableA =
+ ( 0 == index( $tableAobj->{NAME}, '"' ) ) ? $tableAobj->{NAME} : lc( $tableAobj->{NAME} );
+ my $tableB =
+ ( 0 == index( $tableBobj->{NAME}, '"' ) ) ? $tableBobj->{NAME} : lc( $tableBobj->{NAME} );
+ my @colsA = @{ $tableAobj->col_names };
+ my @colsB = @{ $tableBobj->col_names };
my %isunqualA;
my %isunqualB = map { $_ => 1 } @colsB;
my @shared_cols;
@@ -744,8 +760,10 @@
$k1 = $whichqual{$k1} if ( $whichqual{$k1} );
$k2 = $whichqual{$k2} if ( $whichqual{$k2} );
- push( @shared_cols, $k1, $k2 ) if ( defined( $col_numsA{$k1} ) && defined( $col_numsB{$k2} ) );
- push( @shared_cols, $k2, $k1 ) if ( defined( $col_numsA{$k2} ) && defined( $col_numsB{$k1} ) );
+ push( @shared_cols, $k1, $k2 )
+ if ( defined( $col_numsA{$k1} ) && defined( $col_numsB{$k2} ) );
+ push( @shared_cols, $k2, $k1 )
+ if ( defined( $col_numsA{$k2} ) && defined( $col_numsB{$k1} ) );
}
}
@@ -807,7 +825,10 @@
{
if ( $join_type ne 'UNION' )
{
- my @newRow = ( $join_type ne 'RIGHT' ) ? ( @{$arrayA}, @{$arrayB} ) : ( @{$arrayB}, @{$arrayA} );
+ my @newRow =
+ ( $join_type ne 'RIGHT' )
+ ? ( @{$arrayA}, @{$arrayB} )
+ : ( @{$arrayB}, @{$arrayA} );
push( @$joined_table, \@newRow );
}
@@ -844,7 +865,8 @@
undef $tableAobj;
undef $tableBobj;
$self->{join}->{table} =
- SQL::Statement::TempTable->new( $self->{dlm} . 'tmp', \@all_cols, $self->{join}->{display_cols}, $joined_table );
+ SQL::Statement::TempTable->new( $self->{dlm} . 'tmp', \@all_cols,
+ $self->{join}->{display_cols}, $joined_table );
return;
}
@@ -1168,7 +1190,8 @@
{
$t->{$name} = $data->{Database}->{sql_ram_tables}->{$name};
$t->{$name}->seek( $data, 0, 0 );
- $t->{$name}->init_table( $data, $name, $createMode, $lockMode ) if ( $t->{$name}->can('init_table') );
+ $t->{$name}->init_table( $data, $name, $createMode, $lockMode )
+ if ( $t->{$name}->can('init_table') );
}
elsif ( $self->{is_ram_table} )
{
@@ -1180,7 +1203,7 @@
undef $@;
eval {
my $open_name = $self->{org_table_names}->[$count];
- $t->{$name} = $self->open_table( $data, $open_name, $createMode, $lockMode );
+ $t->{$name} = $self->open_table( $data, $open_name, $createMode, $lockMode );
};
my $err = $t->{$name}->{errstr};
return $self->do_err($err) if ($err);
@@ -1259,7 +1282,8 @@
if ( $newcol->{value} =~ m/^(.+)\.\*$/ )
{
$tbl = $1;
- return $self->do_err("No table name given in '$newcol->{value}'") unless ( defined( _STRING($tbl) ) );
+ return $self->do_err("No table name given in '$newcol->{value}'")
+ unless ( defined( _STRING($tbl) ) );
@tables = ($tbl);
}
else
@@ -1276,7 +1300,8 @@
{
return $self->do_err("Can't find table '$table'") unless ( defined( $t->{$table} ) );
my $tcols = $t->{$table}->{col_names};
- return $self->do_err("Couldn't find column names for table '$table'!") unless ( _ARRAY($tcols) );
+ return $self->do_err("Couldn't find column names for table '$table'!")
+ unless ( _ARRAY($tcols) );
foreach my $colName ( @{$tcols} )
{
next if ( $join && $shared_cols{$colName}++ );
@@ -1284,7 +1309,7 @@
$colName, # column name
$table, # table name
SQL::Statement::ColumnValue->new( $self, $table . '.' . $colName ), # term
- $colName, # display name
+ $colName, # display name
$colName,
$newcol,
];
@@ -1294,14 +1319,15 @@
}
elsif ( ( 'CREATE' eq $self->command() ) || ( 'DROP' eq $self->command() ) )
{
- return $self->do_err("Invalid column type '$newcol->{type}'") unless ( 'column' eq $newcol->{type} );
+ return $self->do_err("Invalid column type '$newcol->{type}'")
+ unless ( 'column' eq $newcol->{type} );
my $expcol = [
- $newcol->{value}, # column name
- undef, # table name
- undef, # term
- $newcol->{value}, # display name
- $newcol->{value}, # original name
- $newcol, # coldef
+ $newcol->{value}, # column name
+ undef, # table name
+ undef, # term
+ $newcol->{value}, # display name
+ $newcol->{value}, # original name
+ $newcol, # coldef
];
push( @columns, $expcol );
}
@@ -1327,13 +1353,14 @@
);
@cols = map { $_->[2], $colSep } @cols;
pop(@cols);
- $col = $self->{termFactory}->buildCondition(
- {
- type => 'function',
- name => 'str_concat',
- value => \@cols,
- }
- );
+ $col =
+ $self->{termFactory}->buildCondition(
+ {
+ type => 'function',
+ name => 'str_concat',
+ value => \@cols,
+ }
+ );
}
}
else
@@ -1392,7 +1419,8 @@
{
for my $i ( 0 .. scalar @{ $self->{sort_spec_list} } - 1 )
{
- next if ( defined( _INSTANCE( $self->{sort_spec_list}->[$i], 'SQL::Statement::Order' ) ) );
+ next
+ if ( defined( _INSTANCE( $self->{sort_spec_list}->[$i], 'SQL::Statement::Order' ) ) );
my ( $newcol, $direction ) = each %{ $self->{sort_spec_list}->[$i] };
undef $direction unless ( $direction && $direction eq 'DESC' );
@@ -1480,7 +1508,7 @@
my %col_exists = map { $_ => 1 } @tmp_cols;
my ( %is_member, @duplicates, %is_duplicate );
- foreach (@$all_cols) { $_ =~ s/[^.]*\.(.*)/$1/; } # XXX we're modifying $all_cols from caller!
+ foreach (@$all_cols) { $_ =~ s/[^.]*\.(.*)/$1/; } # XXX we're modifying $all_cols from caller!
@duplicates = grep( $is_member{$_}++, @$all_cols );
%is_duplicate = map { $_ => 1 } @duplicates;
if ( exists( $self->{join} ) && defined( _HASH( $self->{join} ) ) )
@@ -1511,7 +1539,8 @@
my $num_tables = $self->tables();
for my $c (@tmpcols)
{
- my ( $table, $col ) = $self->verify_expand_column( $c, \$i, \@usr_cols, \%is_duplicate, \%col_exists );
+ my ( $table, $col ) =
+ $self->verify_expand_column( $c, \$i, \@usr_cols, \%is_duplicate, \%col_exists );
return if ( $self->{errstr} );
next unless ( $table && $col );
@@ -1537,10 +1566,12 @@
{
$i = -2;
my ( $table, $col ) =
- $self->verify_expand_column( $grpby, \$i, \@usr_cols, \%is_duplicate, \%col_exists );
+ $self->verify_expand_column( $grpby, \$i, \@usr_cols, \%is_duplicate,
+ \%col_exists );
return if ( $self->{errstr} );
$col ||= $grpby;
- ( $table, $col ) = $self->full_qualified_column_name($col) if ( defined($col) && !defined($table) );
+ ( $table, $col ) = $self->full_qualified_column_name($col)
+ if ( defined($col) && !defined($table) );
next unless ( defined($table) && defined($col) );
delete $set_fully->{"$table.$col"};
}
@@ -1550,12 +1581,12 @@
{
return
$self->do_err(
- sprintf(
- "Column%s '%s' must appear in the GROUP BY clause or be used in an aggregate function",
- scalar( keys( %{$set_fully} ) ) > 1 ? 's' : '',
- join( "', '", keys( %{$set_fully} ) )
- )
- );
+ sprintf(
+ "Column%s '%s' must appear in the GROUP BY clause or be used in an aggregate function",
+ scalar( keys( %{$set_fully} ) ) > 1 ? 's' : '',
+ join( "', '", keys( %{$set_fully} ) )
+ )
+ );
}
}
@@ -1598,7 +1629,10 @@
return 0 unless ( defined( $_[0]->{values}->[ $_[1] ] ) );
return $_[0]->{values}->[ $_[1] ]->[ $_[2] ] if ( defined $_[2] );
- return wantarray ? map { $_->{value} } @{ $_[0]->{values}->[ $_[1] ] } : scalar @{ $_[0]->{values}->[ $_[1] ] };
+ return
+ wantarray
+ ? map { $_->{value} } @{ $_[0]->{values}->[ $_[1] ] }
+ : scalar @{ $_[0]->{values}->[ $_[1] ] };
}
else
{
@@ -1811,7 +1845,8 @@
next if ( $in_order{$tbl} );
push( @missing, $tbl );
}
- return $self->do_err( sprintf( 'Unconnected tables (%s) in equijoin statement!', join( ', ', @missing ) ) );
+ return $self->do_err(
+ sprintf( 'Unconnected tables (%s) in equijoin statement!', join( ', ', @missing ) ) );
}
$self->{join}->{table_order} = \@order;
return \@order;
@@ -1842,6 +1877,8 @@
sub where_hash() { return $_[0]->{where_clause}; }
+sub column_defs() { return $_[0]->{column_defs}; }
+
sub where()
{
return undef unless $_[0]->{where_terms};
@@ -1947,17 +1984,22 @@
if ( $coldef->{type} eq 'setfunc' )
{
- next if ( ( $coldef->{distinct} eq 'DISTINCT' ) && defined( $result->{uniq}->[$colidx]->{$colval} ) );
+ next
+ if ( ( $coldef->{distinct} eq 'DISTINCT' )
+ && defined( $result->{uniq}->[$colidx]->{$colval} ) );
- $result->{agg}->[$colidx] = clone($empty_agg) unless ( defined( _HASH( $result->{agg}->[$colidx] ) ) );
+ $result->{agg}->[$colidx] = clone($empty_agg)
+ unless ( defined( _HASH( $result->{agg}->[$colidx] ) ) );
my $agg = $result->{agg}->[$colidx];
++$agg->{count};
- unless ( defined( $agg->{max} ) && ( SQL::Statement::_anycmp( $colval, $agg->{max} ) < 0 ) )
+ unless ( defined( $agg->{max} )
+ && ( SQL::Statement::_anycmp( $colval, $agg->{max} ) < 0 ) )
{
$agg->{max} = $colval;
}
- unless ( defined( $agg->{min} ) && ( SQL::Statement::_anycmp( $colval, $agg->{min} ) > 0 ) )
+ unless ( defined( $agg->{min} )
+ && ( SQL::Statement::_anycmp( $colval, $agg->{min} ) > 0 ) )
{
$agg->{min} = $colval;
}
@@ -1965,7 +2007,8 @@
}
else
{
- $result->{pure}->[$colidx] = $colval unless ( defined( $result->{pure}->[$colidx] ) );
+ $result->{pure}->[$colidx] = $colval
+ unless ( defined( $result->{pure}->[$colidx] ) );
}
}
}
@@ -2085,7 +2128,8 @@
my $rowkey = join( "\0", @$row[ @{ $self->{keycols} } ] );
- $self->{final_rows}->{$rowkey} = {} unless ( defined( _HASH( $self->{final_rows}->{$rowkey} ) ) );
+ $self->{final_rows}->{$rowkey} = {}
+ unless ( defined( _HASH( $self->{final_rows}->{$rowkey} ) ) );
return $self->{final_rows}->{$rowkey};
}
@@ -2476,6 +2520,8 @@
=head2 where_hash
+=head2 column_defs
+
=end undocumented
=head1 SUPPORT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SQL-Statement-1.28/t/12eval.t new/SQL-Statement-1.30/t/12eval.t
--- old/SQL-Statement-1.28/t/12eval.t 2009-10-18 16:43:00.000000000 +0200
+++ new/SQL-Statement-1.30/t/12eval.t 2010-08-01 18:31:20.000000000 +0200
@@ -1,48 +1,53 @@
#!/usr/bin/perl -w
-$|=1;
+$| = 1;
use strict;
use Test::More tests => 13;
use lib qw' ./ ./t ';
use SQLtest;
-my $table = SQL::Eval::Table->new({
-
- col_names => [qw(c1 c2 c3)],
- col_nums => {c1=>0,c2=>1,c3=>2},
- row => [1,2,3],
-});
-
-ok( 3 == scalar @{ $table->row() }, 'eval row()');
-ok( 2 == $table->column('c2'), 'eval column()');
-
-my $eval = SQL::Eval->new({});
-ok( $eval->params([1,2,3]), 'eval params($val)' );
-ok( 3 == scalar @{ $eval->params() }, 'eval params()');
-
-$eval->{tables}->{a}=$table;
-ok( 3 == $eval->column('a','c3'), 'eval column($tbl,$col)' );
-
-my $ram = bless {},'SQL::Statement::RAM::Table';
-$ram->{records}=1;
-ok( !eval_seek($ram,0,-100),'ram seek(bad whence)');
-$ram->{index}=-100;
-ok( !eval_seek($ram,0,1),'ram seek(bad index)');
-ok( eval_seek($ram,0,2),'ram seek(pos=2)');
-
-my $func = SQL::Statement::Util::Function->new('a','b','c');
-ok('function' eq $func->type,'$function->type');
-ok('a' eq $func->name,'$function->name');
-my $col = SQL::Statement::Util::Column->new('a','b','c');
-ok('column' eq $col->type,'$column->type');
-
-eval{$func->validate()};
-ok($@,'function validate - no sub');
-$func = SQL::Statement::Util::Function->new('ok','Test::More::ok');
-ok($func->validate(),'function validate');
-
-sub eval_seek {
- my($ram,$pos,$whence)=@_;
- eval { $ram->seek(undef,$pos,$whence)};
-# print $@ if $@;
+my $table = SQL::Eval::Table->new(
+ {
+ col_names => [qw(c1 c2 c3)],
+ col_nums => {
+ c1 => 0,
+ c2 => 1,
+ c3 => 2
+ },
+ row => [ 1, 2, 3 ],
+ }
+);
+
+ok( 3 == scalar @{ $table->row() }, 'eval row()' );
+ok( 2 == $table->column('c2'), 'eval column()' );
+
+my $eval = SQL::Eval->new( {} );
+ok( $eval->params( [ 1, 2, 3 ] ), 'eval params($val)' );
+ok( 3 == scalar @{ $eval->params() }, 'eval params()' );
+
+$eval->{tables}->{a} = $table;
+ok( 3 == $eval->column( 'a', 'c3' ), 'eval column($tbl,$col)' );
+
+my $ram = SQL::Statement::RAM::Table->new( 'dummy', [], [ [] ] );
+ok( !eval_seek( $ram, 0, -100 ), 'ram seek(bad whence)' );
+$ram->{index} = -100;
+ok( !eval_seek( $ram, 0, 1 ), 'ram seek(bad index)' );
+ok( eval_seek( $ram, 0, 2 ), 'ram seek(pos=2)' );
+
+my $func = SQL::Statement::Util::Function->new( 'a', 'b', 'c' );
+ok( 'function' eq $func->type, '$function->type' );
+ok( 'a' eq $func->name, '$function->name' );
+my $col = SQL::Statement::Util::Column->new( 'a', 'b', 'c' );
+ok( 'column' eq $col->type, '$column->type' );
+
+eval { $func->validate() };
+ok( $@, 'function validate - no sub' );
+$func = SQL::Statement::Util::Function->new( 'ok', 'Test::More::ok' );
+ok( $func->validate(), 'function validate' );
+
+sub eval_seek
+{
+ my ( $ram, $pos, $whence ) = @_;
+ eval { $ram->seek( undef, $pos, $whence ) };
+ # diag $@ if $@;
return ($@) ? 0 : 1;
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org