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

Bug #19974 Bug in named placeholder parameter substitution in prepare()
Submitted: 2013-06-11 15:50 UTC
From: gacek Assigned:
Status: Open Package: MDB2_Driver_pgsql (version 1.5.0b4)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


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 : 15 + 5 = ?

 
 [2013-06-11 15:50 UTC] gacek (Piotr Gackiewicz)
Description: ------------ When using named placeholders (with option emulate_prepared==false), prepare() function misplaces them due to wrong $parameter counter usage. Test script: --------------- Try such SQL statement (transcription): $result=query_row('SELECT CAST(:p1 AS TEXT) AS r1, CAST(:p2 AS TEXT) AS r2, CAST(:p1 AS TEXT) AS r3, CAST(:p3 AS TEXT) AS r4', array( 'p1'=>'v1', 'p2'=>'v2', 'p3'=>'v3' ) ) Expected result: ---------------- array( 'r1'=>'v1', 'r2'=>'v2', 'r3'=>'v1', 'r4'=>'v3' ) Actual result: -------------- From postgresql.log: EXECUTE db2_statement_pgsql_2878e7cd3a2411850038698262023349030b5e903 ('v1', 'v2', 'v3') DETAIL: prepare: SELECT CAST($1 AS TEXT) AS r1, CAST($2 AS TEXT) AS r2, CAST($1 AS TEXT) AS r3, CAST($2 AS TEXT) AS r4 ERROR: wrong number of parameters for prepared statement "mdb2_statement_pgsql_208664a2f39741a37ff1c60380c0430d162a1ac36", Expected 2 parameters but got 3

Comments

 [2013-06-11 15:52 UTC] gacek (Piotr Gackiewicz)