src/lib/lightmediascanner_db_private.h

Go to the documentation of this file.
00001 
00021 #ifndef _LIGHTMEDIASCANNER_DB_PRIVATE_H_
00022 #define _LIGHTMEDIASCANNER_DB_PRIVATE_H_ 1
00023 
00024 #ifdef __GNUC__
00025 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
00026 #  define GNUC_NON_NULL(...) __attribute__((nonnull(__VA_ARGS__)))
00027 # else
00028 #  define GNUC_NON_NULL(...)
00029 # endif
00030 #else
00031 #  define GNUC_NON_NULL(...)
00032 #endif
00033 
00034 #include <sqlite3.h>
00035 #include <sys/types.h>
00036 #include "lightmediascanner_plugin.h"
00037 
00038 sqlite3_stmt *lms_db_compile_stmt(sqlite3 *db, const char *sql) GNUC_NON_NULL(1, 2);
00039 int lms_db_finalize_stmt(sqlite3_stmt *stmt, const char *name) GNUC_NON_NULL(1, 2);
00040 int lms_db_reset_stmt(sqlite3_stmt *stmt) GNUC_NON_NULL(1);
00041 int lms_db_bind_text(sqlite3_stmt *stmt, int col, const char *text, int len) GNUC_NON_NULL(1);
00042 int lms_db_bind_blob(sqlite3_stmt *stmt, int col, const void *blob, int len) GNUC_NON_NULL(1);
00043 int lms_db_bind_int64(sqlite3_stmt *stmt, int col, int64_t value) GNUC_NON_NULL(1);
00044 int lms_db_bind_int64_or_null(sqlite3_stmt *stmt, int col, int64_t *p_value) GNUC_NON_NULL(1);
00045 int lms_db_bind_int(sqlite3_stmt *stmt, int col, int value) GNUC_NON_NULL(1);
00046 int lms_db_bind_double(sqlite3_stmt *stmt, int col, double value) GNUC_NON_NULL(1);
00047 int lms_db_create_trigger_if_not_exists(sqlite3 *db, const char *sql) GNUC_NON_NULL(1, 2);
00048 
00049 int lms_db_table_version_get(sqlite3 *db, const char *table) GNUC_NON_NULL(1, 2);
00050 int lms_db_table_version_set(sqlite3 *db, const char *table, unsigned int version) GNUC_NON_NULL(1, 2);
00051 
00052 typedef int (*lms_db_table_updater_t)(sqlite3 *db, const char *table, unsigned int current_version, int is_last_run);
00053 
00054 int lms_db_table_update(sqlite3 *db, const char *table, unsigned int current_version, unsigned int last_version, const lms_db_table_updater_t *updaters) GNUC_NON_NULL(1, 2, 5);
00055 int lms_db_table_update_if_required(sqlite3 *db, const char *table, unsigned int last_version, lms_db_table_updater_t *updaters) GNUC_NON_NULL(1, 2, 4);
00056 
00057 struct lms_db_cache_entry {
00058     const sqlite3 *db;
00059     void *data;
00060 };
00061 
00062 struct lms_db_cache {
00063     int size;
00064     struct lms_db_cache_entry *entries;
00065 };
00066 
00067 int lms_db_cache_add(struct lms_db_cache *cache, const sqlite3 *db, void *data) GNUC_NON_NULL(1, 2, 3);
00068 int lms_db_cache_del(struct lms_db_cache *cache, const sqlite3 *db, void *data) GNUC_NON_NULL(1, 2, 3);
00069 int lms_db_cache_get(struct lms_db_cache *cache, const sqlite3 *db, void **pdata) GNUC_NON_NULL(1, 2, 3);
00070 
00071 int lms_db_create_core_tables_if_required(sqlite3 *db) GNUC_NON_NULL(1);
00072 
00073 sqlite3_stmt *lms_db_compile_stmt_begin_transaction(sqlite3 *db) GNUC_NON_NULL(1);
00074 sqlite3_stmt *lms_db_compile_stmt_end_transaction(sqlite3 *db) GNUC_NON_NULL(1);
00075 sqlite3_stmt *lms_db_compile_stmt_get_file_info(sqlite3 *db) GNUC_NON_NULL(1);
00076 sqlite3_stmt *lms_db_compile_stmt_insert_file_info(sqlite3 *db) GNUC_NON_NULL(1);
00077 sqlite3_stmt *lms_db_compile_stmt_update_file_info(sqlite3 *db) GNUC_NON_NULL(1);
00078 sqlite3_stmt *lms_db_compile_stmt_delete_file_info(sqlite3 *db) GNUC_NON_NULL(1);
00079 sqlite3_stmt *lms_db_compile_stmt_set_file_dtime(sqlite3 *db) GNUC_NON_NULL(1);
00080 sqlite3_stmt *lms_db_compile_stmt_get_files(sqlite3 *db) GNUC_NON_NULL(1);
00081 
00082 int lms_db_begin_transaction(sqlite3_stmt *stmt) GNUC_NON_NULL(1);
00083 int lms_db_end_transaction(sqlite3_stmt *stmt) GNUC_NON_NULL(1);
00084 int lms_db_update_file_info(sqlite3_stmt *stmt, const struct lms_file_info *finfo) GNUC_NON_NULL(1, 2);
00085 int lms_db_get_file_info(sqlite3_stmt *stmt, struct lms_file_info *finfo) GNUC_NON_NULL(1, 2);
00086 int lms_db_insert_file_info(sqlite3_stmt *stmt, struct lms_file_info *finfo) GNUC_NON_NULL(1, 2);
00087 int lms_db_delete_file_info(sqlite3_stmt *stmt, const struct lms_file_info *finfo) GNUC_NON_NULL(1, 2);
00088 int lms_db_set_file_dtime(sqlite3_stmt *stmt, const struct lms_file_info *finfo) GNUC_NON_NULL(1, 2);
00089 int lms_db_get_files(sqlite3_stmt *stmt, const char *path, int len) GNUC_NON_NULL(1, 2);
00090 
00091 
00092 
00093 #endif /* _LIGHTMEDIASCANNER_DB_PRIVATE_H_ */

Generated on Thu Dec 13 02:04:03 2007 for Light Media Scanner by  doxygen 1.5.2