Originally Posted by
lat9
I don't know what issue mc12345678 is referring to with regard to that plugin not working when a DB_PREFIX value is set.
After viewing the initial results and then when I have tried the conversion using the downloaded version I had on more than one occasion received an error that the database couldn't be converted. As my memory served (right or wrong) the issue was somehow related to the DB_PREFIX and/or database name.
Accessing convert_db2utf8 to simply see the various collations in the database did not report any issues with the sql statements, but attempting the update did report an error that was resolved by the below use of backticks at least in the first of the two code changes (lines 120 and 135). The second change was made simply for consistency after some deliberation and was not essential for operation.
Changed (line 120):
Code:
db_query ("ALTER DATABASE " . $dbDatabase . " CHARACTER SET utf8 COLLATE $desiredCollation");
to:
Code:
db_query ("ALTER DATABASE `" . $dbDatabase . "` CHARACTER SET utf8 COLLATE $desiredCollation");
and (line 135):
Code:
$query_tables = db_query("SHOW TABLE STATUS FROM " . $dbDatabase);
to:
Code:
$query_tables = db_query("SHOW TABLE STATUS FROM `" . $dbDatabase . "`");
In the situations where it hasn't work as provided, review of the database name and the included DB_PREFIX did not identify the need for quotes (backticks) and appeared to be sufficient to support unquoted identifier use as discussed in the mysql "manual".
As part of the review of the conversion software, these two lines were the only two that did not use backticks around the database identifiers, that the first modification was the only one of the two that executed solely when doing the update (point at which problem occurred), and that the code within the first change was new code for version 4. So, considering those factors, the first attempt to fix the issue was to modify both lines to the above. The modifications worked and the modified file has become the version of this plugin that I consistently and successfully use.
The whole thing seemed odd though because if there was an issue using the identifiers unquoted, it seemed like a similar issue would be expected in other ZC operations. Upon further looking, though, it appears that a database name (that otherwise would need to be quoted) is handled without additional quoting through selection of appropriate php command(s).
Bookmarks