00001
00020 #ifndef __RTCOM_EL_DB_H__
00021 #define __RTCOM_EL_DB_H__
00022
00023 #include <sqlite3.h>
00024 #include <glib.h>
00025
00026 G_BEGIN_DECLS
00027
00028 typedef sqlite3 *rtcom_el_db_t;
00029 typedef sqlite3_stmt *rtcom_el_db_stmt_t;
00030
00031 #define RTCOM_EL_DB_MAX_BUSYLOOP_TIME 2.00
00032 #define RTCOM_EL_ERROR rtcom_el_error_quark ()
00033
00034 rtcom_el_db_t rtcom_el_db_open (const gchar *fname);
00035 void rtcom_el_db_close (rtcom_el_db_t db);
00036 gboolean rtcom_el_db_exec (rtcom_el_db_t db, GFunc cb, gpointer user_data,
00037 const gchar *sql, GError **error);
00038 gboolean rtcom_el_db_exec_printf (rtcom_el_db_t db, GFunc cb,
00039 gpointer user_data, GError **error, const gchar *fmt, ...);
00040 gboolean rtcom_el_db_transaction (rtcom_el_db_t db, gboolean exclusive,
00041 GError **error);
00042 gboolean rtcom_el_db_commit (rtcom_el_db_t db, GError **error);
00043 gboolean rtcom_el_db_rollback (rtcom_el_db_t db, GError **error);
00044 gint rtcom_el_db_iterate (rtcom_el_db_t db, rtcom_el_db_stmt_t stmt,
00045 GError **error);
00046 void rtcom_el_db_single_int (gpointer data, gpointer user_data);
00047 GHashTable * rtcom_el_db_cache_lookup_table (rtcom_el_db_t db,
00048 const gchar *tname);
00049
00050 const gchar ** rtcom_el_db_schema_get_sql ();
00051 gint rtcom_el_db_schema_get_n_items ();
00052 void rtcom_el_db_schema_get_mappings (const gchar **out_selection,
00053 GHashTable **out_mapping, GHashTable **out_typing);
00054 void rtcom_el_db_g_value_slice_free (gpointer p);
00055 void rtcom_el_db_schema_update_row (rtcom_el_db_stmt_t stmt, GHashTable *row);
00056 GHashTable *rtcom_el_db_schema_get_row (rtcom_el_db_stmt_t stmt);
00057
00058 G_END_DECLS
00059
00060 #endif
00061