]> Nishi Git Mirror - dataworks.git/commitdiff
revive delete_table
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Thu, 27 Jun 2024 02:15:06 +0000 (02:15 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Thu, 27 Jun 2024 02:15:06 +0000 (02:15 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@442 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Library/exec.c

index 5a8ef5fb71069c5cf6aef5debc68c57f11d58a42..d07b919cd314c92372f77cea38a2aa8ff4ab2276 100644 (file)
@@ -152,6 +152,19 @@ struct Node* parser_process(struct dataworks_db* db, struct Node* node, bool dol
                                        }
                                        used = true;
                                } else if(__dw_strcaseequ(node->ident, "insert")) {
+                               } else if(__dw_strcaseequ(node->ident, "delete_table")) {
+                                       if(name == NULL) {
+                                               name = __dw_strdup(r->string);
+                                       } else {
+                                               newnode->errnum = DW_ERR_EXEC_TOO_MANY_ARGUMENTS;
+                                               __dw_free_node(r);
+                                               int j;
+                                               for(j = 0; fields[j] != NULL; j++) free(fields[j]);
+                                               free(fields);
+                                               free(fieldtypes);
+                                               if(name != NULL) free(name);
+                                               return newnode;
+                                       }
                                } else {
                                        int j;
                                        for(i = 0; fields[i] != NULL; i++) free(fields[i]);
@@ -171,6 +184,12 @@ struct Node* parser_process(struct dataworks_db* db, struct Node* node, bool dol
                        } else {
                                newnode->errnum = DW_ERR_EXEC_INSUFFICIENT_ARGUMENTS;
                        }
+               } else if(__dw_strcaseequ(node->ident, "delete_table")) {
+                       if(name != NULL) {
+                               newnode->errnum = dataworks_database_delete_table(db, name);
+                       } else {
+                               newnode->errnum = DW_ERR_EXEC_INSUFFICIENT_ARGUMENTS;
+                       }
                } else if(__dw_strcaseequ(node->ident, "print")) {
                        printf("\n");
                } else if(__dw_strcaseequ(node->ident, "use")) {