From 8cb87b2469ea727275c4df8456909b86ad33d530 Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 20 Jun 2024 22:35:16 +0100 Subject: [PATCH] [core] add a test suite for SQL features --- core/dbengine.php | 1 + core/tests/SQLTest.php | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 core/tests/SQLTest.php diff --git a/core/dbengine.php b/core/dbengine.php index c84355a8..3a7ca35f 100644 --- a/core/dbengine.php +++ b/core/dbengine.php @@ -44,6 +44,7 @@ class MySQL extends DBEngine public function init(PDO $db): void { $db->exec("SET NAMES utf8;"); + $db->exec("SET SESSION sql_mode='ANSI,TRADITIONAL';"); } public function scoreql_to_sql(string $data): string diff --git a/core/tests/SQLTest.php b/core/tests/SQLTest.php new file mode 100644 index 00000000..630435b5 --- /dev/null +++ b/core/tests/SQLTest.php @@ -0,0 +1,23 @@ +assertEquals( + "foobar", + $database->get_one("SELECT 'foo' || 'bar'") + ); + } +}