On Sun, Nov 04, 2001 at 09:06:02PM -0400, Corey Kaye wrote:

> This is my Perl script.  I though that adding $query->finish would
> unlock the table but it didn't.  It looks like the only way around
> this is to connect/disconnect from the DB between each update.  All
> that connecting/disconnecting i think would be expensive in itself.
> THERE MUST BE A BETTER WAY !  Thoughts, comments please!

Hm.  The table should only be locked while the update is running (a
very short time).  Are you sure that the table is locked while the
script is sleeping?

> for ($x=0;$x<=$#dbAnswer;$x++) {
> #     sleep(5);
>       $sql2 = "update answers set answersuper = \"\", backuprating = $dbAnswer[$x], 
>backupna = $dbAnswerNA[$x] where userid = $input{\"userid\"} and questionid = 
>$dbQuestionID[$x]";
>       $query2 = $database->prepare($sql2);
>       $query2->execute;
>       $query2->finish;
> }

Also, if you read up on DBI, you'll see that you can factor the

  $query2 = $database->prepare($sql2);

out of the loop and gain a bit of efficiency.

Jeremy
-- 
Jeremy D. Zawodny, <[EMAIL PROTECTED]>
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936

MySQL 3.23.41-max: up 60 days, processed 1,315,963,286 queries (253/sec. avg)

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to