diff --git a/main.c b/main.c index 5b9e1cb..912c664 100644 --- a/main.c +++ b/main.c @@ -4,37 +4,26 @@ #include #include -typedef enum { - MAP, - PLAYER, - OVERVIEW, - NONE -} Querytype; - -inline char *get_filename(const char c, Querytype *q) { +inline char *get_filename(const char c) { char *qout; switch(c) { default: qout = "queries/mranks.sql"; - *q = OVERVIEW; break; case 'm': qout = "queries/mleaderboard-ojoin.sql"; - *q = MAP; break; case 'p': qout = "queries/rplayers.sql"; - *q = PLAYER; break; case 't': qout = "queries/test.txt"; - *q = NONE; break; } return qout; } -bool executequery(const char *sql, const char *p, int tbl) { +bool executequery(const char *sql, const char *p) { sqlite3 *db; char *error; int con = sqlite3_open("db/cts.db", &db); @@ -69,8 +58,7 @@ bool executequery(const char *sql, const char *p, int tbl) { // containing the data from query files. void getquery(const char *qs) { char *qf, *qp; - Querytype qt; - char *fname = get_filename(qs[0], &qt); + char *fname = get_filename(qs[0]); if (fname != NULL) { FILE *f = fopen(fname, "r"); if (f != NULL && qf != NULL) { @@ -86,7 +74,7 @@ void getquery(const char *qs) { } qp = strchr(qs, '=') + 1; // increment to exclude '=' printf("%x: \n\n%s\n", qf, qf); - executequery(qf, qp, qt); + executequery(qf, qp); free(qf); }