Mysql a "transakce"

Karel SOMMER karel na inway.cz
Úterý Srpen 17 18:14:00 CEST 1999


>
>         Existuje v MySQL nejake jednoznacne cislo klienta?
> Existuje jine reseni?
>

a nestacilo by vam todle?? je to mozna mensi zlo nez zamykani celych tabulek...

GET_LOCK(str,timeout)
     Tries to obtain a lock with a name given by the string str, with a timeout
of timeout seconds. Returns 1 if the lock was obtained
     successfully, 0 if the attempt timed out, or NULL if an error occurred
(such as running out of memory or the thread was killed with
     mysqladmin kill). A lock is released when you execute RELEASE_LOCK(),
execute a new GET_LOCK() or the thread terminates. This
     function can be used to implement application locks or to simulate record
locks.

     mysql> select GET_LOCK("lock1",10);
             -> 1
     mysql> select GET_LOCK("lock2",10);
             -> 1
     mysql> select RELEASE_LOCK("lock2");
             -> 1
     mysql> select RELEASE_LOCK("lock1");
             -> NULL

     Note that the second RELEASE_LOCK() call returns NULL because the lock
"lock1" was automatically released by the second GET_LOCK()
     call.
RELEASE_LOCK(str)
     Releases the lock named by the string str that was obtained with
GET_LOCK(). Returns 1 if the lock was released, 0 if the lock wasn't
     locked by this thread (in which case the lock is not released) and NULL if
the named lock didn't exist. The lock will not exist if it was never
     obtained by a call to GET_LOCK() or if it already has been released.


karel sommer


Další informace o konferenci Databases