Error DETERMINISTIC, NO SQL, or READS SQL DATA en Mysql

When you create a stored function, you must declare either that it is deterministic or that it does not modify data. Otherwise, it may be unsafe for data recovery or replication.

By default, for a CREATE FUNCTION statement to be accepted, at least one of DETERMINISTIC, NO SQL, or READS SQL DATA must be specified explicitly. Otherwise an error occurs:

ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL,
or READS SQL DATA in its declaration and binary logging is enabled
(you *might* want to use the less safe log_bin_trust_function_creators
variable)

This function is deterministic (and does not modify data), so it is safe:

CREATE FUNCTION f1(i INT)
RETURNS INT
DETERMINISTIC
READS SQL DATA
BEGIN
  RETURN i;
END;
Anuncios

Solucion Para Codeignider multiple query, store procedure con mysql

Fuente: http://codeigniter.com/forums/viewthread/179001/

Error Number: 2014
Commands out of sync; you can’t run this command no
w

I have made small change in database/drivers/mysqli/mysqli_result.php function free_result()
to as below.
function free_result()
{

if (is_object($this->result_id)) {
mysqli_free_result($this->result_id);
/*
Edited by Safarath sk in order to free the mysqli multiple set results.
Date: 23/01/2011
*/
while ($this->conn_id->next_result()) {
/*free each result.*/
$result = $this->conn_id->use_result();
if ($result instanceof mysqli_result) {
$result->free();
}
}
$this->result_id = false;
}
}

update con subconsultas en mysql

ejemplo de como usar update con subconsultas con dos tablas tb_form_1 y tb_data_tram

update tb_form_1 set cod_oper = (select operacion from tb_data_tram where tramite = tb_form_1.num_tramite);

fuente: Maritza Parrales