mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 04:31:50 +00:00
FS-11827: [Core] Add feature allowing FreeSWITCH to store CORE DB (SQLite) fully in memory (core-db-dsn).
This commit is contained in:
@@ -1854,6 +1854,13 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_write_codec(_In_
|
||||
*/
|
||||
SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(const char *filename);
|
||||
|
||||
/*!
|
||||
\brief Open a core db (SQLite) in-memory
|
||||
\param uri to the db to open
|
||||
\return the db handle
|
||||
*/
|
||||
SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_in_memory(const char *uri);
|
||||
|
||||
/*!
|
||||
\brief Execute a sql stmt until it is accepted
|
||||
\param db the db handle
|
||||
@@ -2485,7 +2492,8 @@ typedef int (*switch_core_db_event_callback_func_t) (void *pArg, switch_event_t
|
||||
#define CACHE_DB_LEN 256
|
||||
typedef enum {
|
||||
CDF_INUSE = (1 << 0),
|
||||
CDF_PRUNE = (1 << 1)
|
||||
CDF_PRUNE = (1 << 1),
|
||||
CDF_NONEXPIRING = (1 << 2)
|
||||
} cache_db_flag_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -2495,13 +2503,14 @@ typedef enum {
|
||||
} switch_cache_db_handle_type_t;
|
||||
|
||||
typedef union {
|
||||
switch_core_db_t *core_db_dbh;
|
||||
switch_core_db_handle_t *core_db_dbh;
|
||||
switch_odbc_handle_t *odbc_dbh;
|
||||
switch_database_interface_handle_t *database_interface_dbh;
|
||||
} switch_cache_db_native_handle_t;
|
||||
|
||||
typedef struct {
|
||||
char *db_path;
|
||||
switch_bool_t in_memory;
|
||||
} switch_cache_db_core_db_options_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -51,6 +51,12 @@ SWITCH_BEGIN_EXTERN_C
|
||||
* following opaque structure.
|
||||
*/
|
||||
typedef struct sqlite3 switch_core_db_t;
|
||||
|
||||
struct switch_core_db_handle {
|
||||
switch_bool_t in_memory;
|
||||
switch_core_db_t *handle;
|
||||
};
|
||||
|
||||
typedef struct sqlite3_stmt switch_core_db_stmt_t;
|
||||
|
||||
typedef int (*switch_core_db_callback_func_t) (void *pArg, int argc, char **argv, char **columnNames);
|
||||
@@ -102,6 +108,11 @@ SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db);
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t **ppDb);
|
||||
|
||||
/**
|
||||
Same as switch_core_db_open() but additionally allows SQLITE_OPEN_URI
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_open_v2(const char *filename, switch_core_db_t **ppDb);
|
||||
|
||||
/**
|
||||
* ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
|
||||
* even empty strings, are always zero-terminated. ^The return
|
||||
|
||||
@@ -2318,6 +2318,7 @@ typedef struct switch_codec_implementation switch_codec_implementation_t;
|
||||
typedef struct switch_buffer switch_buffer_t;
|
||||
typedef union switch_codec_settings switch_codec_settings_t;
|
||||
typedef struct switch_codec_fmtp switch_codec_fmtp_t;
|
||||
typedef struct switch_core_db_handle switch_core_db_handle_t;
|
||||
typedef struct switch_odbc_handle switch_odbc_handle_t;
|
||||
typedef struct switch_database_interface_handle switch_database_interface_handle_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user