'Error while implementing 'lock table' in Zend

Following is my code for implementing lock to a table

$defaultDb = Zend_Db_Table::getDefaultAdapter();
$defaultDb->query("LOCK TABLES `test` WRITE");

But iam getting an error

exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: This command is not supported in the prepared statement protocol yet'

Zend_Db_Statement_Mysqli->_prepare('LOCK TABLES ..')

Can't we use lock in Zend ?



Solution 1:[1]

This is not really a Zend problem, rather Mysqli not accepting prepared statement for certain queries. See:

http://framework.zend.com/issues/browse/ZF-1398

and

Run an unprepared statement with Zend Db

You will need to extend the adapter, or write your SQL directly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community