I written the below code in common controller. I will pass the
model_name and it has to lock and unlock the table.
Please help me to correct this code...
I written the below code in common controller. I will pass the
model_name and it has to lock and unlock the table.
That's not how it works. Behind the scenes, it will generate an SQL
statement: SELECT FOR UPDATE, if wrapped in a transaction, then it will
create a lock and then release it when transaction ends.
If you are using MySQL, you need to make sure that you are using a DB
engine that supports transactions if you plan to use them. You will
probably have to use SQL to do the table locking, so if you are using
mysql look in the MySQL manual for the table lock command. Then write
a (pair) class method to lock and unlock the table.
It might be more helpful to explain why you think you need to lock the
table.
Brendon.
If you are using MySQL, you need to make sure that you are using a DB
engine that supports transactions if you plan to use them. You will
probably have to use SQL to do the table locking, so if you are using
mysql look in the MySQL manual for the table lock command. Then write
a (pair) class method to lock and unlock the table.
It might be more helpful to explain why you think you need to lock the
table.
Brendon.
On May 6, 3:54�am, Venkat Eee <rails-mailing-l...@andreas-s.net>
Hey, thanks to all...
My code is working..thanks....
If you are using MySQL, you need to make sure that you are using a DB
engine that supports transactions if you plan to use them. You will
probably have to use SQL to do the table locking, so if you are using
mysql look in the MySQL manual for the table lock command. Then write
a (pair) class method to lock and unlock the table.
It might be more helpful to explain why you think you need to lock the
table.
Brendon.
On May 6, 3:54�am, Venkat Eee <rails-mailing-l...@andreas-s.net>
Hey, thanks to all...
My code is working..thanks....
imagine you lock the tables.. and then you will be disconnected from the session for some reason... tables are still locked, no way to work with them. That's the point dbs have transations...
imagine you lock the tables.. and then you will be disconnected from the
session for some reason... tables are still locked, no way to work with
them. That's the point dbs have transations...
actually mysql releases table locks held by a client if connection to
that client dies (I suppose it might take a while for it to notice
though). Table locks are generally not a very good thing generally.