所以我一直使用mysql驱动程序与编码器,但现在我需要执行存储过程,并且需要Mysqli驱动程序。因为mysql驱动程序显然不支持存储过程。现在我可以执行存储过程,但是本机会话管理器坏了。它不能在Ci_session表中存储会话。给出以下错误
错误编号:2014
命令不同步;你现在不能运行这个命令
更新ci_sessions
设置last_activity
= 1369672449, user_data
="2:{年代:9:'"user_data '";销售:0:'"'";销售:7:'"user_id '";销售:1:'"1 '";}"session_id
="1 b29074ae286b900b02e410916d93f26"
文件名:F: ' xampp '根项目' '数据库系统' ' DB_driver.php
行号:330
帮助!
这是Code Igniter中mysqli驱动程序的一个已知/常见问题。您可以通过将mysqli_driver.php中的_execute
方法替换为以下内容来克服它:
public function _execute($sql)
{
// Free result from previous query
@mysqli_free_result($this->result_id);
$sql = $this->_prep_query($sql);
// get a result code of query (), can be used for test is the query ok
$retval = @mysqli_multi_query($this->conn_id, $sql);
// get a first resultset
$firstResult = @mysqli_store_result($this->conn_id);
// free other resultsets
while (@mysqli_next_result($this->conn_id)) {
$result = @mysqli_store_result($this->conn_id);
@mysqli_free_result($result);
}
// test is the error occur or not
if (!$firstResult && !@mysqli_errno($this->conn_id)) {
return true;
}
return $firstResult;
}
不想改变系统文件,我已经采取了进一步的步骤,并按照这里的说明:https://github.com/EllisLab/CodeIgniter/wiki/Extending-Database-Drivers在application/libraries文件夹中创建我自己的MY_DB_mysqli_driver,然后将新的_execute
方法放入其中,以覆盖父类中的原始方法。