php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64096 Error when trying to fetch Informix-lvarchar-Data
Submitted: 2013-01-29 11:36 UTC Modified: 2021-11-28 04:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: gfratzke at arz-emmendingen dot de Assigned: cmb (profile)
Status: No Feedback Package: PDO_IBM (PECL)
PHP Version: 5.3.21 OS: Red Hat Enterprise Linux 5.8
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-01-29 11:36 UTC] gfratzke at arz-emmendingen dot de
Description:
------------
An error occurs when trying to fetch Informix-Lvarchar-Data with IBM-PDO:

Zend_Db_Statement_Exception: (7006) SQLSTATE[07006]: Restricted data type attribute violation: -99999 [IBM][CLI Driver] CLI0102E  Invalid conversion. SQLSTATE=07006 (SQLFetchScroll[-99999] at /builddir/build/BUILD/PDO_IBM-1.3.2/ibm_statement.c:1156)

Informix Dynamic Server 11.70.FC5


Test script:
---------------
$sql = 'SELECT field FROM table WHERE field_id = :fieldId';
$stmt = $this->db->prepare($sql);
$stmt->bindParam(':fieldId', $fieldId);

$stmt->execute();
$stmt->fetch();


Patches

add-long-varchar-support (last revision 2013-01-30 13:33 UTC by cloeffler at arz-emmendingen dot de)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-29 13:21 UTC] cloeffler at arz-emmendingen dot de
The given test case relies on components of the Zend Framework.

Simple test case:
-----------------

//CREATE TABLE
//    newTestTable
//    (
//        col1 INTEGER,
//        col2 lvarchar,
//        PRIMARY KEY (col1)
//    )
//INSERT INTO newTestTable (col1, col2) VALUES (1, 'Das ist ein langer Text. Das ist ein langer Text. Das ist ein langer Text.');


$dbh = new PDO("ibm:DRIVER={IBM DB2 ODBC DRIVER};HOSTNAME=ourhostname;PORT=1234;DATABASE=dbname;PROTOCOL=TCPIP;", "", "");

print "Connection Established!\n";
print "Driver name: " . $dbh->getAttribute(PDO::ATTR_DRIVER_NAME) . "\n\n";

$stmt = $dbh->prepare("select col1, col2 from newTestTable where col1 = 1;");
$stmt->execute();

while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    print_r($row);
    print "\n";
}

print "After Fetch\n";

print "PDO Error: " . $dbh->errorCode() . "\n";
print_r($dbh->errorInfo());
print "\n";

print "Statement Error: " . $stmt->errorCode() . "\n";
print_r($stmt->errorInfo());
print "\n";

$dbh = null;

Output:
-------

Connection Established!
Driver name: ibm

After Fetch
PDO Error: 07006
Array
(
    [0] => 07006
    [1] => -99999
    [2] => [IBM][CLI Driver] CLI0102E  Invalid conversion. SQLSTATE=07006 (SQLFetchScroll[-99999] at /builddir/build/BUILD/PDO_IBM-1.3.2/ibm_statement.c:1156)
)

Statement Error: 07006
Array
(
    [0] => 07006
    [1] => -99999
    [2] => [IBM][CLI Driver] CLI0102E  Invalid conversion. SQLSTATE=07006 (SQLFetchScroll[-99999] at /builddir/build/BUILD/PDO_IBM-1.3.2/ibm_statement.c:1156)
)
 [2013-01-30 13:39 UTC] cloeffler at arz-emmendingen dot de
I added the patch add-long-varchar-support which I found at http://www.iiug.org/opensource/ "The Open-Source for Informix Project".

We already patched the driver and installed it on our development server. The test script I posted now runs without an error. With this patch it is possible to read data from LVARCHAR columns in Informix with this driver.
 [2021-11-16 13:15 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-11-16 13:15 UTC] cmb@php.net
What's the status here?  Has that been fixed in the meantime?  If
not, I suggest to submit a pull request[1].

[1] <https://github.com/php/pecl-database-pdo_ibm>
 [2021-11-28 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Aug 11 14:05:44 2022 UTC