]> Nishi Git Mirror - dataworks.git/commitdiff
adding
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 29 May 2024 06:10:59 +0000 (06:10 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 29 May 2024 06:10:59 +0000 (06:10 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@136 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Library/exec.c

index d38fc7f787dfb3c88307513f5ce03dcdc5864bd9..508b517ceb104fbe243345ad23524c339b45ea62 100644 (file)
@@ -221,13 +221,14 @@ struct dataworks_db_result* __dataworks_database_execute_code(struct dataworks_d
                                        r->error = true;
                                        r->errnum = DW_ERR_EXEC_INSUFFICIENT_ARGUMENTS;
                                } else {
-                                       double dn = 123123;
-                                       int64_t in = 123123;
-                                       void* data[3];
-                                       data[0] = "dataworks";
-                                       data[1] = &dn;
-                                       data[2] = &in;
-                                       struct dataworks_db_result* dbr = dataworks_database_insert_record(db, data, "SSS");
+                                       char* f = dataworks_database_get_table_field_types(db, db->name);
+                                       void** data = malloc(sizeof(*data) * strlen(f));
+                                       char* fields = malloc(sizeof(*data) * (strlen(f) + 1));
+                                       for(j = 0; f[j] != 0; j++) fields[j] = 'U';
+                                       fields[strlen(f)] = 0;
+                                       for(j = 0; f[j] != 0; j++) data[j] = "";
+                                       free(f);
+                                       struct dataworks_db_result* dbr = dataworks_database_insert_record(db, data, fields);
                                        if(dbr->error) {
                                                r->error = true;
                                                r->errnum = dbr->errnum;