1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Adjustments for MySQL 8

The prototype had been tested against MariaDB
This commit is contained in:
J. King 2018-12-20 20:50:56 -05:00
parent 4ef36643a4
commit 393b4e95ad
4 changed files with 20 additions and 18 deletions

View file

@ -13,7 +13,7 @@ use JKingWeb\Arsse\Db\ExceptionInput;
use JKingWeb\Arsse\Db\ExceptionTimeout; use JKingWeb\Arsse\Db\ExceptionTimeout;
class Driver extends \JKingWeb\Arsse\Db\AbstractDriver { 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; const TRANSACTIONAL_LOCKS = false;
protected $db; protected $db;
@ -72,7 +72,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
public function sqlToken(string $token): string { public function sqlToken(string $token): string {
switch (strtolower($token)) { switch (strtolower($token)) {
case "nocase": case "nocase":
return '"utf8mb4_unicode_nopad_ci"'; return '"utf8mb4_unicode_ci"';
default: default:
return $token; return $token;
} }
@ -120,7 +120,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
try { try {
$this->exec("SET lock_wait_timeout = 1; LOCK TABLES $tables"); $this->exec("SET lock_wait_timeout = 1; LOCK TABLES $tables");
} finally { } finally {
$this->exec("SET lock_wait_timeout = 0"); $this->exec("SET lock_wait_timeout = 60");
} }
} }
return true; return true;

View file

@ -44,6 +44,8 @@ trait PDOError {
return [ExceptionTimeout::class, 'general', $err[2]]; return [ExceptionTimeout::class, 'general', $err[2]];
case 1364: case 1364:
return [ExceptionInput::class, "constraintViolation", $err[2]]; return [ExceptionInput::class, "constraintViolation", $err[2]];
case 1366:
return [ExceptionInput::class, 'engineTypeViolation', $err[2]];
} }
break; break;
} }

View file

@ -28,6 +28,6 @@ create table arsse_label_members (
primary key(label,article) primary key(label,article)
) character set utf8mb4; ) 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'; update arsse_meta set value = '2' where `key` = 'schema_version';

View file

@ -4,20 +4,20 @@
-- Please consult the SQLite 3 schemata for commented version -- 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_users default character set utf8mb4 collate utf8mb4_unicode_ci;
alter table arsse_folders default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; alter table arsse_folders default character set utf8mb4 collate utf8mb4_unicode_ci;
alter table arsse_feeds default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; alter table arsse_feeds default character set utf8mb4 collate utf8mb4_unicode_ci;
alter table arsse_subscriptions default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; alter table arsse_subscriptions default character set utf8mb4 collate utf8mb4_unicode_ci;
alter table arsse_articles default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; alter table arsse_articles default character set utf8mb4 collate utf8mb4_unicode_ci;
alter table arsse_categories default character set utf8mb4 collate utf8mb4_unicode_nopad_ci; alter table arsse_categories default character set utf8mb4 collate utf8mb4_unicode_ci;
alter table arsse_labels default character set utf8mb4 collate utf8mb4_unicode_nopad_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_users convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table arsse_folders convert to character set utf8mb4 collate utf8mb4_unicode_nopad_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_nopad_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_nopad_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_nopad_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_nopad_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_nopad_ci; alter table arsse_labels convert to character set utf8mb4 collate utf8mb4_unicode_ci;
update arsse_meta set value = '3' where `key` = 'schema_version'; update arsse_meta set value = '3' where `key` = 'schema_version';