Pergunta

If I write a script php writing in a database,
should I handle the locking of the database to avoid conflicts between users ?

Or is this issue handled by the web server ?

Foi útil?

Solução

Locks are handled implicitly by MySQL. You generally don't have to worry about issuing the actual lock statements, but you must be aware of how your updates are affecting other users.

InnoDB supports row level locking, so updates may be unobtrusive, assuming you're using a primary key.

Outras dicas

Sure you have to handle it ;)! For example you could use the "LOCK TABLE myTable WRITE" statement to prevent conflicts. When the user has released (throuh "UNLOCK TABLE") the resource, another user can operate with that table

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top