ID: 35386 Comment by: thomas at last-it dot de Reported By: slapaf at hotmail dot com Status: Assigned Bug Type: PDO related Operating System: winxp sp2 PHP Version: 5CVS-2006-12-02 (snap) Assigned To: wez New Comment:
same problem on linux, php 5.1.2 I tried to debug the problem, but imho the problem is strange. The reason why the first row is null is as following: file: ext/pdo/pdo_stmt.c line: 532 <code> case PDO_PARAM_STR: if (value && !(value_len == 0 && stmt->dbh->oracle_nulls == PDO_NULL_EMPTY_STRING)) { ZVAL_STRINGL(dest, value, value_len, !caller_frees); if (caller_frees) { caller_frees = 0; } break; } default: ZVAL_NULL(dest); </code> With the first returned row from DB the first if clause above evaluates to false. so ZVAL_NULL is called. thats the reason for the null values in the first result set. Normally should "value" point to the argument "ptr" of the firebird_stmt_get_col function (in firebird_statement.c). gdp says that ptr is filled with the data out of DB properly. So why is "value" not the same as "ptr" and why is this only in the first result set?? greetz Thomas Previous Comments: ------------------------------------------------------------------------ [2006-02-08 18:49:28] turyak at gmail dot com yep, experiencing same problem.. php 5.1.2, firebird 1.5.2 is there solution already? ------------------------------------------------------------------------ [2005-11-25 11:38:32] slapaf at hotmail dot com Description: ------------ When using PDO for simple query in Firebird it returns first row as null. I've tried using ADODB for control and it returns the correct results. Reproduce code: --------------- $dbh = new PDO("firebird:dbname=localhost:test.fdb","****","******"); $sql='SELECT EVENT_NAME FROM EVENTS'; foreach($dbh->query($sql) as $row){ print '<pre>'.gettype($row['EVENT_NAME']).' : '.$row['EVENT_NAME']; } Expected result: ---------------- string : name 1 string : name 2 string : name 3 string : name 4 Actual result: -------------- NULL : string : name 2 string : name 3 string : name 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35386&edit=1