aboutsummaryrefslogtreecommitdiffstats
path: root/src/queries.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/queries.c')
-rw-r--r--src/queries.c32
1 files changed, 32 insertions, 0 deletions
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);
+}