From 1b4722c22a72d7c26df84c8a104d9d7a35a3da9a Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Thu, 15 Aug 2013 10:18:17 -0400 Subject: [PATCH] Improved latin1 --> utf8 database conversion. - Added support for char fields - Started leveraging framework for escaping --- module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php b/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php index 0ca24c584df..dcf7fc4a583 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php @@ -219,6 +219,9 @@ class DbUpgrade extends AbstractPlugin $oldType = $details['Type']; $parts = explode('(', $oldType); switch ($parts[0]) { + case 'char': + $newType = 'binary(' . $parts[1]; + break; case 'text': $newType = 'blob'; break; @@ -230,8 +233,9 @@ class DbUpgrade extends AbstractPlugin } // Set up default: if (null !== $details['Default']) { - $safeDefault = mysql_real_escape_string($details['Default']); - $currentDefault = " DEFAULT '{$safeDefault}'"; + $safeDefault = $this->getAdapter()->getPlatform() + ->quoteValue($details['Default']); + $currentDefault = " DEFAULT {$safeDefault}"; } else { $currentDefault = ''; } -- GitLab