Hallo,
I'm using SAP DB 7.3.0.21 with apache 1.3.23/php 4.1.2.
I compiled php with both variants, using a driver manager (iODBC) and
using --with-sapdb, but got the same behavior.
I'm trying to determine the size of a result (from a SELECT-Statement):
First i've got a strange effect with "order by" using the follwing code:
=====================================
function row_count($sth, $CurrentPos=0){
$count = 0;
odbc_fetch_row($sth, 0);
while (odbc_fetch_row($sth)) {
$count++;
}
//odbc_fetch_row($sth, $CurrentPos) // Second call to this function
always returns 0 while uncomment this line;
return $count;
}
$DSN = "myDB";
$user = "DBA";
$pass = "DBA";
$dbh = odbc_connect($DSN, $user, $pass);
$query = "select 'x' from dual";
echo "Executing: $query<br>";
$sth = odbc_exec($dbh, $query);
echo "First loop: " . row_count($sth) . "<br>";
echo "Second loop: " . row_count($sth) . "<br>";
$query = "select 'x' from dual order by 1";
echo "Executing: $query<br>";
$sth = odbc_exec($dbh, $query);
echo "First loop: " . row_count($sth) . "<br>";
echo "Second loop: " . row_count($sth) . "<br>";
odbc_close($dbh);
=====================================
OUTPUT:
Executing: select 'x' from dual
First loop: 1
Second loop: 1
Executing: select 'x' from dual order by 1
First loop: 1
Second loop: 0
=====================================
Second problem is, when I call odbc_fetch_row($sth, 0) and the cursor is on
position 0 the result will be lost!?
If I do something wrong or you have any comments,
please report them to me.
Regards,
Kolja
Mit besten Gruessen
Kolja Kleist (Senior Developer)
____________________________________
MediaTransfer AG
Netresearch & Consulting
Rothenbaumchaussee 38, 20148 Hamburg
Tel: (040) 669 625 16
Fax: (040) 669 625 29
URL: http://b2b.mediatransfer.de
____________________________________
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general