Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/12/2010, 20:28
Avatar de Drknow
Drknow
 
Fecha de Ingreso: febrero-2008
Mensajes: 121
Antigüedad: 16 años, 2 meses
Puntos: 1
Exclamación Fatal error: limpiar buffer de consulta PDO

Hola como estan estoy haciendo un sistemita y en un procedimiento donde muestro los datos del empleado y tambien su departamento(cargandolo en un combobox) me sale un error pues sale en el momento en que se ejecuta un procedimiento almacenado :

Este error se muestra cuando uso appserver, yo trabajo en modulos separados apache, mysql, php pero el docente lo revisa en appserver. -.- !

ERROR :
Código HTML:
Ver original
  1.  

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.' in C:\AppServ\www\GestRecHuman\persistencia\Departame ntoDAOMySQL.php:17 Stack trace: #0 C:\AppServ\www\GestRecHuman\persistencia\Departame ntoDAOMySQL.php(17): PDO->query('CALL SPgetAllDe...') #1 C:\AppServ\www\GestRecHuman\dominio\DepartamentoSe rvice.php(31): DepartamentoDAOMySQL->getAllDepartamentos() #2 C:\AppServ\www\GestRecHuman\dominio\DepartamentoFa cade.php(24): DepartamentoService->getAllDepartamentos() #3 C:\AppServ\www\GestRecHuman\presentacion\Modificar Empleado.php(88): DepartamentoFacade::listarDepartamentos() #4 C:\AppServ\www\GestRecHuman\presentacion\Modificar Empleado.php(118): ModificarEmpleado::main() #5 {main} thrown in C:\AppServ\www\GestRecHuman\persistencia\Departame ntoDAOMySQL.php on line 17


Estos son mis procesos

mi conexion es un singleton...

mi funcion que muestra un empleado

Código PHP:
Ver original
  1. public function getEmpleadoById($empno)
  2.     {
  3.     $empleado = NULL;
  4.     $query = 'CALL SPgetEmpleadoById(?)';
  5.     try {
  6.             $cn = ConnectionManager::getInstance();
  7.             $rs = $cn->prepare($query);
  8.             $rs->bindParam(1, $empno);
  9.            
  10.             $rs->execute();
  11.                 if ($emp = $rs->fetch(PDO::FETCH_OBJ)) {
  12.                     $empleado = new Empleado($emp->empno, $emp->ename, $emp->job, $emp->mgr, $emp->hiredate, $emp->sal, $emp->comm, $emp->deptno);
  13.                 }
  14.                     $rs->closeCursor();
  15.  
  16.                     $cn = null;
  17.     } catch (PDOException $ex) {
  18.             throw $ex;
  19.     }
  20.     return $empleado;
  21.     }

mi function que muestra los departamentos

Código PHP:
 public function getAllDepartamentos()
    {
        
$departamentos = array();
        
$query 'CALL SPgetAllDepartamentos()';
    try {
            
$cn ConnectionManager::getInstance();
            
$rs $cn->query($query); // e tratado con prepare y es igual
            
$rs->execute(); // aqui me muestra el error PDO
                
while ($dep $rs->fetch(PDO::FETCH_OBJ)) {
                    
$departamentos[] = new Departamento($dep->deptno,$dep->dname,$dep->loc);
        }
                    
$rs->closeCursor();
                    
$cn NULL;
    } catch (
PDOException $ex) {
            throw 
$ex;
    }
            return 
$departamentos;

    } 
cuando los llamo me muestra el error que les mostre
La verdad no se que hacer !!!

Saludos