php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1039 odbc_fetch_into( ) doesn't ignore the rownumber parameter if it is not supporte
Submitted: 1999-01-07 02:05 UTC Modified: 1999-02-16 10:05 UTC
From: ccjust at prentice dot uq dot edu dot au Assigned:
Status: Closed Package: ODBC related
PHP Version: 3.0.6 OS: NT4.0 and MSSQL 6.5
Private report: No CVE-ID: None
 [1999-01-07 02:05 UTC] ccjust at prentice dot uq dot edu dot au
All these tests where done on an 
 - NT4.0 System latest Service Packs
 - MSSQL Server 6.5 (Running on the same machine).
 - PHP 3.06 Win32 Binary supplied from the PHP website.


This is what odbc_fetch_row currently does.
-------------------------
$status = odbc_fetch_into($q->Query_ID,0,&$testarray);

1. Reads the current row into the array $testarray .
2. Increments the row so that the next call to row 0 is the next record.

This works perfectly.
-------------------------
and
-------------------------
$status = odbc_fetch_into($q->Query_ID,4,&$testarray);

1. Fails due to the fact that specific rows are not available in MSSQL.

This should ignore the rownumber as it is not supported by MSSQL.
--------------------------

Also odbc_fetch_row( ) behaves as follows.
--------------------------
$status = odbc_fetch_row($q->Query_ID);

1. Fetches the current row and moves the cursor/row position forward 1.

Works Perfectly.
--------------------------
$status = odbc_fetch_row($q->Query_ID,5);

1. Fetches the current row.

This does not advance the cursor/row position forward 1.
This may not be a bug but it can cause serious problems with the PHPLib.
If possible can the rownumber be ignored if it not supported and the cursor advanced 1.
---------------------------

In short odbc_fetch_into( ) needs to ignore the rownumber when not supported by the database.
odbc_fetch_row( ) needs to autoincrement the cursor when rownumber is supplied to the function but not supported by the database.

or

Find a way to have the rownumber working with ODBC and MSSQL 6.5
(I would try if I had the slightest idea where to start and knew how to compile a Win32 binary. :) )


The Code
-------------------------------
$testarray = array();

$status = odbc_fetch_into($q->Query_ID,0,&$testarray);
echo "Stat is -- ".IntVal($status).".";
echo "Here it is -- ".$testarray[1]."<BR>";

$status = odbc_fetch_into($q->Query_ID,4,&$testarray);
echo "Stat is -- ".IntVal($status).".";
echo "Here it is -- ".$testarray[1]."<BR>";

$status = odbc_fetch_into($q->Query_ID,0,&$testarray);
echo "Stat is -- ".IntVal($status).".";
echo "Here it is -- ".$testarray[1]."<BR>";

$status = odbc_fetch_row($q->Query_ID,1);
$value = odbc_result($q->Query_ID,2);
echo "Stat is -- ".IntVal($status).".";
echo "Here it is -- ".$value."<BR>";

$status = odbc_fetch_row($q->Query_ID,3);
$value2 = odbc_result($q->Query_ID,2);
echo "Stat is -- ".IntVal($status).".";
echo "Here it is -- ".$value2."<BR>";

-----------------------------
Returns the results
-----------------------------
Stat is -- 19.Here it is -- Bail
Stat is -- 0.Here it is -- Bail
Stat is -- 19.Here it is -- Cash
Stat is -- 0.Here it is -- Cash
Stat is -- 0.Here it is -- Cash

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-02-16 10:05 UTC] kara
AFAIK the Windows ODBC DriverManager has a cursor library, so even
drivers that don't support absolute fetches (rownumbers) would work
with the rownumber parameter. Probably, the use of this cursor library
can be switched on and off, but don't ask me where ;-)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 07:01:29 2024 UTC