views:

188

answers:

1

Due to a bug in my servers PDO version, I have switched to using MySQLi. However, this presents another problem, as the Zend_DB MySQLi adaptor doesn't have an exec function. (The Zend PDO adaptor did), which means I can't execute a sql script. (Containing a load of DROP TABLE and CREATE TABLE queries).

So where I could just do:

$sqlQuery = file_get_contents('schema.sql');
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$db->exec($sqlQuery);

I can't find a way to do this using the Zend MySQLi Adaptor. Any ideas?

+1  A: 

Try:

$sqlQuery = file_get_contents('schema.sql');
$adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$mysqli = $adapter->getConnection(); // i think the returns the Mysqli Instance directly...
$mysqli->multi_query($sqlQuery);
prodigitalson