From:             
Operating system: Linux
PHP version:      5.3.8
Package:          PDO_IBM
Bug Type:         Bug
Bug description:User Defined Types handlin

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

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

Reply via email to