Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #15922 LOB support only works with named placeholders
Submitted: 2009-02-20 18:26 UTC
From: mameier Assigned:
Status: Open Package: MDB2_Driver_oci8
PHP Version: 5.2.5 OS: linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 31 - 3 = ?

 
 [2009-02-20 18:26 UTC] mameier (Martin Meier)
Description: ------------ assuming a table create table lobtest (id number(10), lots_of_chars clob) I get the error mentioned below. The reason is, that the expression in the RETURNING clause does not reference the LOB. To reference the CLOB column, the names parameter also has to have the same name as then db column. Unfortunately autoPrepare and autoExecute are building queries with ? as placeholders, so they don't work. Modifying autoPrepare to build queries with named parameters would be easy, but would break compatibility :-( The cause of the problem is in MDB2_Driver_oci8::prepare(). Here it would be necessary to identify the name of the LOB column and store it in $lobs[]. So I don't have an easy solution. Test script: --------------- $data = array('id'=>1,'lots_of_chars'=>'any number of information'); $types = array('integer','clob'); // this way it works $query = "insert into lobtest (id,lots_of_chars) values (:id, :lots_of_chars)"; $stm =& $db->prepare($query,$types,MDB2_PREPARE_MANIP); $res = $stm->execute($data); if (PEAR::isError($res)) { echo $res->getMessage().' '.$res->getUserInfo()."\n"; } else echo "OK\n"; // this way it doesn't $query = "insert into lobtest (id,lots_of_chars) values (?,?)"; $stm =& $db->prepare($query,$types,MDB2_PREPARE_MANIP); $res = $stm->execute(array_values($data)); if (PEAR::isError($res)) { echo $res->getMessage().' '.$res->getUserInfo()."\n"; } else echo "OK\n"; Expected result: ---------------- OK OK Actual result: -------------- OK MDB2 Error: unknown error _execute: [Error message: could not execute statement] [Last executed query: insert into lobtest (id,lots_of_chars) values (:0,EMPTY_CLOB()) RETURNING 1 INTO :1] [Native code: 932] [Native message: ORA-00932: inconsistent datatypes: expected CLOB got NUMBER]

Comments