[Db] Mettere query in "pausa"

Davide Michel 'ZioBudda' Morelli michel a ziobudda.net
Mar 16 Ott 2007 11:09:50 CEST


Simone Fumagalli ha scritto:
> Domenico L. wrote:
>   
>> lock table?
>>     
>
> Potrebbe funzionare se lo script durasse pochi secondi.
>
> Il punto è che lo script gira per circa 2 minuti e se metto in lock la
> tabella la percezione dell'utente è quella che il sistema si è bloccato
> in quanto gli script rimarrebbero "appesi" sino a quando la tabella è in
> lock.
>   
Solo uno spunto

Re: How to check if table is locked
Posted by: *KimSeong Loh* 
<http://forums.mysql.com/profile.php?97,139678> ()
Date: July 06, 2005 07:48PM

You can create a user defined lock with GET_LOCK(str,timeout), see 
[dev.mysql.com 
<http://dev.mysql.com/doc/mysql/en/miscellaneous-functions.html>]

Do a get_lock with timeout 0, before your LOCK TABLE and release_lock 
after your UNLOCK TABLES.
Another thread running the get_lock will return a value 0 to indicate 
the locks is being held by another thread.

You have to be consistant to make this work, and it will not work if any 
thread LOCK TABLES without calling get_lock first.


M.

-- 
Michel 'ZioBudda' Morelli                       michel a ziobudda.net
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net                         ICQ: 58351764  
http://www.ziobuddalabs.it                      Skype: zio_budda
http://www.ajaxblog.it        			MSN: michel a ziobuddalabs.it                   
						JABBER: michel a gmail.com

-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: http://lists.ziobudda.net/pipermail/db/attachments/20071016/acafa24d/attachment.html 


Maggiori informazioni sulla lista Db