botched raw() calls no longer DOS

This commit is contained in:
anon 2023-08-03 15:49:45 +02:00
parent d158b9c863
commit add94130bd

View File

@ -21,13 +21,6 @@
} \
} while (0)
#define DBUSERERR(line) do { \
const int e = line; \
if(e != SQLITE_OK && e != SQLITE_ROW && e != SQLITE_DONE) { \
r = sqlite3_errmsg(connection); \
} \
} while(0)
static sqlite3 * connection = NULL;
DECL int
@ -93,7 +86,7 @@ set_repo(const char * const who, const char * const link)
}
DECL int
rtos(void* data,
rtos(void * data,
int argc,
char** argv,
char** colname
@ -128,8 +121,8 @@ DECL char *
raw(const char * const sql)
{
char* errmsg;
char* r = (char*)calloc(sizeof(char), 10000); // TODO: allow for reallocing in rtos, start with a smaller value
DBUSERERR(sqlite3_exec(connection, sql, rtos, &r, &errmsg));
char *r = (char*)calloc(sizeof(char), 10000); // TODO: allow for reallocing in rtos, start with a smaller value
sqlite3_exec(connection, sql, rtos, &r, &errmsg);
if (errmsg){
free(r);
r = errmsg;