#23146 [Fbk->NoF]: odbc_result column 1 empty after first use
| From: | sniper@php.net | Date: | Thu, 21 Aug 2003 05:00:32 +0000 |
| Subject: | #23146 [Fbk->NoF]: odbc_result column 1 empty after first use | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-46395@lists.php.net to get a copy of this message | ||
ID: 23146
Updated by: sniper@php.net
Reported By: wohlfarth dot m at web dot de
-Status: Feedback
+Status: No Feedback
Bug Type: ODBC related
Operating System: Win2k SP2
PHP Version: 4.3.2-RC
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2003-08-15 08:29:06] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2003-05-26 03:55:10] wohlfarth dot m at web dot de
Supplement...
The error occures by:
"SELECT List(ColumnX) as IDENT from TableA"
you can bypass the problem when doing the following:
"SELECT cast(List(Column) as varchar(1000)) as IDENT from TableA"
Samplecode:
<?php
echo "Connect to database...";
$iddb = odbc_connect('db1','user1','user1');
echo "OK<br>";
if ( $iddb == 0 ) {
echo "Error: Cannot connect to database.";
exit;
};
$sqlqry = "select List(ColumnA) as ColumnX from TableA";
echo "<hr>$sqlqry<br>";
$idresult = odbc_exec($iddb, $sqlqry);
$qryeof = odbc_fetch_row($idresult);
if ( !$qryeof ) {
echo "no result";
} else {
echo "Version 1 / Result 1: " . odbc_result($idresult, "ColumnX") .
"<br><br>";
echo "Version 1 / Result 2: " . odbc_result($idresult, "ColumnX") .
"<br><br>";
};
$sqlqry = "select cast(List(ColumnA) as varchar(1000)) as ColumnX from
TableA";
echo "<hr>$sqlqry<br>";
$idresult = odbc_exec($iddb, $sqlqry);
$qryeof = odbc_fetch_row($idresult);
if ( !$qryeof ) {
echo "no result";
} else {
echo "Version 2 / Result 1: " . odbc_result($idresult, "ColumnX") .
"<br><br>";
echo "Version 2 / Result 2: " . odbc_result($idresult, "ColumnX") .
"<br><br>";
};
odbc_close($iddb);
?>
Result of Samplecode:
Connect to database...OK
------------------------------------------------------------
select List(ColumnA) as ColumnX from TableA
Version 1 / Result 1: res1,res2,res3
Version 1 / Result 2:
------------------------------------------------------------
select cast(List(ColumnA) as VarChar(1000)) as ColumnX from TableA
Version 2 / Result 1: res1,res2,res3
Version 2 / Result 2: res1,res2,res3
------------------------------------------------------------------------
[2003-05-26 03:15:36] wohlfarth dot m at web dot de
Please apology for the long waiting period...
Right !
I learned in the meantime that this can be produced in different ways.
I could cause the effect with List(ColumnX) and with a Subquery as
column. I suppose the error occurs, when the fieldtype is not defined
by a field from a table of the database.
------------------------------------------------------------------------
[2003-04-24 07:41:01] kalowsky@php.net
Just to make sure, this is using the example you've posted above, not
some deviation, right?
------------------------------------------------------------------------
[2003-04-24 03:22:07] wohlfarth dot m at web dot de
Complete Logfile is very long, here is the part of interest:
750-b24 ENTER SQLGetData
HSTMT 00EC1DB0
UWORD 9
SWORD 1 <SQL_C_CHAR>
PTR 0x053E8620
SQLLEN 4096
SQLLEN * 0x0595C5E4
750-b24 EXIT SQLGetData with return code 0
(SQL_SUCCESS)
HSTMT 00EC1DB0
UWORD 9
SWORD 1 <SQL_C_CHAR>
PTR 0x053E8620 [ 11] "521 (70074)" --> first
odbc_result here
SQLLEN 4096
SQLLEN * 0x0595C5E4 (11)
750-b24 ENTER SQLGetData
HSTMT 00EC1DB0
UWORD 9
SWORD 1 <SQL_C_CHAR>
PTR 0x053E9638
SQLLEN 4096
SQLLEN * 0x0595C5E4
750-b24 EXIT SQLGetData with return code 100
(SQL_NO_DATA_FOUND) --> ERROR here ???
HSTMT 00EC1DB0
UWORD 9
SWORD 1 <SQL_C_CHAR>
PTR 0x053E9638
SQLLEN 4096
SQLLEN * 0x0595C5E4
750-b24 ENTER SQLExtendedFetch
HSTMT 00EC1DB0
UWORD 1 <SQL_FETCH_NEXT>
SQLROWOFFSET 1
SQLROWSETSIZE * 0x0520F318
UWORD * 0x0520F320
750-b24 EXIT SQLExtendedFetch with return code 0
(SQL_SUCCESS)
HSTMT 00EC1DB0
UWORD 1 <SQL_FETCH_NEXT>
SQLROWOFFSET 1
SQLROWSETSIZE * 0x0520F318 (1)
UWORD * 0x0520F320 (0)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/23146
--
Edit this bug report at http://bugs.php.net/?id=23146&edit=1