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

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Wed Jul 1 14:54:51 UTC 2009


Author: gregoa
Date: Wed Jul  1 14:54:46 2009
New Revision: 39043

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

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/Makefile.PL
    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/pkg-perl/branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/AbstractCount.pm?rev=39043&op=diff
==============================================================================
--- branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/AbstractCount.pm (original)
+++ branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/AbstractCount.pm Wed Jul  1 14:54:46 2009
@@ -5,7 +5,7 @@
 use base 'Class::DBI::Plugin';
 use SQL::Abstract;
 
-our $VERSION = '0.07';
+our $VERSION = '0.08';
 
 sub init
 {

Modified: branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Changes?rev=39043&op=diff
==============================================================================
--- branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Changes (original)
+++ branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Changes Wed Jul  1 14:54:46 2009
@@ -1,5 +1,9 @@
 Revision history for Perl extension Class::DBI::Plugin::AbstractCount.
 
+0.08  Wed Jul  1 10:11:46 CEST 2009
+	- fixed tests that failed with newer version of SQL::Abstract
+	- uses SQL::Abstract::Test
+	- bumped required version of SQL::Abstract to 1.50
 0.07  Wed Jun 14 11:04:00 2006
 	- fixed check for SQL-functions
 	- added support for SQL::Abstract keywords (-and, -or, etc.)

Modified: branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/META.yml?rev=39043&op=diff
==============================================================================
--- branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/META.yml (original)
+++ branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/META.yml Wed Jul  1 14:54:46 2009
@@ -1,13 +1,24 @@
-# 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.07
-version_from: AbstractCount.pm
-installdirs:  site
+--- #YAML:1.0
+name:               Class-DBI-Plugin-AbstractCount
+version:            0.08
+abstract:           get COUNT(*) results with abstract SQL
+author:
+    - Jean-Christophe Zeus <mail at ljczeus.com>
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
 requires:
-    Class::DBI:                    0.95
-    Class::DBI::Plugin:            0.02
-    SQL::Abstract:                 1.1
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+    Class::DBI:          0.95
+    Class::DBI::Plugin:  0.02
+    SQL::Abstract:       1.5
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.50
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Makefile.PL?rev=39043&op=diff
==============================================================================
--- branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Makefile.PL (original)
+++ branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/Makefile.PL Wed Jul  1 14:54:46 2009
@@ -8,7 +8,7 @@
     PREREQ_PM         =>
 			{ 'Class::DBI'         => 0.95
 			, 'Class::DBI::Plugin' => 0.02
-			, 'SQL::Abstract'      => 1.10
+			, 'SQL::Abstract'      => 1.50
 			},
     ($] >= 5.006 ?     ## Add these new keywords supported since 5.005
       (ABSTRACT_FROM  => 'AbstractCount.pm', # retrieve abstract from module

Modified: branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/t/03sql.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-abstractcount-perl/current/t/03sql.t?rev=39043&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 Wed Jul  1 14:54:46 2009
@@ -1,8 +1,14 @@
-#!/usr/bin/perl -I. -w
-# vim:set tabstop=2 shiftwidth=2 expandtab syn=perl:
+#!/usr/bin/perl -I.
+# vim:set tabstop=2 shiftwidth=2 expandtab filetype=perl:
 use strict;
-
-use Test::More tests => 20;
+use warnings;
+
+use Test::More tests => 21;
+use SQL::Abstract::Test import => [qw( is_same_sql is_same_bind )];
+{
+  no warnings 'once';
+  $SQL::Abstract::Test::parenthesis_significant = ''; # false
+}
 
 $main::sql = "";
 
@@ -53,139 +59,229 @@
   sub accessor { return 'last_change' }
 }
 
-use Class::DBI::Plugin::AbstractCount;
+use_ok('Class::DBI::Plugin::AbstractCount');
 
 # Test simple where-clause
-my ( @bind_params ) = __PACKAGE__->count_search_where(
-  { artist => 'Frank Zappa'
-  } );
-like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( artist = \? \)\n/i
-  , 'sql statement 1'
-  );
-is_deeply( \@bind_params, [ 'Frank Zappa' ], 'bind param list 1' );
+my @bind_params = __PACKAGE__->count_search_where({
+  artist => 'Frank Zappa'
+});
+is_same_sql(
+  $main::sql,
+  'SELECT COUNT(*) FROM __TABLE__ WHERE ( artist = ? )',
+  'sql statement 1',
+);
+is_same_bind( \@bind_params, [ 'Frank Zappa' ], 'bind param list 1' );
 
 # Test more complex where-clause
-( @bind_params ) = __PACKAGE__->count_search_where(
-  { artist  => 'Frank Zappa'
-  , title   => { like => '%Shut Up \'n Play Yer Guitar%' }
-  , release => { between => [ 1980, 1982 ] }
-  } );
-like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( artist = \? AND release BETWEEN \? AND \? AND title LIKE \? \)\n/i
-  , 'sql statement 2'
-  );
-is_deeply( \@bind_params, [ 'Frank Zappa'
-                          , 1980
-                          , 1982
-                          , '%Shut Up \'n Play Yer Guitar%'
-                          ], 'bind param list 2' );
+ at bind_params = __PACKAGE__->count_search_where({
+  artist  => 'Frank Zappa',
+  title   => { like => '%Shut Up \'n Play Yer Guitar%' },
+  release => { between => [ 1980, 1982 ] },
+});
+is_same_sql(
+  $main::sql, q{
+    SELECT COUNT(*)
+    FROM __TABLE__
+    WHERE ( ( artist = ? AND ( release BETWEEN ? AND ? ) AND title LIKE ? ) )
+  },
+  'sql statement 2',
+);
+is_same_bind(
+  \@bind_params, [
+    'Frank Zappa',
+    '1980',
+    '1982',
+    '%Shut Up \'n Play Yer Guitar%',
+  ],
+  'bind param list 2',
+);
 
 # Test where-clause with accessors
-( @bind_params ) = __PACKAGE__->count_search_where(
-  { artist_name  => 'Steve Vai'
-  , album_title  => { like => 'Flexable%' }
-  , release_date => { between => [ 1983, 1984 ] }
-  } );
-like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( artist = \? AND release BETWEEN \? AND \? AND title LIKE \? \)\n/i
-  , 'sql statement 3'
-  );
-is_deeply( \@bind_params, [ 'Steve Vai'
-                          , 1983
-                          , 1984
-                          , 'Flexable%'
-                          ], 'bind param list 3' );
+ at bind_params = __PACKAGE__->count_search_where({
+  artist_name  => 'Steve Vai',
+  album_title  => { like => 'Flexable%' },
+  release_date => { between => [ 1983, 1984 ] },
+});
+is_same_sql(
+  $main::sql, q{
+    SELECT COUNT(*)
+    FROM __TABLE__
+    WHERE ( ( artist = ? AND ( release BETWEEN ? AND ? ) AND title LIKE ? ) )
+  },
+  'sql statement 3',
+);
+is_same_bind(
+  \@bind_params, [
+    'Steve Vai',
+    '1983',
+    '1984',
+    'Flexable%',
+  ],
+  'bind param list 3',
+);
 
 # Test where-clause with simple function-call on column name
-( @bind_params ) = __PACKAGE__->count_search_where(
-  { artist            => 'Adrian Belew'
-  , 'YEAR( release )' => { '=', 2005 }
-  } );
-like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( YEAR\( release \) = \? AND artist = \? \)\n/i
-  , 'sql statement 4'
-  );
-is_deeply( \@bind_params, [ 2005
-                          , 'Adrian Belew'
-                          ], 'bind param list 4' );
-
-# Test where-clause with more complicated (nested) function-call on column name
-( @bind_params ) = __PACKAGE__->count_search_where(
-  { artist            => 'Adrian Belew'
-  , 'COALESCE( release, NOW() )' => { '=', 2005 }
-  } );
-like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( COALESCE\( release, NOW\(\) \) = \? AND artist = \? \)\n/i
-  , 'sql statement 5'
-  );
-is_deeply( \@bind_params, [ 2005
-                          , 'Adrian Belew'
-                          ], 'bind param list 5' );
+ at bind_params = __PACKAGE__->count_search_where({
+  artist            => 'Adrian Belew',
+  'YEAR( release )' => { '=', 2005 },
+});
+is_same_sql(
+  $main::sql, q{
+    SELECT COUNT(*)
+    FROM __TABLE__
+    WHERE ( ( YEAR( release ) = ? AND artist = ? ) )
+  },
+  'sql statement 4',
+);
+is_same_bind(
+  \@bind_params, [
+    '2005',
+    'Adrian Belew'
+  ],
+  'bind param list 4',
+);
+
+# Test where-clause with more complex (nested) function-call on column name
+ at bind_params = __PACKAGE__->count_search_where({
+  artist                       => 'Adrian Belew',
+  'COALESCE( release, NOW() )' => { '=', 2005 },
+});
+is_same_sql(
+  $main::sql, q{
+    SELECT COUNT(*)
+    FROM __TABLE__
+    WHERE ( ( COALESCE( release, NOW() ) = ? AND artist = ? ) )
+  },
+  'sql statement 5',
+);
+is_same_bind(
+  \@bind_params, [
+    '2005',
+    'Adrian Belew'
+  ],
+  'bind param list 5',
+);
 
 # Test where-clause with simple function-call on accessor
-( @bind_params ) = __PACKAGE__->count_search_where(
-  { artist_name            => 'Adrian Belew'
-  , 'YEAR( release_date )' => { '=', 2005 }
-  } );
-like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( YEAR\( release \) = \? AND artist = \? \)\n/i
-  , 'sql statement 6'
-  );
-is_deeply( \@bind_params, [ 2005
-                          , 'Adrian Belew'
-                          ], 'bind param list 6' );
-
-# Test where-clause with more complicated (nested) function-call on accessor
-( @bind_params ) = __PACKAGE__->count_search_where(
-  { artist_name            => 'Adrian Belew'
-  , 'COALESCE( release_date, NOW() )' => { '=', 2005 }
-  } );
-like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( COALESCE\( release, NOW\(\) \) = \? AND artist = \? \)\n/i
-  , 'sql statement 7'
-  );
-is_deeply( \@bind_params, [ 2005
-                          , 'Adrian Belew'
-                          ], 'bind param list 7' );
-
-# Test where-clause with more complicated (nested) function-call on multiple
+ at bind_params = __PACKAGE__->count_search_where({
+  artist_name            => 'Adrian Belew',
+  'YEAR( release_date )' => { '=', 2005 },
+});
+is_same_sql(
+  $main::sql, q{
+    SELECT COUNT(*)
+    FROM __TABLE__
+    WHERE ( ( YEAR( release ) = ? AND artist = ? ) )
+  },
+  'sql statement 6',
+);
+is_same_bind(
+  \@bind_params, [
+    '2005',
+    'Adrian Belew'
+  ],
+  'bind param list 6',
+);
+
+# Test where-clause with more complex (nested) function-call on accessor
+ at bind_params = __PACKAGE__->count_search_where({
+  artist_name                       => 'Adrian Belew',
+  'COALESCE( release_date, NOW() )' => { '=', 2005 },
+});
+is_same_sql(
+  $main::sql, q{
+    SELECT COUNT(*)
+    FROM __TABLE__
+    WHERE ( ( COALESCE( release, NOW() ) = ? AND artist = ? ) )
+  },
+  'sql statement 7',
+);
+is_same_bind(
+  \@bind_params, [
+    '2005',
+    'Adrian Belew'
+  ],
+  'bind param list 7',
+);
+
+# Test where-clause with more complex (nested) function-call on multiple
 # column names
-( @bind_params ) = __PACKAGE__->count_search_where(
-  { artist            => 'Adrian Belew'
-  , 'COALESCE( release, updated, NOW() )' => { '=', 2005 }
-  } );
-like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( COALESCE\( release, updated, NOW\(\) \) = \? AND artist = \? \)\n/i
-  , 'sql statement 8'
-  );
-is_deeply( \@bind_params, [ 2005
-                          , 'Adrian Belew'
-                          ], 'bind param list 8' );
-
-# Test where-clause with more complicated (nested) function-call on mixed
+ at bind_params = __PACKAGE__->count_search_where({
+  artist                                => 'Adrian Belew',
+  'COALESCE( release, updated, NOW() )' => { '=', 2005 },
+});
+is_same_sql(
+  $main::sql, q{
+    SELECT COUNT(*)
+    FROM __TABLE__
+    WHERE ( ( COALESCE( release, updated, NOW() ) = ? AND artist = ? ) )
+  },
+  'sql statement 8',
+);
+is_same_bind(
+  \@bind_params, [
+    '2005',
+    'Adrian Belew'
+  ],
+  'bind param list 8',
+);
+
+# Test where-clause with more complex (nested) function-call on mixed
 # column and accessor names
-( @bind_params ) = __PACKAGE__->count_search_where(
-  { artist            => 'Adrian Belew'
-  , 'COALESCE( release, last_change, NOW() )' => { '=', 2005 }
-  } );
-like( $main::sql, qr/SELECT COUNT\(\*\)\nFROM __TABLE__\nWHERE \( COALESCE\( release, updated, NOW\(\) \) = \? AND artist = \? \)\n/i
-  , 'sql statement 9'
-  );
-is_deeply( \@bind_params, [ 2005
-                          , 'Adrian Belew'
-                          ], 'bind param list 9' );
+ at bind_params = __PACKAGE__->count_search_where({
+  artist                                    => 'Adrian Belew',
+  'COALESCE( release, last_change, NOW() )' => { '=', 2005 },
+});
+is_same_sql(
+  $main::sql, q{
+    SELECT COUNT(*)
+    FROM __TABLE__
+    WHERE ( ( COALESCE( release, updated, NOW() ) = ? AND artist = ? ) )
+  },
+  'sql statement 9',
+);
+is_same_bind(
+  \@bind_params, [
+    '2005',
+    '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' );
+ at 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,
+      ],
+    ],
+  ],
+);
+is_same_sql(
+  $main::sql, q{
+    SELECT COUNT(*)
+    FROM __TABLE__
+    WHERE ( ( artist = ? AND ( ( title LIKE ? AND release = ? )
+                            OR ( title LIKE ? AND release = ? ) ) ) )
+  },
+  'sql statement 10',
+);
+is_same_bind(
+  \@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