myuan hace 2 años
padre
commit
0eb11c9d94
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      src/checker.cpp

+ 3 - 3
src/checker.cpp

@@ -20,10 +20,10 @@ void process_sql(json& j) {
     if (type == "create_stmt") {
         auto table_name = j["table_name"];
         if (tables.exists(table_name)) {
-            throw std::runtime_error(
-                fmt::format("table: `{}` exists\n", table_name));
+            fmt::print("error: table `{}` exists\n", table_name);
+        } else {
+            create_table(j["table_name"], j["cols"]);
         }
-        create_table(j["table_name"], j["cols"]);
     } else {
         throw std::runtime_error(
             fmt::format("Unknown expression type `{}` total: \n{}", type, j.dump(2)));