Ver Mensaje Individual
  #7 (permalink)  
Antiguo 27/01/2011, 21:25
Avatar de Drknow
Drknow
 
Fecha de Ingreso: febrero-2008
Mensajes: 121
Antigüedad: 16 años, 2 meses
Puntos: 1
Exclamación Respuesta: Fatal error: limpiar buffer de consulta PDO

quite los setAttribute

y solo agregue
$cn->setAttribute(PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1);

todo ok, pero me muestra esto

Fatal error: Call to a member function fetch() on a non-object in C:\www\webs\GestRecHuman\persistencia\Departamento DAOMySQL.php on line 18

Código PHP:

 
public function getAllDepartamentos()
    {
        
$departamentos = array();
        
$query 'CALL SPgetAllDepartamentos()';
    try {
            
$cn ConnectionManager::getInstance();
            
$rs $cn->query($query);
                while (
$dep $rs->fetch(PDO::FETCH_OBJ)) { // aqui el error
                    
$departamentos[] = new Departamento($dep->deptno,$dep->dname,$dep->loc);

                }
                    
$rs->closeCursor();
                    
$cn NULL;
    } catch (
PDOException $ex) {
            throw 
$ex;
    }
            return 
$departamentos;

    }