Hello Thomas 

> -----Original Message-----
> From: Thomas Schulz [mailto:[EMAIL PROTECTED] 
> Sent: Mittwoch, 19. April 2006 11:48
> To: maxdb@lists.mysql.com
> Subject: odbc_num_rows via PHP-ODBC returns -1
> 
> Hello,
> 
> we are actually migrating from Adabas D 11 to MaxDB 7.6.0.16 
> and are now
> testing the PHP functions via ODBC on Linux (configured PHP 4.4.2 with
> option "with-sapdb=..."). We are using the ODBC version, 
> because the new
> maxdb PHP driver don't work and we don't want to change too much.

Actually, the MaxDB PHP driver should work. If you have problems, which seem to 
be bugs, please report how the problems can be reproduced.

However, using PHP over ODBC is not prohibited ;-)

> 
> Most of the existing ODBC functions seems to work in the same way for
> Adabas and MaxDB, but there are some functions, which doesn't exist
> (odbc_fetch_array) or return wrong values (odbc_num_rows).
> 
> Small PHP example for odbc_num_rows:
> $conn = odbc_connect("host:testdb", "testuser", "testpassword");
> $result = odbc_exec($conn, "select * from testtab");
> $num_rows = odbc_num_rows($result);
> 
> If I fetch the content of all rows, I get them all. But odbc_num_rows
> return always -1! Is there a bug at this function?

No bug. The number of rows of a result set can not be determined in any case. 
Please compare the documentation in the ODBC reference for SQLRowCount, which 
is the ODBC-function behind. Actually SQLRowCount is not meant to count the 
rows of a result set. In principle this number can change (depending on the 
isolation level) during fetching the result set and is not reliable.

If you add the appendix "for reuse" to your select statement (select * from 
testtab for reuse), the result set is fully built in the kernel an 
odbc_num_rows should return the number of *this* result set.

Maybe this is a work around for you.



With kind regards  Thomas




----------------------------------------------
Dr. Thomas Kötter
SAP AG, Berlin
NW DT MaxDB

MaxDB: all you need!                   
www.mysql.com/products/maxdb  www.sapdb.org  

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to