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'") + ); + } +}