in reply to Re^5: DBI, prepare_cached, finish, and forks
in thread DBI, prepare_cached, finish, and forks
DBI::db=HASH(0x0000000)->disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting)...I had:
And I know how to correct it in long form:$dbh->connect(...); $sth->prepare("SELECT COUNT(*) FROM table WHERE col=?"); $sth->execute($var); ($count)=$sth->fetchrow_array; $dbh->disconnect;
but is there a better way to call it (instead of fetchrow_array()) without the while() loop since I know there will only be one row returned?$dbh->connect(...); $sth->prepare("SELECT COUNT(*) FROM table WHERE col=?"); $sth->execute($var); # added while() while(($count)=$sth->fetchrow_array) { ... } $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: DBI, prepare_cached, finish, and forks
by runrig (Abbot) on Feb 24, 2006 at 17:22 UTC | |
by Anonymous Monk on Feb 24, 2006 at 19:08 UTC | |
by runrig (Abbot) on Feb 24, 2006 at 22:35 UTC |