diff options
Diffstat (limited to 'lib/POE')
-rw-r--r-- | lib/POE/Component/Pg.pm | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/POE/Component/Pg.pm b/lib/POE/Component/Pg.pm index 4a02caa..27fb9b2 100644 --- a/lib/POE/Component/Pg.pm +++ b/lib/POE/Component/Pg.pm @@ -76,9 +76,9 @@ use DBI; use DBD::Pg ':async'; sub QACT { 0 } -sub QQUERY { 1 } -sub QPARAM { 2 } -sub QSESID { 3 } +sub QSESID { 1 } +sub QQUERY { 2 } +sub QPARAM { 3 } sub QEVENT { 4 } sub QARG { 5 } @@ -190,24 +190,22 @@ sub unlisten { } -# Arguments: hash of: query, params, event, args +# Arguments: query, params, event, args sub query { - $_[KERNEL]->call($_[SESSION], 'addqueue', @_[ARG0..$#_], sender => $_[SENDER]->ID, action => 'query'); + $_[KERNEL]->call($_[SESSION], 'addqueue', [ 'query', $_[SENDER]->ID, @_[ARG0..$#_] ]); } # same as query, but doesn't try to fetch the rows sub do { - $_[KERNEL]->call($_[SESSION], 'addqueue', @_[ARG0..$#_], sender => $_[SENDER]->ID, action => 'do'); + $_[KERNEL]->call($_[SESSION], 'addqueue', [ 'do', $_[SENDER]->ID, @_[ARG0..$#_] ]); } sub addqueue { - my %opt = @_[ARG0..$#_]; - # add query to the queue - push @{$_[HEAP]{queue}}, [ $opt{action}, $opt{query}, $opt{params}, $opt{sender}, $opt{event}, $opt{args} ]; - $_[KERNEL]->refcount_increment($opt{sender}, 'P:C:PG'); + push @{$_[HEAP]{queue}}, $_[ARG0]; + $_[KERNEL]->refcount_increment($_[ARG0][QSESID], 'P:C:PG'); # if there's no query in progress, initiate query if($_[HEAP]{state} == 0) { |