RE: [dbi] Execute marks end of transaction?




On 11-Jul-2006 Jimmy Li wrote:
Can I end a transaction as soon as I call execute()?

Yes

or do I have to wait
until I finish fetching all the rows?

No

For example, I have:

------------------------------------------------------------------------------
------------------------------------------------------------------------------
----------
$dbh->do("start transaction");

my $groups_query = $dbh->prepare(qq{select id, name from staff_grp});
$groups_query->execute;

# place1

$groups_query->finish if (want_to_stop_here);


while (my @one_group = $groups_query->fetchrow_array)
{
print @one_group;
}

#place 2

------------------------------------------------------------------------------
------------------------------------------------------------------------------
----------

Can I end the transaction in #place1 or do I have to wait until #place2?

See above.

Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com

.



Relevant Pages

  • SQL CE Transaction Problem
    ... The connection's current state is Open, Fetching. ... I have executed previous SQL statements, but they should have been completed several lines before I try to start the transaction. ... SQLConn is a global varialbe that I am using for my connection. ...
    (microsoft.public.pocketpc.developer)
  • Re: [dbi] Execute marks end of transaction?
    ... On 11-Jul-2006 Jimmy Li wrote: ... > Can I end a transaction as soon as I call execute? ... Depends on the statement, of course, and the AutoCommit mode. ...
    (perl.dbi.users)
  • Execute marks end of transaction?
    ... Can I end a transaction as soon as I call execute()? ... until I finish fetching all the rows? ... Can I end the transaction in #place1 or do I have to wait until #place2? ...
    (perl.dbi.users)