Run an unprepared statement with Zend Db
I am trying to use a LOAD DATA INFILE statement with a ZF 1.10.6 application. However, the Mys开发者_Go百科qli adapter reports that
Zend_Db_Statement_Mysqli_Exception: Mysqli prepare error: This command is not supported in the prepared statement protocol yet in /xxx/library/Zend/Db/Statement/Mysqli.php on line 77
So I can't use this feature with prepared statements. However the Zend_Db_Adapter_Abstract
creates a statement each time it queries the DB.
There is a bug filed in here about this issue:
http://zendframework.com/issues/browse/ZF-1398
It seems I can get the DB connection from the object directly with Zend_Db_Adapter_Abstract::getConnection()
however I find it a bit raw.
I was wondering if someone found an acceptable workaround to this problem?
I was about to ask the same thing as you. Since no one has answered yet, i would extend Zend_Db_Adapter_Mysqli (or which ever you are using) and create a method to run a method for an "unprepared" statement, something like queryWithoutPrepare($q). The body is pretty simple
return $this->getConnection()->query($q)
精彩评论