From 0a401c7ca475c0e65bbdd9212f1b6a439239c94e Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 17 Mar 2008 05:47:07 +0000 Subject: updated sql files, tweak to the update and installers to make it more utf-8ish hopefully final commit before release --- lib/class/update.class.php | 22 +++++++++++++++++++++- lib/init.php | 4 ++-- lib/install.php | 14 +++++++++----- 3 files changed, 32 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 7127f1d5..291c26e8 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -1143,9 +1143,29 @@ class Update { $sql = "ALTER TABLE `playlist` ADD `date` INT ( 11 ) UNSIGNED NOT NULL"; $db_results = Dba::query($sql); - $sql = "ALTER TABLE `rating` CHANGE `rating` TINYINT ( 4 ) NOT NULL"; + // Pull all of the rating information + $sql = "SELECT `id`,`rating` FROM `rating`"; $db_results = Dba::query($sql); + $results = array(); + + while ($row = Dba::fetch_assoc($db_results)) { + $results[] = $row; + } + + $sql = "ALTER TABLE `rating` DROP `rating`"; + $db_results = Dba::query($sql); + + $sql = "ALTER TABLE `rating` ADD `rating` TINYINT ( 4 ) NOT NULL"; + $db_results = Dba::query($sql); + + foreach ($results as $row) { + $rating = Dba::escape($row['rating']); + $id = Dba::escape($row['id']); + $sql = "UPDATE `rating` SET `rating`='$rating' WHERE `id`='$id'"; + $db_results = Dba::query($sql); + } + self::set_version('db_version','340015'); } // update_340015 diff --git a/lib/init.php b/lib/init.php index 5fe7448e..7b259dcb 100644 --- a/lib/init.php +++ b/lib/init.php @@ -1,7 +1,7 @@ = '500') { + $sql = "ALTER DATABASE `" . Dba::escape($database) . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + $db_results = mysql_query($sql); + } + return true; } // install_insert_db -- cgit