Page 1 of 1

How to update all selected rows?

Posted: Tue Feb 14, 2012 4:29 am
by MicroBoy
Hello,

I have a script which is run every 5 minutes, it gets about 100 queries. Sometimes it needs more than 5 minutes so the other scripts start too and it gets some of the queries that were selected in the first cronjob. At every execute of the query I mark it as done but because sometimes script can not be finished in 5 minutes it will not have time to mark all as executed so the next cron job will get those queries as well. Is there anyway at the begin of SELECT to mark all selected as finished?

Re: How to update all selected rows?

Posted: Tue Feb 14, 2012 1:30 pm
by tr0gd0rr
Would it make sense to use a transaction? BEGIN TRANSACTION; SELECT ...; UPDATE ...; COMMIT;

Obviously you wouldn't want your transaction to last 5+ minutes, but a transaction may be useful for you.