Techniczny

Icon

Ciąg dalszy walki z CodeIgniterem przyniósł kolejne problemy… tym razem pojawił się błąd w trakcie korzystania z procedur:

A Database Error Occurred
Error Number: 2014

Commands out of sync; you can't run this command now

Rozwizaniem jest podmienienie funkcji function _execute($sql) w /system/databases/drivers/mysqli/mysqli_driver.php na:

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;
}

Leave a Reply