00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef SQLITE_FUNCTIONS_H_
00033 #define SQLITE_FUNCTIONS_H_
00034 #include <sqlite3.h>
00035 #include "str_functions.h"
00036
00037
00047 #ifndef SQLITE_OPEN_READONLY
00048
00051 #define SQLITE_OPEN_READONLY 0x00000001
00052 #endif
00053
00054 #ifndef SQLITE_OPEN_READWRITE
00055
00058 #define SQLITE_OPEN_READWRITE 0x00000002
00059 #endif
00060
00061 #ifndef SQLITE_OPEN_CREATE
00062
00070 #define SQLITE_OPEN_CREATE 0x00000004
00071 #endif
00072
00088 #ifndef SQL_RESULT_FIELD_CHUNK_SIZE
00089
00092 # define SQL_RESULT_FIELD_CHUNK_SIZE 2048
00093 #endif
00094
00095 #ifndef SQL_RESULT_FIELD_ELEMENT_COUNT
00096
00099 # define SQL_RESULT_FIELD_ELEMENT_COUNT 128
00100 #endif
00101
00102 #ifndef SQL_RESULT_FIELD_CONST_COUNT
00103
00107 # define SQL_RESULT_FIELD_CONST_COUNT 0
00108 #endif
00109
00110 #ifndef SQL_RESULT_RESULT_CHUNK_SIZE
00111
00114 # define SQL_RESULT_RESULT_CHUNK_SIZE 65536
00115 #endif
00116
00117 #ifndef SQL_RESULT_RESULT_ELEMENT_COUNT
00118
00121 # define SQL_RESULT_RESULT_ELEMENT_COUNT 512
00122 #endif
00123
00132 typedef int (*sqlite_exec_callback)(gpointer user_option,gint col_num,gchar **results,gchar **col_names);
00133
00152 typedef void (*sqlite_error_callback)(sqlite3 *db, const gchar *sqlClause, gint error_code, const gchar *error_msg, gpointer error_option);
00153
00154
00172 int sqlite_open(const char *filename, sqlite3 **ppDb, int flags);
00173
00195 typedef struct {
00196 StringList *fieldList;
00197 StringList *resultList;
00198 int colCount;
00199 int execResult;
00200 char *errMsg;
00201 } SQL_Result;
00202
00208 SQL_Result *sql_result_new();
00209
00217 StringList *sql_result_free(SQL_Result *sResult, gboolean freeResult);
00218
00231 int sqlite_count_matches(sqlite3 *db,const char * sqlClause,char **errMsg_ptr);
00232
00233
00254 void sqlite_error_callback_hide_constraint_error(sqlite3 *db, const gchar *sqlClause, gint error_code,
00255 const gchar *error_msg, gpointer prompt);
00256
00278 void sqlite_error_callback_print_message(sqlite3 *db, const gchar *sqlClause, gint error_code,
00279 const gchar *error_msg, gpointer prompt);
00280
00281
00305 int sqlite_exec_handle_error(sqlite3 *db, const gchar *sqlClause, sqlite_exec_callback exec_func,
00306 gpointer exec_option, sqlite_error_callback error_func, gpointer error_option);
00307
00315 SQL_Result *sqlite_get_sql_result(sqlite3 *db, const char *sqlClause);
00316
00323 SQL_Result *sqlite_get_tableNames(sqlite3 *db);
00324
00341 StringList *sqlite_get_fieldNames(sqlite3 *db,const char * sqlClause, int *execResult_ptr, char **errMsg_ptr);
00342
00355 char *sqlite_value_signed_text(sqlite3_value *value);
00356
00369 char *sqlite_value_signed_text_buffer(char *buf,sqlite3_value *value);
00370
00371 #endif
00372