X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=keydb%2Fkeydb_pg.c;h=c8392f721b9460800b73867c1189f63d4933313e;hb=2d53b0b62dd6c230f25c5d66104e6b367390485a;hp=52d27fc538220b1c3c4661d5e952430b2e690067;hpb=a2979c20e1ab2d52e3a961ac7dad45fee9d6345a;p=onak.git diff --git a/keydb/keydb_pg.c b/keydb/keydb_pg.c index 52d27fc..c8392f7 100644 --- a/keydb/keydb_pg.c +++ b/keydb/keydb_pg.c @@ -28,6 +28,7 @@ #include #include +#include "build-config.h" #include "hash.h" #include "keydb.h" #include "keyid.h" @@ -290,19 +291,19 @@ static int pg_delete_key(struct onak_dbctx *dbctx, PQclear(result); snprintf(statement, 1023, - "DELETE FROM onak_keys WHERE keyid = '%" PRIX64 "'", + "DELETE FROM onak_sigs WHERE signee = '%" PRIX64 "'", keyid); result = PQexec(dbconn, statement); PQclear(result); snprintf(statement, 1023, - "DELETE FROM onak_sigs WHERE signee = '%" PRIX64 "'", + "DELETE FROM onak_uids WHERE keyid = '%" PRIX64 "'", keyid); result = PQexec(dbconn, statement); PQclear(result); snprintf(statement, 1023, - "DELETE FROM onak_uids WHERE keyid = '%" PRIX64 "'", + "DELETE FROM onak_keys WHERE keyid = '%" PRIX64 "'", keyid); result = PQexec(dbconn, statement); } else if (PQresultStatus(result) != PGRES_TUPLES_OK) { @@ -671,7 +672,8 @@ static void pg_cleanupdb(struct onak_dbctx *dbctx) * this file are called in order to allow the DB to be initialized ready * for access. */ -struct onak_dbctx *keydb_pg_init(struct onak_db_config *dbcfg, bool readonly) +struct onak_dbctx *keydb_pg_init(struct onak_db_config *dbcfg, + __unused bool readonly) { struct onak_dbctx *dbctx; PGconn *dbconn;