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

Request #9332 Customize prepared statement name
Submitted: 2006-11-14 17:16 UTC
From: kailoran at gmail dot com Assigned:
Status: Open Package: MDB2 (version 2.3.0)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2006-11-14 17:16 UTC] kailoran at gmail dot com (Kailoran)
Description: ------------ It would be useful if prepare() took another argument that would be used to name the prepared statement instead of using $this->options['statement_format']. This would allow easy naming of individual statements without having to change the option every time and restoring it back afterwards. Test script: --------------- // One way of doing it: /* in MDB2.php, change default options['statement_format'] to have a placeholder for a string, eg. */ 'statement_format' => 'MDB2_STATEMENT%3$s_%1$s_%2$s' /* change the definition of prepare() */ function &prepare($query, $types = null, $result_types = null, $lobs = array(), $statement_name = '') /* in the prepare() functions, use the new parameter */ ... $statement_name = sprintf($this->options['statement_format'], $statement_name, $this->phptype, md5(time() + rand()), $statement_name);

Comments