![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Pear Pear programming, this is a very complex subject as with using pear with php can be a difficult task for some, so lets talk pear. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| ifeghali Wed May 9 17:33:51 2007 UTC Modified files: /pear/MDB2_Schema/MDB2 Schema.php Log: - alterDatabaseTables() should add tables first so we can grab data that will be lost on a remove - added an option to control whether updateDatabase() should overwrite the old schema file http://cvs.php.net/viewvc.cgi/pear/M...&diff_format=u Index: pear/MDB2_Schema/MDB2/Schema.php diff -u pear/MDB2_Schema/MDB2/Schema.php:1.109 pear/MDB2_Schema/MDB2/Schema.php:1.110 --- pear/MDB2_Schema/MDB2/Schema.php:1.109 Wed May 9 03:40:17 2007 +++ pear/MDB2_Schema/MDB2/Schema.php Wed May 9 17:33:51 2007 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: Schema.php,v 1.109 2007/05/09 03:40:17 ifeghali Exp $ +// $Id: Schema.php,v 1.110 2007/05/09 17:33:51 ifeghali Exp $ // require_once 'MDB2.php'; @@ -1694,14 +1694,15 @@ */ function alterDatabaseTables($current_definition, $previous_definition, $changes) { + /* FIXME: tables marked to be added are initialized by createTable(), others don't */ $alterations = 0; if (empty($changes)) { return $alterations; } - if (!empty($changes['remove']) && is_array($changes['remove'])) { - foreach ($changes['remove'] as $table_name => $table) { - $result = $this->db->manager->dropTable($table_name); + if (!empty($changes['add']) && is_array($changes['add'])) { + foreach ($changes['add'] as $table_name => $table) { + $result = $this->createTable($table_name, $current_definition[$table_name]); if (PEAR::isError($result)) { return $result; } @@ -1709,9 +1710,9 @@ } } - if (!empty($changes['add']) && is_array($changes['add'])) { - foreach ($changes['add'] as $table_name => $table) { - $result = $this->createTable($table_name, $current_definition[$table_name]); + if (!empty($changes['remove']) && is_array($changes['remove'])) { + foreach ($changes['remove'] as $table_name => $table) { + $result = $this->db->manager->dropTable($table_name); if (PEAR::isError($result)) { return $result; } @@ -2225,7 +2226,7 @@ * @access public */ function updateDatabase($current_schema, $previous_schema = false - , $variables = array(), $disable_query = false) + , $variables = array(), $disable_query = false, $overwrite_old_schema_file = false) { $current_definition = $this->parseDatabaseDefinition( $current_schema, false, $variables, $this->options['fail_on_invalid_names'] @@ -2289,7 +2290,8 @@ } } - if (!$disable_query + if ($overwrite_old_schema_file + && !$disable_query && is_string($previous_schema) && is_string($current_schema) && !copy($current_schema, $previous_schema) ) { | |||
| Featured Websites | ||||
|
![]() |
| Tags: cvs, mdb2_schemamdb2, pear, schemaphp |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cvs: pear /MDB2_Schema/MDB2 Schema.php /MDB2_Schema/MDB2/Schema Parser.php /MDB2_Schema/docs xml_schema_documentation.html | Igor Feghali | Pear | 0 | 05-20-2007 7:41 PM |
| cvs: pear /MDB2/MDB2/Driver mysql.php mysqli.php pgsql.php | David Coallier | Pear | 0 | 05-20-2007 7:41 PM |
| MDB2_Schema and maintaining database across versions | Lars Olesen | Pear | 0 | 05-20-2007 6:34 PM |
| [PEAR] Possible serious memory leak in MDB2 | Lorenzo Alberton | Pear | 1 | 05-20-2007 6:34 PM |
| Generic MySQL/PHP Tree Schema? | ashore | PHP | 4 | 05-20-2007 6:34 PM |
| Featured Websites | ||||
|