aboutsummaryrefslogtreecommitdiffstats
path: root/src/queries.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-11-19 19:11:06 +0200
committergramanas <anastasis.gramm2@gmail.com>2018-11-19 19:11:06 +0200
commit78ee1c72c670a71bfd165448676fc65bff802916 (patch)
tree893b0f09dfc84f3fd7f1ac218213012f33d5b612 /src/queries.c
parent84bbbb91c9154ca0b1c295eb7d1aa0de59450764 (diff)
downloadck-78ee1c72c670a71bfd165448676fc65bff802916.tar.gz
ck-78ee1c72c670a71bfd165448676fc65bff802916.tar.bz2
ck-78ee1c72c670a71bfd165448676fc65bff802916.zip
Add ability to use ck without secret dir
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);
+}