How does Phalcon execute the native sql statement "LOCK TABLE table_name WRITE"; and "UNLOCK TABLES"? ??
|
Dec '16 |
4 |
875 |
1 |
How does Phalcon execute the native sql statement "LOCK TABLE table_name WRITE"; and "UNLOCK TABLES"? ??
Hi,
I think that phalcon doesn't implement such a feature (after a quick look at https://docs.phalcon.io/en/latest/api/Phalcon_Db_Dialect.html)
You will have to do that with raw sql: https://docs.phalcon.io/en/latest/reference/phql.html#using-raw-sql
What did you try exactly ?
Show code please ...
Thanks I tried; Does not work
ThinkPHP
$table_name='autoid_'.$name;
$auto=M($table_name);
mysql_query("LOCK TABLES `".$table_name."` WRITE");
$result=$auto->find();
$autoid=$result['id'];
$sava_id=$autoid+$num;
$result=$auto->execute("UPDATE `".$table_name."` SET `id`='".$sava_id."'");
mysql_query("UNLOCK TABLES");
Hi,
Ok. So,
mysql_query("LOCK TABLES
".$table_name."
WRITE");
doesn't work ? Maybe because it is a native mysql command wich is not formulated using phalcon's way. Are there any error in your webserver log ?
Also, to be sure, you may log your sql statement like this : https://docs.phalcon.io/en/latest/reference/model-events.html#logging-low-level-sql-statements