I'm writing a database update script (that makes the transition from one
DB version to another by executing some sql files in the right order). I
recently hit this bug:
http://framework.zend.com/issues/browse/ZF-1343
(not a framework bug, but a pdo_mysql bug)
So I decided to switch to the mysqli adapter. But it raises an issue
with my update script. I used to do the following:
$content = fread($fp, filesize($filePath));
try {
$result = $db->getConnection()->exec($content);
} catch (Zend_Exception $e) {
echo "[ERROR] Caught exception: " . get_class($e) . "\n";
echo "[ERROR] Message: " . $e->getMessage() . "\n";
return false;
}
With Mysqli, I get this while executing the script:
Fatal error: Call to undefined method mysqli::exec()
This is not a bug in the framework (the doc actualy says that exec() is
for PDO adaters). So my question is: how can I run an unprepared
statement using mysqli? Is it possible? The doc doesn't say how. It just
gives the code for PDO adapters.
Cheers,
O.
--
- *Olivier RICORDEAU* -
olivier@ricordeau.org
没有评论:
发表评论