Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/04/2013, 10:29
Avatar de h2swider
h2swider
 
Fecha de Ingreso: julio-2007
Ubicación: Ciudad de Buenos Aires
Mensajes: 932
Antigüedad: 16 años, 9 meses
Puntos: 194
Bug GetRowAssoc ADODB?

Estoy usando php 5.2 ( la ultima que permite usar mssql.dll)

La version de ADODB 5.18a (La mas reciente)

Resuelta que dependiendo si uso GetRowAssoc o FetchRow varían la cantidad de campos en el resultado, teniendo que ser los mismos, cambiando los indices de asociativos a numericos.

GetRowAssoc me da 10 columnas, mientras FetchRow 14 (esta es la correcta)

Lamentablemente necesito recuperar los nombres de las columnas, precisando el uso de GetRowAssoc.

¿Alguno sabe si ADODB tiene un bug que me pueda estar afectando con mssql?
¿O encuentran alguna falencia mia
Les muestro el ejemplo:

Código PHP:
$params = array('beneficio' => 'xxxxxxxxxx''gp' => 'xx');
$result = array();

$stmt $this->db->PrepareSP('sp_TOL_ObtenerDatosAfiliados');

$this->db->InParameter($stmt$params['beneficio'], 'p_Beneficiario');
$this->db->InParameter($stmt$params['gp'], 'p_GP');

$rs $this->db->Execute($stmt);

while (!
$rs->EOF) {
    
$result[] = $rs->GetRowAssoc(false);
    
$rs->MoveNext();

Código var_dump:
Ver original
  1. array(2) {
  2.   [0]=>
  3.   array(10) {
  4.     ["idhc"]=>
  5.     int(1016)
  6.     ["apellido"]=>
  7.     string(2) "NO"
  8.     ["nombre"]=>
  9.     NULL
  10.     ["tipodocumento"]=>
  11.     string(2) "DN"
  12.     ["numerodocumento"]=>
  13.     string(8) "03770106"
  14.     ["historiaclinica"]=>
  15.     string(4) "1016"
  16.     ["telefono"]=>
  17.     NULL
  18.     ["telefonoalternativo"]=>
  19.     NULL
  20.     ["telefonoalternativo2"]=>
  21.     NULL
  22.     ["email"]=>
  23.     NULL
  24.   }
  25.   [1]=>
  26.   array(10) {
  27.     ["idhc"]=>
  28.     int(1016)
  29.     ["apellido"]=>
  30.     string(1) "."
  31.     ["nombre"]=>
  32.     NULL
  33.     ["tipodocumento"]=>
  34.     string(2) "DN"
  35.     ["numerodocumento"]=>
  36.     string(8) "03770106"
  37.     ["historiaclinica"]=>
  38.     string(4) "1016"
  39.     ["telefono"]=>
  40.     NULL
  41.     ["telefonoalternativo"]=>
  42.     NULL
  43.     ["telefonoalternativo2"]=>
  44.     NULL
  45.     ["email"]=>
  46.     NULL
  47.   }
  48. }

Código PHP:
$params = array('beneficio' => 'xxxxxxxxxx''gp' => 'xx');
$result = array();

$stmt $this->db->PrepareSP('sp_TOL_ObtenerDatosAfiliados');

$this->db->InParameter($stmt$params['beneficio'], 'p_Beneficiario');
$this->db->InParameter($stmt$params['gp'], 'p_GP');

$rs $this->db->Execute($stmt);

while (
$arr $rs->FetchRow()) {
    
$result[] = $arr;

Código var_dump:
Ver original
  1. array(2) {
  2.   [0]=>
  3.   array(14) {
  4.     [0]=>
  5.     int(1016)
  6.     [1]=>
  7.     string(9) "FISCHETTI"
  8.     [2]=>
  9.     string(5) "MIRTA"
  10.     [3]=>
  11.     string(2) "DN"
  12.     [4]=>
  13.     string(8) "03770106"
  14.     [5]=>
  15.     string(4) "1016"
  16.     [6]=>
  17.     string(8) "49195240"
  18.     [7]=>
  19.     NULL
  20.     [8]=>
  21.     NULL
  22.     [9]=>
  23.     NULL
  24.     [10]=>
  25.     string(2) "NO"
  26.     [11]=>
  27.     NULL
  28.     [12]=>
  29.     NULL
  30.     [13]=>
  31.     NULL
  32.   }
  33.   [1]=>
  34.   array(14) {
  35.     [0]=>
  36.     int(1016)
  37.     [1]=>
  38.     string(9) "FISCHETTI"
  39.     [2]=>
  40.     string(5) "MIRTA"
  41.     [3]=>
  42.     string(2) "DN"
  43.     [4]=>
  44.     string(8) "03770106"
  45.     [5]=>
  46.     string(4) "1016"
  47.     [6]=>
  48.     string(8) "49195240"
  49.     [7]=>
  50.     NULL
  51.     [8]=>
  52.     NULL
  53.     [9]=>
  54.     NULL
  55.     [10]=>
  56.     string(1) "."
  57.     [11]=>
  58.     NULL
  59.     [12]=>
  60.     NULL
  61.     [13]=>
  62.     NULL
  63.   }
  64. }
__________________
Codifica siempre como si la persona que finalmente mantedra tu código sea un psicópata violento que sabe donde vives