0

tengo un procedimiento extenso que ejecutandolo directamente en mysql funciona, ahora cuando ya lo pongo en php me da error desde el inicio que es creando una tabla temporal desde donde voy a ir obteniendo datos para lo que sigue del reporte. Este es el código que pruebo y al ejecutar de devuelve OK porque el $stmt -> execute() se esta ejecutando pero la tabla no se crea.

   $stmt = Conexion::Conectar()->prepare("CREATE TEMPORARY TABLE 
        resultado_subdeterminante_temporal 
        (id int, idSubDeterminante int, posibles int, positivas 
        int)");

        if($stmt -> execute()){
           echo 'OK';
        } else {
           echo 'ERROR';
        }
        $stmt = null;

Estos son los Log MySql

2018-11-29 17:38:31 18908 [ERROR] Incorrect definition of table 
mysql.column_stats: expected column 'min_value' at position 3 to have type 
varbinary(255), found type varchar(255).

2018-11-29 17:38:31 18908 [ERROR] Incorrect definition of table 
mysql.column_stats: expected column 'max_value' at position 4 to have type 
varbinary(255), found type varchar(255).

Ahora si yo tomo esa consulta y la ejecuto en mysql o phpmyadmin se crea ok la tabla:

        CREATE TEMPORARY TABLE 
        resultado_subdeterminante_temporal 
        (id int, idSubDeterminante int, posibles int, positivas 
        int)

introducir la descripción de la imagen aquí

No comprendo el error, que significan los errores del log?

1 respuesta 1

0

SOLUCION

Lo solucione Upgradeando MySql.

-> Entrar a CMD
-> Navegar hasta llegar a la carpeta xampp/mysql/bin/
-> Ejecutar el comando mysql_upgrade -uroot -p
-> Completar password de la base
-> Se upgradea MySql
-> El procedimiento ya funciona

Fuente: https://stackoverflow.com/questions/53560207/failed-to-create-temporary-table-mysql-php-pdo-mysql-column-stats-expected-col/53560380#53560380

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.