php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60277 User Defined Types handling
Submitted: 2011-11-12 08:32 UTC Modified: 2011-11-28 14:00 UTC
From: ash at inode dot me Assigned:
Status: Not a bug Package: PDO_IBM (PECL)
PHP Version: 5.3.8 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ash at inode dot me
New email:
PHP Version: OS:

 

 [2011-11-12 08:32 UTC] ash at inode dot me
Description:
------------
PHP - 5.3.2 latest Ubuntu package, PDO_IBM-1.3.2

Using a PDO object to insert even the simplest UDT produced error. This occurs 
in cases when using PrepareStatements or calling query() directly. Using the 
following tutorial as an example:

http://www.ibm.com/developerworks/data/library/techarticle/dm-0506melnyk/

Executing the following produces - SQLSTATE[07001]: <<Unknown error>>: -99999 
[IBM][CLI Driver] CLI0100E  Wrong number of parameters. SQLSTATE=07001 
(SQLExecute[-99999] at /usr/share/php/PDO_IBM-1.3.2/ibm_statement.c:986)

$a = 'Some'; $b = 'Person'; $c = '21 Street'; $d = 'Some City'; $e = 'MyState'; 
$f = '10101';
$stmt = $db->prepare("insert into clients (client_lname, client_fname) values 
(:1, :2, address_t() ..street(:3) ..city(:4) ..province(:5) 
..postal_code(:6))");
$stmt->bindParam(':1',$e);
$stmt->bindParam(':2',$f);
$stmt->bindParam(':3',$a);
$stmt->bindParam(':4',$b);
$stmt->bindParam(':5',$c);
$stmt->bindParam(':6',$d);

The following produces - SQLSTATE[42601]: Syntax error: -104 [IBM][CLI Driver]
[DB2/LINUX] SQL0104N
$db->query("insert into clients (client_lname, client_fname, address) values 
('Some', 'Person', address_t() ..street($c) ..city($d) ..province($e) 
..postal_code($f))");

This works - but if you want to insert LOBs you really have no options:

$db->query("insert into clients (client_lname, client_fname, address) values 
('Some', 'Person', address_t() ..street('". $a ."') ..city('" .$b ."') 
..province('". $c . "') ..postal_code('". $d ."'))");



Test script:
---------------
Create $db PDO connection and rung


try {

$a = 'Some'; $b = 'Person'; $c = '21 Street'; $d = 'Some City'; $e = 'MyState'; $f = '10101';
/*
$stmt = $db->prepare("insert into clients (client_lname, client_fname) values (:1, :2, address_t() ..street(:3) ..city(:4) ..province(:5) ..postal_code(:6))");
$stmt->bindParam(':1',$a);
$stmt->bindParam(':2',$b);
$stmt->bindParam(':3',$c);
$stmt->bindParam(':4',$d);
$stmt->bindParam(':5',$e);
$stmt->bindParam(':6',$f);
$stmt->execute();*/
$db->query("insert into clients (client_lname, client_fname, address) values ('Some', 'Person', address_t() ..street($c) ..city($d) ..province($e) ..postal_code($f))");

#$db->query("insert into clients (client_lname, client_fname, address) values ('Some', 'Person', address_t() ..street('". $a ."') ..city('" .$b ."') ..province('". $c . "') ..postal_code('". $d ."'))");
} catch (PDOException $e) {
print $e->getMessage() . "\n";
}


Expected result:
----------------
Named or unnamed placeholders should be bound properly and inserted.

Actual result:
--------------
See errors above

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-15 00:46 UTC] felipe@php.net
-Summary: User Defined Types handlin +Summary: User Defined Types handling
 [2011-11-19 10:08 UTC] ash at inode dot me
This was a false alarm. The queries don't work properly but it likely has nothing 
to do with the driver. Look here for the solution:

http://www.dbforums.com/db2/1671711-udt.html#post6525422
 [2011-11-28 14:00 UTC] fa@php.net
-Status: Open +Status: Bogus
 [2011-11-28 14:00 UTC] fa@php.net
Bogus - see comments.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC