From 393b4e95adad711ca1ff0b30090a27de18062b68 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 20 Dec 2018 20:50:56 -0500 Subject: [PATCH] Adjustments for MySQL 8 The prototype had been tested against MariaDB --- lib/Db/MySQL/Driver.php | 6 +++--- lib/Db/PDOError.php | 2 ++ sql/MySQL/1.sql | 2 +- sql/MySQL/2.sql | 28 ++++++++++++++-------------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lib/Db/MySQL/Driver.php b/lib/Db/MySQL/Driver.php index 80feff70..69c16505 100644 --- a/lib/Db/MySQL/Driver.php +++ b/lib/Db/MySQL/Driver.php @@ -13,7 +13,7 @@ use JKingWeb\Arsse\Db\ExceptionInput; use JKingWeb\Arsse\Db\ExceptionTimeout; class Driver extends \JKingWeb\Arsse\Db\AbstractDriver { - const SQL_MODE = "ANSI_QUOTES,HIGH_NOT_PRECEDENCE,NO_BACKSLASH_ESCAPES,NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY,PIPES_AS_CONCAT,STRICT_ALL_TABLES"; + const SQL_MODE = "ANSI_QUOTES,HIGH_NOT_PRECEDENCE,NO_BACKSLASH_ESCAPES,NO_ENGINE_SUBSTITUTION,PIPES_AS_CONCAT,STRICT_ALL_TABLES"; const TRANSACTIONAL_LOCKS = false; protected $db; @@ -72,7 +72,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver { public function sqlToken(string $token): string { switch (strtolower($token)) { case "nocase": - return '"utf8mb4_unicode_nopad_ci"'; + return '"utf8mb4_unicode_ci"'; default: return $token; } @@ -120,7 +120,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver { try { $this->exec("SET lock_wait_timeout = 1; LOCK TABLES $tables"); } finally { - $this->exec("SET lock_wait_timeout = 0"); + $this->exec("SET lock_wait_timeout = 60"); } } return true; diff --git a/lib/Db/PDOError.php b/lib/Db/PDOError.php index 6cb615c9..dc3baab4 100644 --- a/lib/Db/PDOError.php +++ b/lib/Db/PDOError.php @@ -44,6 +44,8 @@ trait PDOError { return [ExceptionTimeout::class, 'general', $err[2]]; case 1364: return [ExceptionInput::class, "constraintViolation", $err[2]]; + case 1366: + return [ExceptionInput::class, 'engineTypeViolation', $err[2]]; } break; } diff --git a/sql/MySQL/1.sql b/sql/MySQL/1.sql index 14e780ba..eb4ce5f1 100644 --- a/sql/MySQL/1.sql +++ b/sql/MySQL/1.sql @@ -28,6 +28,6 @@ create table arsse_label_members ( primary key(label,article) ) character set utf8mb4; -alter table arsse_marks add column note longtext not null default ''; +alter table arsse_marks add column note longtext; update arsse_meta set value = '2' where `key` = 'schema_version'; diff --git a/sql/MySQL/2.sql b/sql/MySQL/2.sql index d5a1a93c..d63cbb6a 100644 --- a/sql/MySQL/2.sql +++ b/sql/MySQL/2.sql @@ -4,20 +4,20 @@ -- Please consult the SQLite 3 schemata for commented version -alter table arsse_users default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_folders default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_feeds default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_subscriptions default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_articles default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_categories default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_labels default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; +alter table arsse_users default character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_folders default character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_feeds default character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_subscriptions default character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_articles default character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_categories default character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_labels default character set utf8mb4 collate utf8mb4_unicode_ci; -alter table arsse_users convert to character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_folders convert to character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_feeds convert to character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_subscriptions convert to character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_articles convert to character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_categories convert to character set utf8mb4 collate utf8mb4_unicode_nopad_ci; -alter table arsse_labels convert to character set utf8mb4 collate utf8mb4_unicode_nopad_ci; +alter table arsse_users convert to character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_folders convert to character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_feeds convert to character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_subscriptions convert to character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_articles convert to character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_categories convert to character set utf8mb4 collate utf8mb4_unicode_ci; +alter table arsse_labels convert to character set utf8mb4 collate utf8mb4_unicode_ci; update arsse_meta set value = '3' where `key` = 'schema_version';