#36342 [NEW]: missing values on recordset with a very simple request

From: Date: Thu, 09 Feb 2006 14:28:00 +0000
Subject: #36342 [NEW]: missing values on recordset with a very simple request
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93076@lists.php.net to get a copy of this message
From:             teissierb at hotmail dot com
Operating system: WIN32
PHP version:      5.1.2
PHP Bug Type:     PDO related
Bug description:  missing values on recordset with a very simple request

Description:
------------
On SQL Server 2005 Express (free), using Windows XP, Wamp 1.6.0 (php
5.1.1) and PDO ODBC:

With a simple table PDO doesn't return what I expect him to. Might be dued
to the mix of varchar and (small, tiny)int.

Reproduce code:
---------------
create table T (
	[A]      	varchar(80) NOT NULL,
	[B]         tinyint NOT NULL,
	[C]       	varchar(100) NOT NULL,
	[D]         smallint NOT NULL,
	[E]       	varchar(1024) NOT NULL,
	[F]       	varchar(255) NOT NULL,
	[G]        	varchar(255) NOT NULL,
	[H]       	varchar(1000) NOT NULL,
	[I]         varchar(100) NOT NULL,
	[J]        	tinyint NOT NULL,
	[K]       	varchar(255) NULL 
)

insert into T values ('A', '1', 'C', '2', 'E',
'F', 'G', 'H', 'I', '3',
'K')
//////////////////////////////////////////////////////////////
try {
	$db = new PDO('odbc:Driver={SQL
Server};Server=HOST\INSTANCENAME;Database=XXXX;', "user", "pass");
} catch( PDOException $e ){
    die( $e->getMessage() );
}

foreach( $db->query("SELECT * FROM T ", PDO::FETCH_NUM)	as $row ) {
     echo "<pre>"; print_r( $row );echo "</pre>";
}

Expected result:
----------------
[0] => A
[1] => 1
[2] => C
[3] => 2
[4] => E
[5] => F
[6] => G
[7] => H
[8] => I
[9] => 3
[10] => K

Actual result:
--------------
[0] => A
[1] => 1
[2] => C
[3] => 2
[4] => 
[5] => F
[6] => G
[7] => 
[8] => I
[9] => 3
[10] => K

-- 
Edit bug report at http://bugs.php.net/?id=36342&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36342&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36342&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36342&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36342&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=36342&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36342&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36342&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36342&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36342&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36342&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=36342&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=36342&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36342&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36342&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36342&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36342&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36342&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36342&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36342&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36342&r=mysqlcfg


Thread (6 messages)

« previous php.bugs (#93076) next »