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

Request #9452 Table charset, collation, engine options
Submitted: 2006-11-25 07:47 UTC
From: pearbugs2006 at reddreamer dot com Assigned:
Status: Open Package: MDB2_Schema (version 0.7.0)
PHP Version: 5.1.2 OS: Ubuntu 6.0
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 : 49 + 41 = ?

 
 [2006-11-25 07:47 UTC] pearbugs2006 at reddreamer dot com (Tim Denby)
Description: ------------ I'm using MDB2_Schema with MySQL but as I'm creating an internationalized app I need to make sure I've got utf8 tables. Right now MDB2_Schema just uses the defaults. I simply rewrote Schema.php to always set utf8 when it creates a table, but it seems like this is an important feature to add. In my case I wouldn't need to set each table individually, I'm using the same settings through the entire database.

Comments

 [2006-11-25 10:56 UTC] pearbugs2006 at reddreamer dot com
So it turns out to be a bit more complicated... my changes to Schema.php allowed me to create tables in UTF-8, but because in Parser.php the encoding is fixed to ISO-8859-1, when I added initialization values it was shredding my Chinese characters before they ever made it to the database. So I had to make my own version of that too. I'm in PHP5 and I removed the charset parameter from the parent::XML_Parser() call in the constructor. Strangely, although that got it working with Chinese characters, Spanish values are being messed up. When there's an ene (ñ, U+00F1) in the contents of an XML tag, all of the characters to the left of the *first* ene in the field are being trimmed. And of course, I'm having to set the charset to "utf8" in the MySQL dsn.
 [2006-11-25 12:21 UTC] pearbugs2006 at reddreamer dot com
Okay, to revise that again, it *is* actually modifying the Chinese strings too... what's happening is that in every value that has any unicode characters with codes above the Latin ones, it's trimming off everything to the left of the first unicode character.
 [2006-12-15 14:39 UTC] ifeghali (Igor Feghali)
Hello Tim, Please submit the patch you made for Schema.php.
 [2006-12-15 15:28 UTC] pearbugs2006 at reddreamer dot com
The patch I made forces all tables to be UTF-8... I don't think you want that, do you?
 [2007-06-10 21:30 UTC] dufuz (Helgi Þormar)
Well there is no loss in seeing the patch none the less
 [2007-06-10 23:31 UTC] pearbugs2006 at reddreamer dot com
I'm sorry, because of the amount of time it was going to take to fix the problems I experienced in PHP I switched to another language for my product. I don't have a running copy of the code anymore and I haven't been able to track down where I'd made the change. But to my recollection, I found the point in the code where it actually created the tables and added a single line that passed the parameter to MySQL specifying that the table should be UTF-8. This change affected all of the tables except the seq tables. I don't remember whether it was in the Schema files or up in the MDB2 files... it might have actually been in the MySQL driver for MDB2. In any case, I'm sure that it broke a whole bunch of stuff that I wasn't using.
 [2007-06-10 23:44 UTC] pearbugs2006 at reddreamer dot com
Okay, I think I tracked down the code with one last try but add-patch.php in the bugs application here didn't like the name of the folder my file was in and wouldn't let me upload it... the change was in the function "createTable", in this code block at line 657 in v 1.103 2006/10/21 15:00:24 : if ($create) { $opts = array( 'charset' => 'utf8', 'collate' => 'utf8_unicode_ci', 'type' => 'MyISAM', ); $result = $this->db->manager->createTable($table_name, $table['fields'],$opts); if (PEAR::isError($result)) { return $result; } }