[Dbix-class] CDBI::Sweet page method

Matt S Trout dbix-class at trout.me.uk
Wed Aug 3 16:56:40 CEST 2005


On Wed, Aug 03, 2005 at 04:30:49PM +0200, Bernard FRIT wrote:
> Being a bit off topic but looking for some help with CDBI::Sweet...
> 
> New to CDBI::Sweet and just playing around :
> 
> my $criteria = { auteur => {
>                     -between => [ 'f' , 'z']
>                     }
>                 };
> 
> my @livres = Librairie::Livre->search( $criteria ) ;
> 
> gives me perfect output as 
> 
> my @livres = Librairie::Livre->page( $criteria , { rows => 12, page => 3}) ;

This should be

my ($it, $pager) = ...
 
> gives the following error
> 
> DBD::mysql::st bind_param failed: Binding non-numeric field 2, value
> undef as a numeric! [for Statement "SELECT me.id, me.id, me.code,
> me.libelle, me.auteur, me.prix, me.image
> FROM   Livre me
> WHERE  ( me.auteur BETWEEN ? AND ? ) LIMIT ?, ?
> "] at /usr/local/lib/perl5/site_perl/5.8.6/Class/DBI.pm line 658.

Could you please try upgrading DBD::mysql to the latest version and try again?
I seem to recall a few people having their problems fixed by that.

If not, not sure off the top of my head - can you either (a) apply this diff -

matthewt at mccoy:Class-DBI-Sweet$ svk diff
=== lib/Class/DBI/Sweet.pm
==================================================================
--- lib/Class/DBI/Sweet.pm  (revision 5180)
+++ lib/Class/DBI/Sweet.pm  (local)
@@ -277,6 +277,8 @@
         }
     }
 
+    warn "$pre_fields, $from, $sql, ".join(', ', @{$columns || []});
+
     my $sth = $class->sql_Join_Retrieve( $pre_fields, $from, $sql );
 
     $class->_bind_param( $sth, $columns );
matthewt at mccoy:Class-DBI-Sweet$ 

and tell me what that warn outputs, or see if you can re-create it against
SweetTest.pm (in which case we can add it to the test suite as a regression
fix, as well as making it easier to find and squash the bug) - but if you
don't have time to / can't reproduce it against SweetTest, the above patch
should do the trick.

-- 
     Matt S Trout           Website: http://www.shadowcatsystems.co.uk
  Technical Director        E-mail:  mst (at) shadowcatsystems.co.uk
Shadowcat Systems Ltd.



More information about the Dbix-class mailing list