From:             toes at pubsqrd dot com
Operating system: Amazon Linux
PHP version:      5.4.10
Package:          PDO related
Bug Type:         Bug
Bug description:selects on long varchar fields returns empty with PDO ODBC

Description:
------------
In short, it looks like selects on varchars columns which are long (some
indeterminate value, 1000 certainly qualifies) fail with PDO via ODBC.

The same query works with the following methods;

1. PDO using mysql
2. unixODBC directly (via isql)
3. vsql (the Vertica native command line client)
4. PHP ODBC

The error given is that column binding has not occurred.  This is odd -
note in the script I have deliberately used fetchColumn() to avoid the need
for column binding, in an effort to avoid this error.

This problem was found in 5.3.19 and also in 5.4.9.


Test script:
---------------
create table tobytest
(
  string_short varchar(50),
  string_long varchar(1000)
);

insert into tobytest (string_short, string_long) values ('short', 'long');

<?php

$db_connect = new PDO( "odbc:pubsquared", "dbadmin", "big science" );
$db_connect -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$q = $db_connect->prepare( "select string_long from tobytest" );
$q->execute();

$r = $q->fetchColumn();
print $r;

?>



Expected result:
----------------
[root@ip-1-1-1-1 ~]# php test4.php
long
[root@ip-1-1-1-1 ~]#


Actual result:
--------------
Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[SL010]: <<Unknown error>>: 0 [unixODBC][Driver Manager]SQLBindCol
returned SQL_ERROR on a attempt to bind a internal buffer
(SQLFetchScroll[0] at
/builddir/build/BUILD/php-5.4.9/ext/pdo_odbc/odbc_stmt.c:537)' in
/root/test4.php:8
Stack trace:
#0 /root/test4.php(8): PDOStatement->fetchColumn()
#1 {main}

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63949&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63949&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63949&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63949&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63949&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63949&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63949&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63949&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63949&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63949&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63949&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63949&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63949&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63949&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63949&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63949&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63949&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63949&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63949&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63949&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63949&r=mysqlcfg

Reply via email to