Changeset 2807
- Timestamp:
- 11/13/08 19:57:47 (8 weeks ago)
- Location:
- trunk/htdocs/system
- Files:
-
- 4 modified
-
classes/databaseconnection.php (modified) (3 diffs)
-
schema/mysql/connection.php (modified) (1 diff)
-
schema/pgsql/connection.php (modified) (1 diff)
-
schema/sqlite/connection.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/htdocs/system/classes/databaseconnection.php
r2731 r2807 293 293 * @experimental 294 294 * @todo EVERYTHING... :) 295 * Implemented in child classes. Most RDBMS use ANSI-92 syntax, 296 * ( CALL procname ( param1, param2, ... ), 297 * so they return the call to here. Those that don't, handle the call individually 295 298 */ 296 299 public function execute_procedure( $procedure, $args = array() ) … … 304 307 } 305 308 306 /* 307 * Since RDBMS handle the calling of procedures 308 * differently, we need a simple abstraction 309 * mechanism here to build the appropriate SQL 310 * commands to call the procedure... 311 */ 312 $driver = $pdo->getAttribute( PDO::ATTR_DRIVER_NAME ); 313 switch ( $driver ) { 314 case 'mysql': 315 case 'pgsql': 316 case 'db2': 317 /* 318 * These databases use ANSI-92 syntax for procedure calling: 319 * CALL procname ( param1, param2, ... ); 320 */ 321 $query = 'CALL ' . $procedure . '( '; 322 if ( count( $args ) > 0 ) { 323 $query.= str_repeat( '?,', count( $args ) ); // Add the placeholders 324 $query = substr( $query, 0, strlen( $query ) - 1 ); // Strip the last comma 325 } 326 $query.= ' )'; 327 break; 328 case 'oracle': 329 die( sprinf(_t('not yet supported on %s'), $driver) ); 330 break; 331 } 309 $query = 'CALL ' . $procedure . '( '; 310 if ( count( $args ) > 0 ) { 311 $query.= str_repeat( '?,', count( $args ) ); // Add the placeholders 312 $query = substr( $query, 0, strlen( $query ) - 1 ); // Strip the last comma 313 } 314 $query.= ' )'; 315 $query = $this->sql_t( $query, $args ); 332 316 333 317 if ( $pdo_statement = $pdo->prepare( $query ) ) { … … 719 703 } 720 704 } 721 722 705 // Put the upgrade functions into an array using the 0-padded revision + '_1' as the key 723 706 $upgrade_functions = get_class_methods($this); -
trunk/htdocs/system/schema/mysql/connection.php
r2592 r2807 249 249 250 250 /** 251 * Execute a stored procedure 252 * 253 * @param procedure name of the stored procedure 254 * @param args arguments for the procedure 255 * @return mixed whatever the procedure returns... 256 */ 257 public function execute_procedure( $procedure, $args = array() ) 258 { 259 return parent::execute_procedure( $procedure, $args ); 260 } 261 262 /** 251 263 * Run all of the upgrades since the last database revision. 252 264 * -
trunk/htdocs/system/schema/pgsql/connection.php
r2592 r2807 330 330 331 331 /** 332 * Execute a stored procedure 333 * 334 * @param procedure name of the stored procedure 335 * @param args arguments for the procedure 336 * @return mixed whatever the procedure returns... 337 */ 338 public function execute_procedure( $procedure, $args = array() ) 339 { 340 return parent::execute_procedure( $procedure, $args ); 341 } 342 343 /** 332 344 * Run all of the upgrades since the last database revision. 333 345 * -
trunk/htdocs/system/schema/sqlite/connection.php
r2592 r2807 144 144 145 145 /** 146 * Execute a stored procedure 147 * 148 * @param procedure name of the stored procedure 149 * @param args arguments for the procedure 150 * @return mixed whatever the procedure returns... 151 * Not supported with SQLite 152 */ 153 public function execute_procedure( $procedure, $args = array() ) 154 { 155 die( _t( 'not yet supported on SQLite' ) ); 156 } 157 158 /** 146 159 * Run all of the upgrades since the last database revision. 147 160 *
