Running stored procedures on Mysql 5.0 |
|||
|---|---|---|---|
| Date: | 07/24/2008 | Severity: | Minor |
| Status: | New | Reporter: | Leonardo Radoiu |
| Version: | 1.6.3 | ||
| Keywords: | Libraries, Database Class | ||
Description
Hello!
In Mysql 5.0 hen a stored procedure is called immediately after it runs one must use use mysqli_next_result() in order to be able to send the next command. Otherwise, the error “Command is out of sync” is triggered on the server.
Code Sample
In system/database/drivers/mysqli/mysqli_driver.php should be inserted the function:
function next_result() {
mysqli_next_result($this->conn_id);
}
so it can be called like:
$sql = "CALL my_procedure()";
$query = $this->db->query($sql);
$this->db->next_result();
