Lines Matching refs:hsdb

204     hdb_sqlite_db *hsdb = (hdb_sqlite_db*) db->hdb_db;  in hdb_sqlite_open_database()  local
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()
250 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_close_database() local
252 sqlite3_finalize(hsdb->get_version); in hdb_sqlite_close_database()
253 sqlite3_finalize(hsdb->fetch); in hdb_sqlite_close_database()
254 sqlite3_finalize(hsdb->get_ids); in hdb_sqlite_close_database()
255 sqlite3_finalize(hsdb->add_entry); in hdb_sqlite_close_database()
256 sqlite3_finalize(hsdb->add_principal); in hdb_sqlite_close_database()
257 sqlite3_finalize(hsdb->add_alias); in hdb_sqlite_close_database()
258 sqlite3_finalize(hsdb->delete_aliases); in hdb_sqlite_close_database()
259 sqlite3_finalize(hsdb->update_entry); in hdb_sqlite_close_database()
260 sqlite3_finalize(hsdb->remove); in hdb_sqlite_close_database()
261 sqlite3_finalize(hsdb->get_all_entries); in hdb_sqlite_close_database()
263 sqlite3_close(hsdb->db); in hdb_sqlite_close_database()
283 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_make_database() local
285 hsdb->db_file = strdup(filename); in hdb_sqlite_make_database()
286 if(hsdb->db_file == NULL) 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()
308 &hsdb->get_version, in hdb_sqlite_make_database()
311 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
312 &hsdb->fetch, in hdb_sqlite_make_database()
315 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
316 &hsdb->get_ids, in hdb_sqlite_make_database()
319 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
320 &hsdb->add_entry, in hdb_sqlite_make_database()
323 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
324 &hsdb->add_principal, in hdb_sqlite_make_database()
327 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
328 &hsdb->add_alias, in hdb_sqlite_make_database()
331 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
332 &hsdb->delete_aliases, in hdb_sqlite_make_database()
335 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
336 &hsdb->update_entry, in hdb_sqlite_make_database()
339 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
340 &hsdb->remove, in hdb_sqlite_make_database()
343 ret = hdb_sqlite_prepare_stmt(context, hsdb->db, in hdb_sqlite_make_database()
344 &hsdb->get_all_entries, in hdb_sqlite_make_database()
348 ret = hdb_sqlite_step(context, hsdb->db, hsdb->get_version); in hdb_sqlite_make_database()
350 hsdb->version = sqlite3_column_double(hsdb->get_version, 0); in hdb_sqlite_make_database()
352 sqlite3_reset(hsdb->get_version); in hdb_sqlite_make_database()
355 if(hsdb->version != HDBSQLITE_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()
368 unlink(hsdb->db_file); in hdb_sqlite_make_database()
393 hdb_sqlite_db *hsdb = (hdb_sqlite_db*)(db->hdb_db); in hdb_sqlite_fetch_kvno() local
394 sqlite3_stmt *fetch = hsdb->fetch; in hdb_sqlite_fetch_kvno()
405 sqlite_error = hdb_sqlite_step(context, hsdb->db, fetch); in hdb_sqlite_fetch_kvno()
459 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_step_once() local
461 ret = hdb_sqlite_step(context, hsdb->db, statement); in hdb_sqlite_step_once()
491 hdb_sqlite_db *hsdb = (hdb_sqlite_db *)(db->hdb_db); in hdb_sqlite_store() local
493 sqlite3_stmt *get_ids = hsdb->get_ids; 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()
522 ret = hdb_sqlite_step(context, hsdb->db, get_ids); in hdb_sqlite_store()
526 sqlite3_bind_blob(hsdb->add_entry, 1, in hdb_sqlite_store()
528 ret = hdb_sqlite_step(context, hsdb->db, hsdb->add_entry); in hdb_sqlite_store()
529 sqlite3_clear_bindings(hsdb->add_entry); in hdb_sqlite_store()
530 sqlite3_reset(hsdb->add_entry); in hdb_sqlite_store()
534 sqlite3_bind_text(hsdb->add_principal, 1, in hdb_sqlite_store()
536 ret = hdb_sqlite_step(context, hsdb->db, hsdb->add_principal); in hdb_sqlite_store()
537 sqlite3_clear_bindings(hsdb->add_principal); in hdb_sqlite_store()
538 sqlite3_reset(hsdb->add_principal); in hdb_sqlite_store()
551 sqlite3_bind_int64(hsdb->delete_aliases, 1, entry_id); in hdb_sqlite_store()
552 ret = hdb_sqlite_step_once(context, db, hsdb->delete_aliases); in hdb_sqlite_store()
556 sqlite3_bind_blob(hsdb->update_entry, 1, in hdb_sqlite_store()
558 sqlite3_bind_int64(hsdb->update_entry, 2, entry_id); in hdb_sqlite_store()
559 ret = hdb_sqlite_step_once(context, db, hsdb->update_entry); in hdb_sqlite_store()
581 sqlite3_bind_text(hsdb->add_alias, 1, alias_string, in hdb_sqlite_store()
583 sqlite3_bind_int64(hsdb->add_alias, 2, entry_id); 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()
670 hdb_sqlite_db *hsdb; in hdb_sqlite_destroy() local
676 hsdb = (hdb_sqlite_db*)(db->hdb_db); in hdb_sqlite_destroy()
678 free(hsdb->db_file); in hdb_sqlite_destroy()
718 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_nextkey() local
720 sqlite_error = hdb_sqlite_step(context, hsdb->db, hsdb->get_all_entries); in hdb_sqlite_nextkey()
723 value.length = sqlite3_column_bytes(hsdb->get_all_entries, 0); in hdb_sqlite_nextkey()
724 value.data = (void *) sqlite3_column_blob(hsdb->get_all_entries, 0); in hdb_sqlite_nextkey()
731 sqlite3_reset(hsdb->get_all_entries); in hdb_sqlite_nextkey()
749 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_firstkey() local
752 sqlite3_reset(hsdb->get_all_entries); in hdb_sqlite_firstkey()
767 hdb_sqlite_db *hsdb = (hdb_sqlite_db *) db->hdb_db; in hdb_sqlite_rename() local
777 ret = rename(hsdb->db_file, new_name); in hdb_sqlite_rename()
778 free(hsdb->db_file); in hdb_sqlite_rename()
794 hdb_sqlite_db *hsdb = (hdb_sqlite_db*)(db->hdb_db); in hdb_sqlite_remove() local
795 sqlite3_stmt *remove = hsdb->remove; in hdb_sqlite_remove()
805 ret = hdb_sqlite_step(context, hsdb->db, remove); in hdb_sqlite_remove()
834 hdb_sqlite_db *hsdb; in hdb_sqlite_create() local
840 hsdb = (hdb_sqlite_db*) calloc(1, sizeof (*hsdb)); in hdb_sqlite_create()
841 if (hsdb == NULL) { in hdb_sqlite_create()
847 (*db)->hdb_db = hsdb; in hdb_sqlite_create()