php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15306 odbc_fetch_row does not always return all rows
Submitted: 2002-01-30 20:06 UTC Modified: 2002-05-13 18:22 UTC
From: dev+php at humph dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.1.1 OS: MacOSX 10.1.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dev+php at humph dot com
New email:
PHP Version: OS:

 

 [2002-01-30 20:06 UTC] dev+php at humph dot com
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);
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-13 18:22 UTC] kalowsky@php.net
running your sample script below I don't see the problem.  Although the big differences are I'm on 10.1.4, and PHP 4.3-dev.  Please try the 4.2.1 release and see if this continues for you.  
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Sep 16 18:01:30 2024 UTC