26th March 2008
Must have been some maintenance, as I didn’t notice any changes in PHP/MySQL versions since the 7th of March.
Update: it seems as though since that short MySQL outage everything is faster at GoDaddy shared hosting. Did they upgrade database server(s)? I have no idea, but I like the change.
Posted in Misc | 1 Comment »
8th February 2008
Most frequent use: convert database from latin1_swedish to utf8_general_ci.
Original script found at: MySQL and UTF-8.
Update: the original script had an error, it would generate queries likes this one (note the bold part):
ALTER TABLE `links` CHANGE `link_rel` `link_rel` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT NULL;
This is clearly wrong syntax (and logic). I fixed this by making comparison to NULL strict (with three equal signs instead of two):
// Does the field default to null, a string, or nothing?
if ($row['Default'] === NULL)
Update 2: based on comment by banesto, I modified the script; now it does not require specifying the from_collation, it’s sufficient to specify to_collation (which will be used for all the fields and tables). The modified code is:
if ($row['Collation'] == ” || $row['Collation'] == $convert_to)
continue;
Here’s the script itself: (to copy-paste: first click the “Plain text” header)
Read the rest of this entry »
Posted in Links, Notepad, PHP, Programming, Web | 28 Comments »