diff -Nru libclass-dbi-plugin-abstractcount-perl-0.07/AbstractCount.pm libclass-dbi-plugin-abstractcount-perl-0.08/AbstractCount.pm --- libclass-dbi-plugin-abstractcount-perl-0.07/AbstractCount.pm 2006-06-14 10:02:21.000000000 +0100 +++ libclass-dbi-plugin-abstractcount-perl-0.08/AbstractCount.pm 2009-07-01 09:10:54.000000000 +0100 @@ -5,7 +5,7 @@ use base 'Class::DBI::Plugin'; use SQL::Abstract; -our $VERSION = '0.07'; +our $VERSION = '0.08'; sub init { diff -Nru /tmp/bIKOSrRIY9/libclass-dbi-plugin-abstractcount-perl-0.07/Changes /tmp/CMs4PqlSEi/libclass-dbi-plugin-abstractcount-perl-0.08/Changes --- libclass-dbi-plugin-abstractcount-perl-0.07/Changes 2006-06-14 10:06:22.000000000 +0100 +++ libclass-dbi-plugin-abstractcount-perl-0.08/Changes 2009-07-01 09:15:41.000000000 +0100 @@ -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.) diff -Nru /tmp/bIKOSrRIY9/libclass-dbi-plugin-abstractcount-perl-0.07/debian/changelog /tmp/CMs4PqlSEi/libclass-dbi-plugin-abstractcount-perl-0.08/debian/changelog --- libclass-dbi-plugin-abstractcount-perl-0.07/debian/changelog 2009-11-05 11:36:13.000000000 +0000 +++ libclass-dbi-plugin-abstractcount-perl-0.08/debian/changelog 2009-11-05 11:36:13.000000000 +0000 @@ -1,3 +1,26 @@ +libclass-dbi-plugin-abstractcount-perl (0.08-1) unstable; urgency=low + + [ gregor herrmann ] + * debian/control: Changed: Switched Vcs-Browser field to ViewSVN + (source stanza). + * debian/control: Added: ${misc:Depends} to Depends: field. + + [ Nathan Handler ] + * debian/watch: Update to ignore development releases. + + [ gregor herrmann ] + * New upstream release: + + now uses SQL::Abstract::Test for tests (closes: #527751) + + bump (build) dependency on libsql-abstract-perl to >= 1.50 + + add build dependecny on libtest-deep-perl + * debian/control: change my email address. + * Set Standards-Version to 3.8.2 (no changes). + * Update to debhelper 7 (debian/{rules,compat,control}). + * debian/copyright: switch to new format. + * debian/control: adjust short and long description. + + -- gregor herrmann Wed, 01 Jul 2009 17:18:12 +0200 + libclass-dbi-plugin-abstractcount-perl (0.07-1) unstable; urgency=low [ Damyan Ivanov ] diff -Nru /tmp/bIKOSrRIY9/libclass-dbi-plugin-abstractcount-perl-0.07/debian/compat /tmp/CMs4PqlSEi/libclass-dbi-plugin-abstractcount-perl-0.08/debian/compat --- libclass-dbi-plugin-abstractcount-perl-0.07/debian/compat 2009-11-05 11:36:13.000000000 +0000 +++ libclass-dbi-plugin-abstractcount-perl-0.08/debian/compat 2009-11-05 11:36:13.000000000 +0000 @@ -1 +1 @@ -6 +7 diff -Nru /tmp/bIKOSrRIY9/libclass-dbi-plugin-abstractcount-perl-0.07/debian/control /tmp/CMs4PqlSEi/libclass-dbi-plugin-abstractcount-perl-0.08/debian/control --- libclass-dbi-plugin-abstractcount-perl-0.07/debian/control 2009-11-05 11:36:13.000000000 +0000 +++ libclass-dbi-plugin-abstractcount-perl-0.08/debian/control 2009-11-05 11:36:13.000000000 +0000 @@ -1,24 +1,24 @@ Source: libclass-dbi-plugin-abstractcount-perl Maintainer: Debian Perl Group Uploaders: Ben Hutchings , - gregor herrmann + gregor herrmann Section: perl Priority: extra -Build-Depends: debhelper (>= 6) -Build-Depends-Indep: perl (>= 5.6.0-16), libclass-dbi-perl (>= 0.95), - libclass-dbi-plugin-perl (>= 0.02), libsql-abstract-perl (>= 1.10), - libtest-pod-perl, libtest-pod-coverage-perl -Standards-Version: 3.7.3 +Build-Depends: debhelper (>= 7) +Build-Depends-Indep: libclass-dbi-perl (>= 0.95), + libclass-dbi-plugin-perl (>= 0.02), libsql-abstract-perl (>= 1.50), + libtest-deep-perl, libtest-pod-coverage-perl, libtest-pod-perl, perl (>= 5.8.8) +Standards-Version: 3.8.2 Homepage: http://search.cpan.org/dist/Class-DBI-Plugin-AbstractCount/ Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libclass-dbi-plugin-abstractcount-perl/ -Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-dbi-plugin-abstractcount-perl/ +Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libclass-dbi-plugin-abstractcount-perl/ Package: libclass-dbi-plugin-abstractcount-perl Architecture: all -Depends: ${perl:Depends}, libclass-dbi-perl (>= 0.95), - libclass-dbi-plugin-perl (>= 0.02), libsql-abstract-perl (>= 1.10) -Description: Class::DBI::Plugin::AbstractCount - get COUNT(*) results with abstract SQL - This Class::DBI plugin combines the functionality from - Class::DBI::Plugin::CountSearch (counting objects without having to - use an array or an iterator), and Class::DBI::AbstractSearch, which - allows complex where-clauses a la SQL::Abstract. +Depends: ${misc:Depends}, ${perl:Depends}, libclass-dbi-perl (>= 0.95), + libclass-dbi-plugin-perl (>= 0.02), libsql-abstract-perl (>= 1.50) +Description: Class::DBI plugin to get COUNT(*) results with abstract SQL + The Class::DBI::Plugin::AbstractCount module combines the functionality from + Class::DBI::Plugin::CountSearch (counting objects without having to use an + array or an iterator), and Class::DBI::AbstractSearch, which allows complex + where-clauses a la SQL::Abstract. diff -Nru /tmp/bIKOSrRIY9/libclass-dbi-plugin-abstractcount-perl-0.07/debian/copyright /tmp/CMs4PqlSEi/libclass-dbi-plugin-abstractcount-perl-0.08/debian/copyright --- libclass-dbi-plugin-abstractcount-perl-0.07/debian/copyright 2009-11-05 11:36:13.000000000 +0000 +++ libclass-dbi-plugin-abstractcount-perl-0.08/debian/copyright 2009-11-05 11:36:13.000000000 +0000 @@ -1,23 +1,29 @@ -This is the Debian-packaged version of -Class::DBI::Plugin::AbstractCount put together by Ben Hutchings - using source from: - - http://search.cpan.org/~jczeus/Class-DBI-Plugin-AbstractCount/ - -Copyright 2004 Jean-Christophe Zeus . - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself: +Format-Specification: + http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196 +Upstream-Maintainer: Jean-Christophe Zeus +Upstream-Source: http://search.cpan.org/dist/Class-DBI-Plugin-AbstractCount/ +Upstream-Name: Class-DBI-Plugin-AbstractCount + +Files: * +Copyright: 2004, Jean-Christophe Zeus +License-Alias: Perl +License: Artistic | GPL-1+ + +Files: debian/* +Copyright: 2005, Ben Hutchings + 2008-2009, gregor herrmann +License: Artistic | GPL-1+ +License: Artistic This program is free software; you can redistribute it and/or modify - it under the terms of either: + it under the terms of the Artistic License, which comes with Perl. + On Debian GNU/Linux systems, the complete text of the Artistic License + can be found in `/usr/share/common-licenses/Artistic' - a) the GNU General Public License as published by the Free Software - Foundation; either version 1, or (at your option) any later - version, or - - b) the "Artistic License" which comes with Perl. - -On Debian systems, the complete text of the GNU General Public License -can be found in `/usr/share/common-licenses/GPL' and the Artistic -Licence in `/usr/share/common-licenses/Artistic'. +License: GPL-1+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + On Debian GNU/Linux systems, the complete text of the GNU General + Public License can be found in `/usr/share/common-licenses/GPL' diff -Nru /tmp/bIKOSrRIY9/libclass-dbi-plugin-abstractcount-perl-0.07/debian/rules /tmp/CMs4PqlSEi/libclass-dbi-plugin-abstractcount-perl-0.08/debian/rules --- libclass-dbi-plugin-abstractcount-perl-0.07/debian/rules 2009-11-05 11:36:13.000000000 +0000 +++ libclass-dbi-plugin-abstractcount-perl-0.08/debian/rules 2009-11-05 11:36:13.000000000 +0000 @@ -1,74 +1,4 @@ #!/usr/bin/make -f -# This debian/rules file is provided as a template for normal perl -# packages. It was created by Marc Brockschmidt for -# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may -# be used freely wherever it is useful. -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -# If set to a true value then MakeMaker's prompt function will -# always return the default without waiting for user input. -export PERL_MM_USE_DEFAULT=1 - -PACKAGE=$(shell dh_listpackages) - -ifndef PERL -PERL = /usr/bin/perl -endif - -TMP =$(CURDIR)/debian/$(PACKAGE) - -build: build-stamp -build-stamp: - dh_testdir - - $(PERL) Makefile.PL INSTALLDIRS=vendor - $(MAKE) - $(MAKE) test - - touch $@ - -clean: - dh_testdir - dh_testroot - - dh_clean build-stamp install-stamp - - # Add commands to clean up after the build process here - [ ! -f Makefile ] || $(MAKE) realclean - -install: install-stamp -install-stamp: build-stamp - dh_testdir - dh_testroot - dh_clean -k - - # Add commands to install the package into $(TMP) here - $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr - - [ ! -d $(TMP)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/lib/perl5 - - touch $@ - -binary-arch: -# We have nothing to do here for an architecture-independent package - -binary-indep: build install - dh_testdir - dh_testroot - dh_installdocs - dh_installchangelogs Changes - dh_perl - dh_compress - dh_fixperms - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -source diff: - @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary +%: + dh $@ diff -Nru /tmp/bIKOSrRIY9/libclass-dbi-plugin-abstractcount-perl-0.07/debian/watch /tmp/CMs4PqlSEi/libclass-dbi-plugin-abstractcount-perl-0.08/debian/watch --- libclass-dbi-plugin-abstractcount-perl-0.07/debian/watch 2009-11-05 11:36:13.000000000 +0000 +++ libclass-dbi-plugin-abstractcount-perl-0.08/debian/watch 2009-11-05 11:36:13.000000000 +0000 @@ -1,2 +1,2 @@ version=3 -http://search.cpan.org/dist/Class-DBI-Plugin-AbstractCount/ .+/Class-DBI-Plugin-AbstractCount-v?(\d[\d_.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$ +http://search.cpan.org/dist/Class-DBI-Plugin-AbstractCount/ .+/Class-DBI-Plugin-AbstractCount-v?(\d[\d.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$ diff -Nru /tmp/bIKOSrRIY9/libclass-dbi-plugin-abstractcount-perl-0.07/Makefile.PL /tmp/CMs4PqlSEi/libclass-dbi-plugin-abstractcount-perl-0.08/Makefile.PL --- libclass-dbi-plugin-abstractcount-perl-0.07/Makefile.PL 2005-06-19 23:27:28.000000000 +0100 +++ libclass-dbi-plugin-abstractcount-perl-0.08/Makefile.PL 2009-07-01 09:14:59.000000000 +0100 @@ -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 diff -Nru /tmp/bIKOSrRIY9/libclass-dbi-plugin-abstractcount-perl-0.07/META.yml /tmp/CMs4PqlSEi/libclass-dbi-plugin-abstractcount-perl-0.08/META.yml --- libclass-dbi-plugin-abstractcount-perl-0.07/META.yml 2006-06-14 10:06:34.000000000 +0100 +++ libclass-dbi-plugin-abstractcount-perl-0.08/META.yml 2009-07-01 09:17:00.000000000 +0100 @@ -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 +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 diff -Nru /tmp/bIKOSrRIY9/libclass-dbi-plugin-abstractcount-perl-0.07/t/03sql.t /tmp/CMs4PqlSEi/libclass-dbi-plugin-abstractcount-perl-0.08/t/03sql.t --- libclass-dbi-plugin-abstractcount-perl-0.07/t/03sql.t 2006-06-14 09:48:37.000000000 +0100 +++ libclass-dbi-plugin-abstractcount-perl-0.08/t/03sql.t 2009-07-01 09:10:00.000000000 +0100 @@ -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 warnings; -use Test::More tests => 20; +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' ); +@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' ); +@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' ); +@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 +@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' ); +@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 +@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 complicated (nested) function-call on multiple +# 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' ); +@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 complicated (nested) function-call on mixed +# 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' ); +@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' ); +@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__