Add hdb_set_sync() method

This commit is contained in:
Nicolas Williams
2017-10-10 13:06:21 -05:00
parent e3cc7dfb94
commit 5bcbe2125b
7 changed files with 140 additions and 54 deletions

View File

@@ -807,6 +807,15 @@ hdb_sqlite_destroy(krb5_context context, HDB *db)
return ret ? ret : ret2;
}
static krb5_error_code
hdb_sqlite_set_sync(krb5_context context, HDB *db, int on)
{
return hdb_sqlite_exec_stmt(context, (hdb_sqlite_db*)(db->hdb_db),
on ? "PRAGMA main.synchronous = NORMAL" :
"PRAGMA main.synchronous = OFF",
HDB_ERR_UK_SERROR);
}
/*
* Not sure if this is needed.
*/
@@ -1035,6 +1044,7 @@ hdb_sqlite_create(krb5_context context, HDB **db, const char *filename)
(*db)->hdb_remove = hdb_sqlite_remove;
(*db)->hdb_destroy = hdb_sqlite_destroy;
(*db)->hdb_rename = hdb_sqlite_rename;
(*db)->hdb_set_sync = hdb_sqlite_set_sync;
(*db)->hdb__get = NULL;
(*db)->hdb__put = NULL;
(*db)->hdb__del = NULL;