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

Request #12908 Supporting Database charset
Submitted: 2008-01-14 23:53 UTC
From: afz Assigned: ifeghali
Status: Closed Package: MDB2_Schema (version CVS)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2008-01-14 23:53 UTC] afz (Ali Fazelzade)
Description: ------------ hi, supporting new feature recently add to MDB2 package (Database charset). thanks

Comments

 [2008-01-14 23:55 UTC] afz (Ali Fazelzade)
Index: MDB2/Schema.php =================================================================== RCS file: /repository/pear/MDB2_Schema/MDB2/Schema.php,v retrieving revision 1.117 diff -u -r1.117 Schema.php --- MDB2/Schema.php 8 Dec 2007 20:30:15 -0000 1.117 +++ MDB2/Schema.php 15 Jan 2008 19:12:34 -0000 @@ -419,6 +419,7 @@ 'name' => $database, 'create' => true, 'overwrite' => false, + 'charset' => '', 'description' => '', 'comments' => '', 'tables' => array(), @@ -1263,11 +1264,21 @@ } $this->db->expectError(MDB2_ERROR_ALREADY_EXISTS); - $result = $this->db->manager->createDatabase($database_definition['name']); + $dbOptions = array(); + if (isset($database_definition['charset'])) { + $dbOptions['charset'] = $database_definition['charset']; + } + $result = $this->db->manager->createDatabase($database_definition['name'], $dbOptions); $this->db->popExpect(); if (PEAR::isError($result)) { if (MDB2::isError($result, MDB2_ERROR_ALREADY_EXISTS)) { $this->db->debug('Database already exists: ' . $database_definition['name'], __FUNCTION__); + if (!empty($dbOptions)) { + $result = $this->db->manager->alterDatabase($database_definition['name'], $dbOptions); + if (PEAR::isError($result)) { + return $result; + } + } $create = false; } else { return $result; Index: MDB2/Schema/Parser.php =================================================================== RCS file: /repository/pear/MDB2_Schema/MDB2/Schema/Parser.php,v retrieving revision 1.64 diff -u -r1.64 Parser.php --- MDB2/Schema/Parser.php 20 Aug 2007 03:19:20 -0000 1.64 +++ MDB2/Schema/Parser.php 14 Jan 2008 11:28:47 -0000 @@ -201,6 +201,7 @@ 'name' => '', 'create' => '', 'overwrite' => '', + 'charset' => '', 'description' => '', 'comments' => '', 'tables' => array(), @@ -626,6 +627,9 @@ case 'database-overwrite': $this->database_definition['overwrite'].= $data; break; + case 'database-charset': + $this->database_definition['charset'].= $data; + break; case 'database-description': $this->database_definition['description'].= $data; break; Index: MDB2/Schema/Parser2.php =================================================================== RCS file: /repository/pear/MDB2_Schema/MDB2/Schema/Parser2.php,v retrieving revision 1.8 diff -u -r1.8 Parser2.php --- MDB2/Schema/Parser2.php 20 Aug 2007 05:26:19 -0000 1.8 +++ MDB2/Schema/Parser2.php 14 Jan 2008 11:27:52 -0000 @@ -131,6 +131,7 @@ 'name' => '', 'create' => '', 'overwrite' => '', + 'charset' => '', 'description' => '', 'comments' => '', 'tables' => array(), @@ -146,6 +147,9 @@ if (!empty($database['overwrite'])) { $this->database_definition['overwrite'] = $database['overwrite']; } + if (!empty($database['charset'])) { + $this->database_definition['charset'] = $database['charset']; + } if (!empty($database['description'])) { $this->database_definition['description'] = $database['description']; } Index: MDB2/Schema/Writer.php =================================================================== RCS file: /repository/pear/MDB2_Schema/MDB2/Schema/Writer.php,v retrieving revision 1.37 diff -u -r1.37 Writer.php --- MDB2/Schema/Writer.php 19 Aug 2007 05:03:43 -0000 1.37 +++ MDB2/Schema/Writer.php 14 Jan 2008 11:30:59 -0000 @@ -269,6 +269,7 @@ $buffer.= "<database>$eol$eol <name>".$database_definition['name']."</name>"; $buffer.= "$eol <create>".$this->_dumpBoolean($database_definition['create'])."</create>"; $buffer.= "$eol <overwrite>".$this->_dumpBoolean($database_definition['overwrite'])."</overwrite>$eol"; + $buffer.= "$eol <charset>".$database_definition['charset']."</charset>$eol"; if ($output) { call_user_func($output, $buffer); Index: docs/xml_schema_documentation.html =================================================================== RCS file: /repository/pear/MDB2_Schema/docs/xml_schema_documentation.html,v retrieving revision 1.15 diff -u -r1.15 xml_schema_documentation.html --- docs/xml_schema_documentation.html 9 Aug 2007 23:50:05 -0000 1.15 +++ docs/xml_schema_documentation.html 15 Jan 2008 23:55:59 -0000 @@ -80,6 +80,10 @@ <p>Boolean flag that indicates whether the database manager class should overwrite previously created structures.</p> <p><b>Default:</b> <tt>false</tt></p> +<p><li><tt>charset</tt></li></p> +<p>Charset/Encoding of database.</p> +<p><b>Default:</b> <tt>none</tt></p> + <p><li><tt>description</tt></li></p> <p>Free text property meant for describing the purpose of the database. This field is not processed by the schema parser. It may contain text or other XML well formed tags that may be useful for embedding additional data structures for documentation applications or other purposes.</p> <p><b>Default:</b> none</p> @@ -632,6 +636,7 @@ <tt><name/></tt><br/> <tt><create/>?</tt><br/> <tt><overwrite/>?</tt><br/> + <tt><charset/>?</tt><br/> <tt><description/>?</tt><br/> <tt><comments/>?</tt><br/> <br/>
 [2008-01-15 13:16 UTC] ifeghali (Igor Feghali)
Hello Ali! Thank you for the patch. Currently I have limited access to computers (actually computers with some graphical browser). I am going to commit this as soon as my machine get back from warranty services. regards, iGor.
 [2008-01-28 15:50 UTC] ifeghali (Igor Feghali)
Hello Ali, Could you please attach the patch using the "Add a Patch" link ? Thank you, iGor.
 [2008-01-28 19:30 UTC] ifeghali (Igor Feghali)
Weird the lines are still truncated on the patch file. Did you generated this patch file or this is just a copy and paste of the previous one ?
 [2008-01-29 04:51 UTC] afz (Ali Fazelzadeh)
hi Igor, both patch for #12908 and #12950 is include. Regards, Ali
 [2008-01-29 10:20 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.