@@ -371,6 +371,64 @@ public function testRepairTable() {
371371 );
372372 }
373373
374+ public function testShowDatabases (): void {
375+ // Simple.
376+ $ this ->assertQuery ( 'SHOW DATABASES ' );
377+ $ actual = $ this ->engine ->get_query_results ();
378+ $ this ->assertEquals (
379+ array (
380+ (object ) array ( 'Database ' => 'information_schema ' ),
381+ (object ) array ( 'Database ' => 'wp ' ),
382+ ),
383+ $ actual
384+ );
385+
386+ // With LIKE clause.
387+ $ this ->assertQuery ( 'SHOW DATABASES LIKE "w%" ' );
388+ $ actual = $ this ->engine ->get_query_results ();
389+ $ this ->assertEquals (
390+ array ( (object ) array ( 'Database ' => 'wp ' ) ),
391+ $ actual
392+ );
393+
394+ // With WHERE clause.
395+ $ this ->assertQuery ( 'SHOW DATABASES WHERE `Database` = "wp" ' );
396+ $ actual = $ this ->engine ->get_query_results ();
397+ $ this ->assertEquals (
398+ array ( (object ) array ( 'Database ' => 'wp ' ) ),
399+ $ actual
400+ );
401+ }
402+
403+ public function testShowTableSchemas (): void {
404+ $ this ->assertQuery ( 'SHOW SCHEMAS ' );
405+
406+ $ actual = $ this ->engine ->get_query_results ();
407+ $ this ->assertEquals (
408+ array (
409+ (object ) array ( 'Database ' => 'information_schema ' ),
410+ (object ) array ( 'Database ' => 'wp ' ),
411+ ),
412+ $ actual
413+ );
414+
415+ // With LIKE clause.
416+ $ this ->assertQuery ( 'SHOW DATABASES LIKE "inf%" ' );
417+ $ actual = $ this ->engine ->get_query_results ();
418+ $ this ->assertEquals (
419+ array ( (object ) array ( 'Database ' => 'information_schema ' ) ),
420+ $ actual
421+ );
422+
423+ // With WHERE clause.
424+ $ this ->assertQuery ( 'SHOW DATABASES WHERE `Database` = "information_schema" ' );
425+ $ actual = $ this ->engine ->get_query_results ();
426+ $ this ->assertEquals (
427+ array ( (object ) array ( 'Database ' => 'information_schema ' ) ),
428+ $ actual
429+ );
430+ }
431+
374432 public function testShowTableStatus () {
375433 $ this ->assertQuery ( 'CREATE TABLE t ( comment_author TEXT, comment_content TEXT ) ' );
376434
0 commit comments