Skip Menu |

This queue is for tickets about the POE-Component-Pool-DBI CPAN distribution.

Report information
The Basics
Id: 41567
Status: open
Priority: 0/
Queue: POE-Component-Pool-DBI

People
Owner: Nobody in particular
Requestors: me [...] evancarroll.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: awkward errors on ->do
I get awkward error like this: ->do(): dispatching event: "do"thread entry point at /usr/local/share/perl/5.10.0/POE/Component/Pool/DBI.pm line 121, <GEN0> line 1. testing & creating database connection at /usr/local/share/perl/5.10.0/POE/Component/Pool/DBI.pm line 128, <GEN0> line 1. preparing query at /usr/local/share/perl/5.10.0/POE/Component/Pool/DBI.pm line 142, <GEN0> line 1. executing query at /usr/local/share/perl/5.10.0/POE/Component/Pool/DBI.pm line 148, <GEN0> line 1. DBD::Pg::st execute failed: execute called with an unbound placeholder at /usr/local/share/perl/5.10.0/POE/Component/Pool/DBI .pm line 149, <GEN0> line 1. ->do(): dispatching event: "do"thread entry point at /usr/local/share/perl/5.10.0/POE/Component/Pool/DBI.pm line 121, <GEN0> line 1. Even though I'm not really doing anything complex $heap->{dbpool}->do( query => 'UPDATE inventory.pictures SET sha1 = ?, px_width = ?, px_height = ? WHERE lot_id = ? AND vin = ? AN D url = ?' , args => [ $pic->sha1_store, $pic->pxWidth, $pic->pxHeight , $lotObj->lotid, $lotObj->vin, $pic->uri ] );
From: me [...] evancarroll.com
The problem is the doc sucks. The arguments are all named wrong, and capitalized wrong in both the synopsis and arguments. In addition use'ing inside of a conditional is retarded. Attached is a patch for great justice.
*** DBI.pm 2008-12-09 11:37:23.718368200 -0600 --- newDBI.pm 2008-12-09 11:35:36.030487680 -0600 *************** *** 13,18 **** --- 13,19 ---- use POE qw( Component::Pool::Thread ); use DBI; use threads::shared; + use Data::Dumper; use constant { DEBUG => 0, REFCOUNT_IDENTIFIER => "queries", *************** *** 28,35 **** # For tracking the job id. $self->{current_id} = 0; ! use Data::Dumper; ! print Dumper($self); print "Connections: $args{connections}"; --- 29,35 ---- # For tracking the job id. $self->{current_id} = 0; ! print Dumper($self) if DEBUG; print "Connections: $args{connections}"; *************** *** 190,196 **** if (defined $callback) { if (DEBUG) { - use Data::Dumper; print "dispatching response ($caller, $callback)", Dumper(\@results); --- 190,195 ---- *************** *** 221,237 **** my ($kernel, $heap) = @_[ KERNEL, HEAP ]; my $dbpool = POE::Component::Pool::DBI->new( ! MaxConnections => 10, ! DSN => "DBI:mysql:database=test", ! Username => "username", ! Password => "password" ); # Outstanding queries keep the calling session alive. $dbpool->query( callback => "handle_result", query => "select foo from bar where foo = ?", ! args => [ "foo" ], userdata => "example" ); --- 220,236 ---- my ($kernel, $heap) = @_[ KERNEL, HEAP ]; my $dbpool = POE::Component::Pool::DBI->new( ! connections => 10, ! dsn => "DBI:mysql:database=test", ! username => "username", ! password => "password" ); # Outstanding queries keep the calling session alive. $dbpool->query( callback => "handle_result", query => "select foo from bar where foo = ?", ! params => [ "foo" ], userdata => "example" ); *************** *** 255,261 **** # important. $dbpool->do( query => "INSERT INTO results (query, count) VALUES (?,?)", ! args => [ $udata, @$results ], ); # Ask for a clean shutdown. --- 254,260 ---- # important. $dbpool->do( query => "INSERT INTO results (query, count) VALUES (?,?)", ! params=> [ $udata, @$results ], ); # Ask for a clean shutdown. *************** *** 329,335 **** will be invoked immediately, but it will be cached within the connection (see L<DBI> prepare_cached). ! =item args The arguments to provide to DBI's execute method (see L<DBI>). --- 328,334 ---- will be invoked immediately, but it will be cached within the connection (see L<DBI> prepare_cached). ! =item params The arguments to provide to DBI's execute method (see L<DBI>).