From 78ee1c72c670a71bfd165448676fc65bff802916 Mon Sep 17 00:00:00 2001 From: gramanas Date: Mon, 19 Nov 2018 19:11:06 +0200 Subject: Add ability to use ck without secret dir --- src/queries.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/queries.c') diff --git a/src/queries.c b/src/queries.c index 15e5acb..ddd9250 100644 --- a/src/queries.c +++ b/src/queries.c @@ -40,6 +40,14 @@ void dbh_form_query_make_tables(char *query) { strcat(tmp, COL_REL_CONFIG_ID); strcat(tmp, " INT NOT NULL);"); + strcat(tmp, "CREATE TABLE "); + strcat(tmp, TBL_CTX); + strcat(tmp, "("); + strcat(tmp, COL_CTX_KEY); + strcat(tmp, " TEXT NOT NULL, "); + strcat(tmp, COL_CTX_VAL); + strcat(tmp, " INT NOT NULL);"); + strcpy(query, tmp); } @@ -226,3 +234,27 @@ void dbh_form_query_get_pid_from_cid(char *query) { strcpy(query, tmp); } + +void dbh_form_query_secret_enabled(char *query) { + char tmp[STR_M] = "SELECT "; + strcat(tmp, COL_CTX_VAL); + strcat(tmp, " FROM "); + strcat(tmp, TBL_CTX); + strcat(tmp, " WHERE "); + strcat(tmp, COL_CTX_KEY); + strcat(tmp, " = \""); + strcat(tmp, KEY_CTX_SECRET); + strcat(tmp, "\";"); + + strcpy(query, tmp); +} + +void dbh_form_query_set_secret_enabled(char *query) { + char tmp[STR_L] = "INSERT INTO "; + strcat(tmp, TBL_CTX); + strcat(tmp, " VALUES(\""); + strcat(tmp, KEY_CTX_SECRET); + strcat(tmp, "\", ?);"); + + strcpy(query, tmp); +} -- cgit v1.2.3