myuan 2 vuotta sitten
vanhempi
commit
591c80b4ce
2 muutettua tiedostoa jossa 12 lisäystä ja 2 poistoa
  1. 8 0
      src/checker.cpp
  2. 4 2
      tests_config.py

+ 8 - 0
src/checker.cpp

@@ -75,6 +75,14 @@ void process_sql(json& j) {
         // 创建表
         create_table(j);
     } else {
+        if (type == "drop_stmt") {
+            if (tables.exists(j["table_name"])) {
+                tables.remove(j["table_name"]);
+                tables.save();
+            }
+            return;
+        }
+
         // 其余都会要求表存在
         auto table_name = table_name_of(j);
         if (!tables.exists(table_name)) {

+ 4 - 2
tests_config.py

@@ -489,6 +489,8 @@ sql_parser_tests = [
 ]
 
 sql_checker_tests = [
-    ('select c1 from t1 ;', True),
-    ('select * from t1;', True),
+    ('drop table person;', True),
+    ('create table person(name string, age int);', True),
+    ('select age from person;', True),
+    ('select * from person;', True),
 ]