Hey yall,

I'm having some problems with EasyDBI.  I'm trying to do two simultaneous
selects from two different databases.  Both queries work fine via standard
DBI, but when I run through EasyDBI and POE, the queries take the right
amount of time (the query time is roughly 2 minutes), but they don't return
results - all I get is the Error value of the hash in ARG0 reporting the
query "Died".

The queries make use of DBD::ODBC if that matters.  My guess is maybe that
EasyDBI sees something in the return value that it interprets as the query
dying (maybe it's trying to compare the number of rows it got to the number
the DB reported it was sending?  just a WAG..), however, like I said, the
queries are ok using a normal DBI connection.

Here's the code I'm using though it won't be much help without the back end
DB.  If anyone has any ideas on how to debug, I'm all ears.  In the
meantime, I also tried SimpleDBI, stay tuned for those results... :)~

TIA,
-jp

#!/usr/bin/perl

use strict;
use warnings;

use POE;
use POE::Component::EasyDBI;

use Data::Dumper;
$Data::Dumper::Maxdepth = 1;

POE::Component::EasyDBI->spawn(
   alias       => 'db1',
   dsn         => 'dbi:ODBC:Sybase.db1',
   username    => 'user',
   password    => 'pass',
   stopwatch   => 1,
);

POE::Component::EasyDBI->spawn(
   alias       => 'db2',
   dsn         => 'dbi:ODBC:Sybase.db2',
   username    => 'user',
   password    => 'pass',
   stopwatch   => 1,
);

POE::Session->create(
   inline_states => {

       _start => sub {
           print '[' . localtime() . "] initiating db1 query\n";
           $_[KERNEL]->post( 'db1',
               arrayhash => {
                 sql          => 'select * from table where foo = ?',
                 event        => 'db1_result_handler',
                 placeholders => [ 'bar' ],
               }
           );

           print '[' . localtime() . "] initiating db2 query\n";
           $_[KERNEL]->post( 'db2',
               arrayhash => {
                 sql          => 'select * from table where foo = ?',
                 event        => 'db2_result_handler',
                 placeholders => [ 'bar' ],
               }
           );
       },

       db1_result_handler => sub {
           #my %success_hash = %{ $_[ARG0] };

           print '[' . localtime() . "] db1 query complete\n";
           print Dumper $_[ARG0];
           $_[KERNEL]->post( db1 => 'shutdown' );
       },

       db2_result_handler => sub {
           #my %success_hash = %{ $_[ARG0] };

           print '[' . localtime() . "] db2 query complete\n";
           print Dumper $_[ARG0];
           $_[KERNEL]->post( db2 => 'shutdown' );
       },

   },
);

$poe_kernel->run();

__END__

--
-jp


If Chuck Norris is late, time better slow the hell down.

Reply via email to