On 09/01/14 18:33, Eric Chamberlain wrote:
Correct. I ended up limiting the number of records I query at a time.
I'm not sure how much of the thread has been e-mailed to you but I have
an example that shows the method in which I was able to query N number
of records every iteration.
Unfortunately I don't seem to have seen that message. However that
reminds me that for completeness I should really show an example
fetching >1 row at a time in PDO (pgbench schema again):
$fetch_num = 100;
$cursql = "DECLARE cur1 CURSOR FOR SELECT * FROM pgbench_accounts
WHERE bid = ?";
$sql = "FETCH $fetch_num FROM cur1";
$dbh->beginTransaction();
$curstmt = $dbh->prepare($cursql);
$curstmt->execute(array(rand(0, 100)));
for (;;) {
$stmt = $dbh->prepare($sql);
$stmt->execute();
$rowarray = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($rowarray) {
foreach ($rowarray as $row) {
print "... " . $row['aid'] . " " . $row['bid'] . "\n";
}
} else {
break;
}
}
Regards
Mark
--
Sent via pgsql-php mailing list (pgsql-php@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php