File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -294,6 +294,23 @@ public function testDataTypes(): void {
294
294
);
295
295
}
296
296
297
+ public function testSystemVariables (): void {
298
+ $ this ->assertQuery (
299
+ 'SELECT NULL ' ,
300
+ 'SELECT @@sql_mode '
301
+ );
302
+
303
+ $ this ->assertQuery (
304
+ 'SELECT NULL ' ,
305
+ 'SELECT @@SESSION.sql_mode '
306
+ );
307
+
308
+ $ this ->assertQuery (
309
+ 'SELECT NULL ' ,
310
+ 'SELECT @@GLOBAL.sql_mode '
311
+ );
312
+ }
313
+
297
314
private function assertQuery ( $ expected , string $ query ): void {
298
315
$ driver = new WP_SQLite_Driver ( new PDO ( 'sqlite::memory: ' ) );
299
316
$ driver ->query ( $ query );
Original file line number Diff line number Diff line change @@ -862,6 +862,13 @@ private function translate( $ast ) {
862
862
throw $ this ->not_supported_exception (
863
863
sprintf ( 'data type: %s ' , $ child ->value )
864
864
);
865
+ case 'systemVariable ' :
866
+ // @TODO: Emulate some system variables, or use reasonable defaults.
867
+ // See: https://dev.mysql.com/doc/refman/8.4/en/server-system-variable-reference.html
868
+ // See: https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html
869
+
870
+ // When we have no value, it's reasonable to use NULL.
871
+ return 'NULL ' ;
865
872
default :
866
873
return $ this ->translate_sequence ( $ ast ->get_children () );
867
874
}
You can’t perform that action at this time.
0 commit comments