summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-07-15 14:07:59 +0000
committerYorhel <git@yorhel.nl>2009-07-15 14:07:59 +0000
commit0b250cb6d8823e7f63feb1d8a07019a68e287673 (patch)
treea783c66f526d4b242004679e3684851f9ec1417a
parent75d9c03a4e85f32871848e9da5f3ab723cdde5b8 (diff)
Changed arguments of the query and do events to be shorter
No need to for named arguments if they aren't likely to change and you'll often need to specify all arguments, anyway.
-rw-r--r--lib/POE/Component/Pg.pm18
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) {