From:             [EMAIL PROTECTED]
Operating system: MacOSX 10.1.2
PHP version:      4.1.1
PHP Bug Type:     ODBC related
Bug description:  odbc_fetch_row does not always return all rows

odbc_fetch_row( $cur) called repeatedly without passing the 
row argument should retrieve all the rows in a rowset 
sequentially. Instead, in my setup, if the query, to which 
$cur relates, is a SELECT * FROM ... ORDER BY..., a number 
or rows will be dropped (it seems rows for which some 
column is not unique in the rowset).

My setup is:

MacOSX 10.1.2 (what a pain to compile php4.1.1 on it!)
DB: OpenLink Virtuoso Lite 2.5
iodbc + Openlink Virtuoso Driver 02.50.2139

php built using:
./configure  --prefix=/usr  --sysconfdir=/etc  --
localstatedir=/var  --mandir=/usr/share/man --with-zlib --
with-xml  --with-iodbc=/usr/local/odbcsdk  --with-apxs < /
dev/null
(note that I had to use the libtool generated under 4.0.6 
in order to compile 4.1.1)

and this is the sample script (it includes the workaround, 
that is to always pass the $row argument to odbc_fetch_row)

<?php

        $conn = odbc_connect("test", "user","pass");
        $Query = "SELECT * FROM Bugtable ORDER BY Name";

/* BugTable is: 
CREATE TABLE Test.dba.BugTable (
        ID int IDENTITY NOT NULL PRIMARY KEY UNIQUE,
        Name char (10)
);
*/    
    //execute query
        $cur=odbc_exec($conn, $Query);

        $Outer=0;
        while( odbc_fetch_row( $cur)){  // this does not 
retrieve all
//        while( odbc_fetch_row( $cur, ++$Outer )){ // this 
does
        for($i=1; $i <= 2; $i++){
             
             printf("%s  ", odbc_result( $cur, $i ));

        }
        print "<p>";

        }

    //disconnect from database

        odbc_close( $conn);
?>
-- 
Edit bug report at: http://bugs.php.net/?id=15306&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to