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

Request #10278 Allow options to be passed in when creating tables
Submitted: 2007-03-06 11:07 UTC
From: fornax Assigned: ifeghali
Status: Closed Package: MDB2_Schema (version 0.7.1)
PHP Version: 4.3.11 OS: Centos 4.3, Apache 1.3
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 : 23 - 20 = ?

 
 [2007-03-06 11:07 UTC] fornax (Andrew Hill)
Description: ------------ The MDB2_Driver_Manager_Common::createTable() method allows for an array of options to be passed to it. This method is utilised by the MDB2_Schema::createTable() method, however, there is no way to pass in an array of options to MDB2_Schema::createTable(), so that the same table creation options can be used, if desired. (For example, MDB2 has recently added support for the MDB2_Driver_Manager_Common::createTable() method to create temporary tables by setting an value in the options array.) Please find a patch attached which adds the ability to pass in the array of options to MDB2_Schema::createTable(), so that it can be used in MDB2_Driver_Manager_Common::createTable(). The new parameter is at the end of the existing method signature, with a default value of an empty array, so BC should be maintained. Test script: --------------- --- MDB2/Schema.php (revision 4840) +++ MDB2/Schema.php (working copy) @@ -625,10 +625,12 @@ * @param array multi dimensional array that contains the * structure and optional data of the table * @param bool if the table/index should be overwritten if it already exists + * @param array an array of options to be passed to the database specific driver + * version of MDB2_Driver_Manager_Common::createTable(). * @return bool|MDB2_Error MDB2_OK or error object * @access public */ - function createTable($table_name, $table, $overwrite = false) + function createTable($table_name, $table, $overwrite = false, $options = array()) { $create = true; $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NOT_CAPABLE); @@ -653,7 +655,7 @@ } if ($create) { - $result = $this->db->manager->createTable($table_name, $table['fields']); + $result = $this->db->manager->createTable($table_name, $table['fields'], $options); if (PEAR::isError($result)) { return $result; }

Comments

 [2007-03-10 15:34 UTC] ifeghali (Igor Feghali)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.