When executing a specific query, I need to lock the db to ensure that no data is altered while the query executes.
My question is: Do I need to take a ROLLBACK on the db to release the lock, or is it enought just to set autocommit=1 again?
Simplified example of how I do it now:
SET AUTOCOMMIT=0
BEGIN
SELECT .......bla bla bla <execute some php code based on the result>
ROLLBACK
SET AUTOCOMMIT=1
Example of how I want it to be:
SET AUTOCOMMIT=0
BEGIN
SELECT .......bla bla bla <execute some php code based on the result>
SET AUTOCOMMIT=1
Are there any downsides by not using ROLLBACK in the second example? The database has not been altered in any way.