Re: Bug #13055 [Com]: Prepare with more than one Parameter
| From: | Open Source Application Development | Date: | Tue, 01 Apr 2008 09:59:12 +0000 |
| Subject: | Re: Bug #13055 [Com]: Prepare with more than one Parameter | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-5329@lists.php.net to get a copy of this message | ||
Hi...
I have been able to reproduce the problem. Looking into it right now and
would get back to you ASAP :)
Thanks,
IBM OpenSource Application Development Team
Lenexa Labs, Kansas
"m dot djihangiroff at persona dot de" <pecl-dev@lists.php.net>
31/03/2008 18:58
To
Open Source Application Development/Lenexa/IBM@IBMUS
cc
Subject
[PECL-BUG] Bug #13055 [Com]: Prepare with more than one Parameter
Edit report at http://pecl.php.net/bugs/bug.php?id=13055&edit=1
ID: 13055
Comment by: m dot djihangiroff at persona dot de
Reported By: matthias dot djihangiroff at persona dot de
Status: Open
Id: 13055
Type: Bug
Package: PDO_INFORMIX
Operating System: OpenSuSE 10.3 x64
PHP Version: 5.2.5
New Comment:
This is my test case.
dbschema:
{ TABLE "informix".leps row size = 204 number of columns = 8 index size
= 30 }
create table "informix".leps
(
dokkey serial not null ,
mandant char(3) not null ,
nlnr char(4) not null ,
persnr char(8) not null ,
abrechdat date not null ,
lohn char(7),
lohnpdf "informix".clob,
name char(100) not null
);
revoke all on "informix".leps from "public";
create unique index "informix".ixkunstl2 on "informix".leps (dokkey)
using btree ;
create unique index "informix".ixrow2 on "informix".leps (nlnr,
persnr,abrechdat) using btree ;
PHP-Source:
session_start();
$session = session_id();
ini_set("error_reporting",E_ALL);
try
{
$db = new PDO('informix:host=primergy.konzern.intern;
service=1528; database=pdfarchiv; server=tcp_primergy;
protocol=onsoctcp; TRANSLATIONDLL=/opt/informix/lib/esql/igo4a304.so');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$var = '123456';
$monat = '10.01.2007';
//$monat = '2007-01-10';
$mandant = 'PS';
$stmt = $db->prepare("SELECT lohnpdf FROM leps WHERE
persnr=?
AND abrechdat =? AND mandant=?");
$stmt->bindParam(1, $var);
$stmt->bindParam(2, $monat);
$stmt->bindParam(3, $mandant);
$stmt->execute();
$stmt->bindColumn(1, $lob, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);
header("Content-type: application/pdf");
header("Content-Transfer-Encoding: binary");
fpassthru($lob);
} catch (PDOException $error) {
Echo "SQL-Error: " . $error->getMessage();
//print_r($stmt->errorInfo());
exit;
}
If you switch $monat from '2007-01-10' to '10.01.2007', i get the
following error:
SQL-Error: SQLSTATE[22018]: Invalid character value for cast
specification: -11106 [Informix][Informix ODBC Driver]Invalid character
value for cast specification. (SQLExecute[4294956190] at
/tmp/pear/cache/PDO_INFORMIX-1.2.0/informix_statement.c:730)
Previous Comments:
------------------------------------------------------------------------
[2008-03-14 11:59:59] opendev at us dot ibm dot com
Hi,
Please make sure that you are setting the DBDATE variable on the
machine where the CSDK is installed. I have tried to re-create this
issue and the following works:
<?php
require_once('fvt.inc');
class Test extends FVTTest
{
public function runTest()
{
$this->connect();
try {
/* Drop the test table, in case it exists */
$drop = 'DROP TABLE animals';
$result = $this->db->exec( $drop );
} catch( Exception $e ){}
/* Create the test table */
$create = 'CREATE TABLE animals (id INTEGER, a_date DATE)';
$result = $this->db->exec( $create );
$stmt = $this->db->prepare('insert into animals (id, a_date)
values (?, ?)');
print "inserting from file stream\n";
$zero = 0;
$a_date = '14.03.2008';
$stmt->bindParam( 1, $zero );
$stmt->bindParam( 2, $a_date );
$stmt->execute();
print "succesful\n";
print "runnign query\n";
$stmt = $this->db->prepare( 'select id, a_date from animals'
);
$stmt->bindColumn( 'ID' , $id );
$stmt->bindColumn( 'A_DATE' , $b_date );
$rs = $stmt->execute();
while ($stmt->fetch(PDO::FETCH_BOUND)) {
var_dump( $id );
var_dump( $b_date );
}
print "done\n";
}
}
$testcase = new Test();
$testcase->runTest();
?>
If it still does not work please provide a test case.
Thanks.
------------------------------------------------------------------------
[2008-03-14 02:38:57] matthias dot djihangiroff at persona dot de
It works with correct error statements now.
But it doesnt recognize german Date formats.
DBDATE is DMY4.
If i use '14.03.2008' it doesnt work.
If i use '2008-03-14' it work.
------------------------------------------------------------------------
[2008-03-13 18:06:15] opendev at us dot ibm dot com
Hi,
The following works for me:
<?php
require_once('fvt.inc');
class Test extends FVTTest
{
public function runTest()
{
$this->connect();
try {
/* Drop the test table, in case it exists */
$drop = 'DROP TABLE animals';
$result = $this->db->exec( $drop );
} catch( Exception $e ){}
/* Create the test table */
$create = 'CREATE TABLE animals (id INTEGER, my_clob clob)';
$result = $this->db->exec( $create );
$fp = fopen( dirname(__FILE__) . "/large_clob.dat" , "r" );
$stmt = $this->db->prepare('insert into animals (id, my_clob)
values (?, ?)');
print "inserting from file stream\n";
$zero = 0;
$stmt->bindParam( 1, $zero );
$stmt->bindParam( 2 , $fp , PDO::PARAM_LOB );
$stmt->execute();
print "succesful\n";
print "runnign query\n";
$stmt = $this->db->prepare( 'select id, my_clob from animals'
);
$stmt->bindColumn( 'ID' , $id );
$stmt->bindColumn( 'MY_CLOB' , $clob , PDO::PARAM_LOB );
$rs = $stmt->execute();
while ($stmt->fetch(PDO::FETCH_BOUND)) {
var_dump( $id );
var_dump( $clob );
}
print "done\n";
}
}
$testcase = new Test();
$testcase->runTest();
?>
Do you have a test case I can use to re-create this issue? Also, please
update to the latest version of PDO_INFORMIX and check if you still get
an error.
Thanks.
------------------------------------------------------------------------
[2008-02-05 02:35:10] matthias dot djihangiroff at persona dot de
Sorry, the PHP-Version is 5.2.5
------------------------------------------------------------------------
[2008-02-04 08:46:48] matthias dot djihangiroff at persona dot de
Description:
------------
The PHP-Version is: 5.2.3
If i start a prepare with more than one paramater (?), the sql does
nothing.
The same code is running fine on a open SuSE 10.3 with a PDO-INFORMIX
1.0.
Reproduce code:
---------------
$db = new PDO('informix:host=host; service=1528; database=database;
server=tcp_server; protocol=onsoctcp;
EnableScrollableCursors=1;TRANSLATIONDLL=/opt/informix/lib/esql/igo4a304.so');
$stmt = $db->prepare("INSERT INTO table (mandant, nlnr, rechnungsnr,
kundennr, rechnungsdat, fakturamon, auftragsnr, kundenname, referenznr,
kennzeichen, rechnungspdf)
VALUES (?,?,?,?,?,?,?,?,?,?,?)");
$stmt->bindParam(1, $data[0]);
$stmt->bindParam(2, $data[1]);
$stmt->bindParam(3, $data[2]);
$stmt->bindParam(4, $data[3]);
$stmt->bindParam(5, $data[4]);
$stmt->bindParam(6, $data[5]);
$stmt->bindParam(7, $data[6]);
$stmt->bindParam(8, $data[7]);
$stmt->bindParam(9, $data[8]);
$stmt->bindParam(10, $data[9]);
$stmt->bindParam(11, $fp, PDO::PARAM_LOB);
$stmt->execute();
Expected result:
----------------
Ive expect, that a file is put into the database as blob
Actual result:
--------------
The SQL doesnt insert anything.
A backtrace is: SQLParamData[0] at
/tmp/pear/cache/PDO_INFORMIX-1.1.0/informix_statement.c:783
------------------------------------------------------------------------
--
Edit this bug report at http://pecl.php.net/bugs/bug.php?id=13055&edit=1