且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL错误-命令不同步;您现在不能运行此命令

更新时间:2023-11-09 11:47:40

得到答案!似乎codeigniter的mysql驱动程序存在处理存储过程的错误.

Got the Answer! It seems like codeigniter's mysql driver has bugs handling stored procedures.

我通过更改

$db['default']['dbdriver'] = 'mysql';

$db['default']['dbdriver'] = 'mysqli';

我修改了 system/database/drivers/mysqli/mysqli_result.php 文件并添加了以下功能的帖子

Post that i modified the system/database/drivers/mysqli/mysqli_result.php file and added the below function

function next_result()
{
  if (is_object($this->conn_id))
  {
      return mysqli_next_result($this->conn_id);
  }
}

并如下修改模型

$db = $this->load->database('mailbox',TRUE);
$qry_res = $db->query('Call circle_pending_p()');

echo $db->_error_message();
$res = $qry_res->result_array();

$qry_res->next_result();
$qry_res->free_result();

if (count($res) > 0) {
      return $res;
} else {
      return 0;
}

这解决了问题!