Re: (Fwd) How to loop through a database, row by row, and select and update one row at a time

2010-04-13 Thread Martin J. Evans
Bruce Johnson wrote: > > On Apr 13, 2010, at 1:56 AM, Troy Mulder wrote: > >> However, when I put any sort of an update command after that, as in: >> >> while ( @xml_content = $sth->fetchrow_array() ) { >> $sth = $dbh->prepare("SELECT msgid, xmlcontent FROM messages WHERE >> msgid = 1892362")

Re: (Fwd) How to loop through a database, row by row, and select and update one row at a time

2010-04-13 Thread Bruce Johnson
On Apr 13, 2010, at 1:56 AM, Tim Bunce wrote: However, when I put any sort of an update command after that, as in: while ( @xml_content = $sth->fetchrow_array() ) { $sth = $dbh->prepare("SELECT msgid, xmlcontent FROM messages WHERE msgid = 1892362"); print "Message ID = $msgid\n"; $

Re: (Fwd) How to loop through a database, row by row, and select and update one row at a time

2010-04-13 Thread Jonathan Leffler
On Tue, Apr 13, 2010 at 1:56 AM, Tim Bunce wrote: > - Forwarded message from Troy Mulder - > > Date: Mon, 12 Apr 2010 17:48:37 -0400 > From: Troy Mulder > To: tim.bu...@pobox.com > Subject: How to loop through a database, row by row, and select and update >one row at a time > >

RE: (Fwd) How to loop through a database, row by row, and select and update one row at a time

2010-04-13 Thread John Scoles
Sounds more like an SQL problem to me. The way you are doing that update is the most inefficient ways possible. They doing this as one SQL statement with an Update select or Join rather that select one subset and iterate over it to update another. Anyway in you perl code >$s