Lines Matching full:db
41 sqlite3 *db; member
127 sqlite3 *db, in hdb_sqlite_prepare_stmt() argument
133 ret = sqlite3_prepare_v2(db, str, -1, statement, NULL); in hdb_sqlite_prepare_stmt()
140 ret = sqlite3_prepare_v2(db, str, -1, statement, NULL); in hdb_sqlite_prepare_stmt()
146 str, sqlite3_errmsg(db)); in hdb_sqlite_prepare_stmt()
196 * @param db Heimdal database handle
201 hdb_sqlite_open_database(krb5_context context, HDB *db, int flags) in hdb_sqlite_open_database() argument
204 hdb_sqlite_db *hsdb = (hdb_sqlite_db*) db->hdb_db; in hdb_sqlite_open_database()
206 ret = sqlite3_open_v2(hsdb->db_file, &hsdb->db, in hdb_sqlite_open_database()
210 if (hsdb->db) { in hdb_sqlite_open_database()
214 hsdb->db_file, sqlite3_errmsg(hsdb->db)); in hdb_sqlite_open_database()
215 sqlite3_close(hsdb->db); in hdb_sqlite_open_database()
216 hsdb->db = NULL; in hdb_sqlite_open_database()
226 hdb_sqlite_step(krb5_context context, sqlite3 *db, sqlite3_stmt *stmt) in hdb_sqlite_step() argument
245 * @param db Heimdal database handle
248 hdb_sqlite_close_database(krb5_context context, HDB *db) in hdb_sqlite_close_database() argument
250 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_close_database()
263 sqlite3_close(hsdb->db); in hdb_sqlite_close_database()
273 * @param db The heimdal database handle
279 hdb_sqlite_make_database(krb5_context context, HDB *db, const char *filename) in hdb_sqlite_make_database() argument
283 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_make_database()
289 ret = hdb_sqlite_open_database(context, db, 0); in hdb_sqlite_make_database()
291 ret = hdb_sqlite_open_database(context, db, SQLITE_OPEN_CREATE); in hdb_sqlite_make_database()
296 ret = hdb_sqlite_exec_stmt(context, hsdb->db, in hdb_sqlite_make_database()
301 ret = hdb_sqlite_exec_stmt(context, hsdb->db, in hdb_sqlite_make_database()
307 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
311 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
315 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
319 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
323 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
327 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
331 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
335 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
339 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
343 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
348 ret = hdb_sqlite_step(context, hsdb->db, hsdb->get_version); in hdb_sqlite_make_database()
365 if (hsdb->db) in hdb_sqlite_make_database()
366 sqlite3_close(hsdb->db); in hdb_sqlite_make_database()
379 * @param db Heimdal database handle
387 hdb_sqlite_fetch_kvno(krb5_context context, HDB *db, krb5_const_principal principal, in hdb_sqlite_fetch_kvno() argument
393 hdb_sqlite_db *hsdb = (hdb_sqlite_db*)(db->hdb_db); in hdb_sqlite_fetch_kvno()
405 sqlite_error = hdb_sqlite_step(context, hsdb->db, fetch); in hdb_sqlite_fetch_kvno()
426 if (db->hdb_master_key_set && (flags & HDB_F_DECRYPT)) { in hdb_sqlite_fetch_kvno()
427 ret = hdb_unseal_keys(context, db, &entry->entry); in hdb_sqlite_fetch_kvno()
456 hdb_sqlite_step_once(krb5_context context, HDB *db, sqlite3_stmt *statement) in hdb_sqlite_step_once() argument
459 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_step_once()
461 ret = hdb_sqlite_step(context, hsdb->db, statement); in hdb_sqlite_step_once()
474 * @param db Heimdal database handle
481 hdb_sqlite_store(krb5_context context, HDB *db, unsigned flags, in hdb_sqlite_store() argument
491 hdb_sqlite_db *hsdb = (hdb_sqlite_db *)(db->hdb_db); in hdb_sqlite_store()
495 ret = hdb_sqlite_exec_stmt(context, hsdb->db, in hdb_sqlite_store()
501 sqlite3_errmsg(hsdb->db)); in hdb_sqlite_store()
511 ret = hdb_seal_keys(context, db, &entry->entry); in hdb_sqlite_store()
522 ret = hdb_sqlite_step(context, hsdb->db, get_ids); in hdb_sqlite_store()
528 ret = hdb_sqlite_step(context, hsdb->db, hsdb->add_entry); in hdb_sqlite_store()
536 ret = hdb_sqlite_step(context, hsdb->db, hsdb->add_principal); in hdb_sqlite_store()
552 ret = hdb_sqlite_step_once(context, db, hsdb->delete_aliases); in hdb_sqlite_store()
559 ret = hdb_sqlite_step_once(context, db, hsdb->update_entry); in hdb_sqlite_store()
584 ret = hdb_sqlite_step_once(context, db, hsdb->add_alias); in hdb_sqlite_store()
603 ret = hdb_sqlite_exec_stmt(context, hsdb->db, "COMMIT", EINVAL); in hdb_sqlite_store()
606 ret, sqlite3_errmsg(hsdb->db)); in hdb_sqlite_store()
613 ret, sqlite3_errmsg(hsdb->db)); in hdb_sqlite_store()
617 ret = hdb_sqlite_exec_stmt(context, hsdb->db, in hdb_sqlite_store()
630 * @param db Heimdal database handle
635 hdb_sqlite_close(krb5_context context, HDB *db) in hdb_sqlite_close() argument
646 * @param db Heimdal database handle
653 hdb_sqlite_open(krb5_context context, HDB *db, int flags, mode_t mode) in hdb_sqlite_open() argument
662 * @param db Heimdal database handle
667 hdb_sqlite_destroy(krb5_context context, HDB *db) in hdb_sqlite_destroy() argument
672 ret = hdb_clear_master_key(context, db); in hdb_sqlite_destroy()
674 hdb_sqlite_close_database(context, db); in hdb_sqlite_destroy()
676 hsdb = (hdb_sqlite_db*)(db->hdb_db); in hdb_sqlite_destroy()
679 free(db->hdb_db); in hdb_sqlite_destroy()
680 free(db); in hdb_sqlite_destroy()
689 hdb_sqlite_lock(krb5_context context, HDB *db, int operation) in hdb_sqlite_lock() argument
700 hdb_sqlite_unlock(krb5_context context, HDB *db) in hdb_sqlite_unlock() argument
711 hdb_sqlite_nextkey(krb5_context context, HDB *db, unsigned flags, in hdb_sqlite_nextkey() argument
718 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_nextkey()
720 sqlite_error = hdb_sqlite_step(context, hsdb->db, hsdb->get_all_entries); in hdb_sqlite_nextkey()
746 hdb_sqlite_firstkey(krb5_context context, HDB *db, unsigned flags, in hdb_sqlite_firstkey() argument
749 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_firstkey()
754 ret = hdb_sqlite_nextkey(context, db, flags, entry); in hdb_sqlite_firstkey()
765 hdb_sqlite_rename(krb5_context context, HDB *db, const char *new_name) in hdb_sqlite_rename() argument
767 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_rename()
775 hdb_sqlite_close_database(context, db); in hdb_sqlite_rename()
780 hdb_sqlite_make_database(context, db, new_name); in hdb_sqlite_rename()
789 hdb_sqlite_remove(krb5_context context, HDB *db, in hdb_sqlite_remove() argument
794 hdb_sqlite_db *hsdb = (hdb_sqlite_db*)(db->hdb_db); in hdb_sqlite_remove()
805 ret = hdb_sqlite_step(context, hsdb->db, remove); in hdb_sqlite_remove()
824 * @param db a returned database handle.
831 hdb_sqlite_create(krb5_context context, HDB **db, const char *argument) in hdb_sqlite_create() argument
836 *db = calloc(1, sizeof (**db)); in hdb_sqlite_create()
837 if (*db == NULL) in hdb_sqlite_create()
842 free(*db); in hdb_sqlite_create()
843 *db = NULL; in hdb_sqlite_create()
847 (*db)->hdb_db = hsdb; in hdb_sqlite_create()
850 ret = hdb_sqlite_make_database(context, *db, argument); in hdb_sqlite_create()
852 free((*db)->hdb_db); in hdb_sqlite_create()
853 free(*db); in hdb_sqlite_create()
858 (*db)->hdb_master_key_set = 0; in hdb_sqlite_create()
859 (*db)->hdb_openp = 0; in hdb_sqlite_create()
860 (*db)->hdb_capability_flags = 0; in hdb_sqlite_create()
862 (*db)->hdb_open = hdb_sqlite_open; in hdb_sqlite_create()
863 (*db)->hdb_close = hdb_sqlite_close; in hdb_sqlite_create()
865 (*db)->hdb_lock = hdb_sqlite_lock; in hdb_sqlite_create()
866 (*db)->hdb_unlock = hdb_sqlite_unlock; in hdb_sqlite_create()
867 (*db)->hdb_firstkey = hdb_sqlite_firstkey; in hdb_sqlite_create()
868 (*db)->hdb_nextkey = hdb_sqlite_nextkey; in hdb_sqlite_create()
869 (*db)->hdb_fetch_kvno = hdb_sqlite_fetch_kvno; in hdb_sqlite_create()
870 (*db)->hdb_store = hdb_sqlite_store; in hdb_sqlite_create()
871 (*db)->hdb_remove = hdb_sqlite_remove; in hdb_sqlite_create()
872 (*db)->hdb_destroy = hdb_sqlite_destroy; in hdb_sqlite_create()
873 (*db)->hdb_rename = hdb_sqlite_rename; in hdb_sqlite_create()
874 (*db)->hdb__get = NULL; in hdb_sqlite_create()
875 (*db)->hdb__put = NULL; in hdb_sqlite_create()
876 (*db)->hdb__del = NULL; in hdb_sqlite_create()