r13985 - in /branches/upstream/libclass-dbi-plugin-abstractcount-perl/current: AbstractCount.pm Changes META.yml t/03sql.t

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Fri Feb 1 17:10:52 UTC 2008


Author: gregoa-guest
Date: Fri Feb  1 17:10:51 2008
New Revision: 13985

URL: http://svn.debian.org/wsvn/?sc=1&rev=13985
Log:
[svn-upgrade] Integrating new upstream version, libclass-dbi-plugin-abstractcount-perl (0.07)

Modified:
    branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/AbstractCount.pm
    branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Changes
    branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/META.yml
    branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/t/03sql.t

Modified: branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/AbstractCount.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/AbstractCount.pm?rev=13985&op=diff
==============================================================================
--- branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/AbstractCount.pm (original)
+++ branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/AbstractCount.pm Fri Feb  1 17:10:51 2008
@@ -5,7 +5,7 @@
 use base 'Class::DBI::Plugin';
 use SQL::Abstract;
 
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 sub init
 {
@@ -44,15 +44,22 @@
   }
 
   COLUMN: for my $column ( keys %where ) {
+    # Column names are (of course) OK
     next COLUMN if exists $columns{ $column };
+
+    # Accessor names are OK, but replace them with corresponding column name
     $where{ $accessors{ $column }} = delete $where{ $column }, next COLUMN
       if exists $accessors{ $column };
 
+    # SQL::Abstract keywords are OK
+    next COLUMN
+      if $column =~ /^-(?:and|or|nest|(?:(not_)?(?:like|between)))$/;
+
     # Check for functions
-    if ( index( $column, '(' )
-      && index( $column, ')' ))
+    if ( index( $column, '(' ) > 0
+      && index( $column, ')' ) > 1 )
     {
-      my @tokens = ( $column =~ /(\w+(?:\s*\(\s*)?|\W+)/g );
+      my @tokens = ( $column =~ /(-?\w+(?:\s*\(\s*)?|\W+)/g );
       TOKEN: for my $token ( @tokens ) {
         if ( $token !~ /\W/ ) { # must be column or accessor name
           next TOKEN if exists $columns{ $token };

Modified: branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Changes?rev=13985&op=diff
==============================================================================
--- branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Changes (original)
+++ branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Changes Fri Feb  1 17:10:51 2008
@@ -1,5 +1,9 @@
 Revision history for Perl extension Class::DBI::Plugin::AbstractCount.
 
+0.07  Wed Jun 14 11:04:00 2006
+	- fixed check for SQL-functions
+	- added support for SQL::Abstract keywords (-and, -or, etc.)
+	- added two more tests (to check keyword issue)
 0.06  Mon Aug 22 16:54:00 2005
 	- fixed function-call-on-column-in-where-clause issue
 	- added eight more tests (to check function call issue)

Modified: branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/META.yml?rev=13985&op=diff
==============================================================================
--- branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/META.yml (original)
+++ branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/META.yml Fri Feb  1 17:10:51 2008
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Class-DBI-Plugin-AbstractCount
-version:      0.06
+version:      0.07
 version_from: AbstractCount.pm
 installdirs:  site
 requires:
@@ -10,4 +10,4 @@
     SQL::Abstract:                 1.1
 
 distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+generated_by: ExtUtils::MakeMaker version 6.30

Modified: branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/t/03sql.t
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/t/03sql.t?rev=13985&op=diff
==============================================================================
--- branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/t/03sql.t (original)
+++ branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/t/03sql.t Fri Feb  1 17:10:51 2008
@@ -2,7 +2,7 @@
 # vim:set tabstop=2 shiftwidth=2 expandtab syn=perl:
 use strict;
 
-use Test::More tests => 18;
+use Test::More tests => 20;
 
 $main::sql = "";
 
@@ -168,4 +168,24 @@
                           , 'Adrian Belew'
                           ], 'bind param list 9' );
 
+# Test complex where-clause
+( @bind_params ) = __PACKAGE__->count_search_where(
+  -and => [ artist => 'System Of A Down'
+          , -nest  => [ -and => [ title   => { like => '%ize' }
+                                , release => 2005
+                                ]
+                      , -and => [ title   => { like => '%ize' }
+                                , release => 2006
+                                ]
+                      ]
+          ] );
+like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( \( \( artist = \? \) AND \( \( \( \( \( title LIKE \? \) AND \( release = \? \) \) \) OR \( \( \( title LIKE \? \) AND \( release = \? \) \) \) \) \) \) \)\n/i
+  , 'sql statement 10'
+  );
+is_deeply( \@bind_params, [ 'System Of A Down'
+                          , '%ize'
+                          , 2005
+                          , '%ize'
+                          , 2006
+                          ], 'bind param list 10' );
 __END__




More information about the Pkg-perl-cvs-commits mailing list