[freeside-commits] freeside/FS/FS/Cron bill.pm,1.2.2.11,1.2.2.12
Ivan,,,
ivan at wavetail.420.am
Wed Apr 22 21:15:02 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS/Cron
In directory wavetail.420.am:/tmp/cvs-serv10394
Modified Files:
Tag: FREESIDE_1_7_BRANCH
bill.pm
Log Message:
does pg try to finish the query when the job addition is committed? well, if this works, that answers that. RT#4412
Index: bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Cron/bill.pm,v
retrieving revision 1.2.2.11
retrieving revision 1.2.2.12
diff -u -d -r1.2.2.11 -r1.2.2.12
--- bill.pm 22 Apr 2009 20:24:58 -0000 1.2.2.11
+++ bill.pm 23 Apr 2009 04:15:00 -0000 1.2.2.12
@@ -4,6 +4,7 @@
use vars qw( @ISA @EXPORT_OK );
use Exporter;
use Date::Parse;
+use DBI 1.33; #The "clone" method was added in DBI 1.33.
use FS::UID qw(dbh);
use FS::Record qw(qsearchs);
use FS::cust_main;
@@ -98,16 +99,18 @@
warn "searching for customers:\n". join("\n", @search). "\n"
if $opt{'v'} || $opt{'l'};
- dbh->do(
- "DECLARE cron_bill_cursor CURSOR WITH HOLD FOR ". #no WITH HOLD for mysql?
+ my $cursor_dbh = dbh->clone;
+
+ $cursor_dbh->do(
+ "DECLARE cron_bill_cursor CURSOR FOR ".
" SELECT custnum FROM cust_main ".
" WHERE ". join(' AND ', @search).
" ORDER BY custnum " #LIMIT 1000 "
- ) or die dbh->errstr;
+ ) or die $cursor_dbh->errstr;
while ( 1 ) {
- my $sth = dbh->prepare('FETCH 1000 FROM cron_bill_cursor'); #mysql?
+ my $sth = $cursor_dbh->prepare('FETCH 1000 FROM cron_bill_cursor'); #mysql?
$sth->execute or die $sth->errstr;
@@ -150,6 +153,8 @@
}
+ $cursor_dbh->commit or die $cursor_dbh->errstr;
+
}
1;
More information about the freeside-commits
mailing list