This commit is contained in:
Anthony Minessale 2012-10-08 15:57:44 -05:00
parent 21d240b28c
commit 1ad45f7009
4 changed files with 230 additions and 351 deletions

View File

@ -2193,11 +2193,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_chat_send(const char *dest_proto, sw
SWITCH_DECLARE(switch_status_t) switch_core_chat_deliver(const char *dest_proto, switch_event_t **message_event); SWITCH_DECLARE(switch_status_t) switch_core_chat_deliver(const char *dest_proto, switch_event_t **message_event);
SWITCH_DECLARE(switch_status_t) switch_ivr_preprocess_session(switch_core_session_t *session, const char *cmds); SWITCH_DECLARE(switch_status_t) switch_ivr_preprocess_session(switch_core_session_t *session, const char *cmds);
SWITCH_DECLARE(void) switch_sqldb_stop_thread(switch_sql_manager_t *sql_manager); SWITCH_DECLARE(void) switch_core_sqldb_stop_thread(void);
#define switch_core_sqldb_stop_thread() switch_sqldb_stop_thread(&switch_cache_db_sql_manager)
SWITCH_DECLARE(void) switch_sqldb_start_thread(switch_sql_manager_t *sql_manager, void *(SWITCH_THREAD_FUNC * func) (switch_thread_t *, void *),
char **post_connect_sql, int argc);
SWITCH_DECLARE(void) switch_core_sqldb_start_thread(void); SWITCH_DECLARE(void) switch_core_sqldb_start_thread(void);
///\} ///\}
@ -2244,6 +2240,8 @@ typedef union {
switch_cache_db_pgsql_options_t pgsql_options; switch_cache_db_pgsql_options_t pgsql_options;
} switch_cache_db_connection_options_t; } switch_cache_db_connection_options_t;
struct switch_cache_db_handle;
typedef struct switch_cache_db_handle switch_cache_db_handle_t;
static inline const char *switch_cache_db_type_name(switch_cache_db_handle_type_t type) static inline const char *switch_cache_db_type_name(switch_cache_db_handle_type_t type)
{ {
@ -2283,9 +2281,7 @@ SWITCH_DECLARE(void) switch_cache_db_dismiss_db_handle(switch_cache_db_handle_t
other threads until the allocating thread actually terminates. other threads until the allocating thread actually terminates.
\param [in] The handle \param [in] The handle
*/ */
SWITCH_DECLARE(void) _switch_cache_db_release_db_handle(switch_sql_manager_t *sql_manager, switch_cache_db_handle_t ** dbh);
SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t ** dbh); SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t ** dbh);
/*! /*!
\brief Gets a new cached handle from the pool, potentially creating a new connection. \brief Gets a new cached handle from the pool, potentially creating a new connection.
The connection is bound to the thread until it (the thread) terminates unless The connection is bound to the thread until it (the thread) terminates unless
@ -2294,19 +2290,12 @@ SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t
\param [in] type - ODBC or SQLLITE \param [in] type - ODBC or SQLLITE
\param [in] connection_options (userid, password, etc) \param [in] connection_options (userid, password, etc)
*/ */
SWITCH_DECLARE(switch_status_t) __switch_cache_db_get_db_handle(switch_sql_manager_t *sql_manager,
switch_cache_db_handle_t ** dbh,
switch_cache_db_handle_type_t type,
switch_cache_db_connection_options_t *connection_options,
const char *file, const char *func, int line);
SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_handle_t ** dbh, SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_handle_t ** dbh,
switch_cache_db_handle_type_t type, switch_cache_db_handle_type_t type,
switch_cache_db_connection_options_t *connection_options, switch_cache_db_connection_options_t *connection_options,
const char *file, const char *func, int line); const char *file, const char *func, int line);
#define switch_cache_db_get_db_handle(_a, _b, _c) _switch_cache_db_get_db_handle(_a, _b, _c, __FILE__, __SWITCH_FUNC__, __LINE__) #define switch_cache_db_get_db_handle(_a, _b, _c) _switch_cache_db_get_db_handle(_a, _b, _c, __FILE__, __SWITCH_FUNC__, __LINE__)
/*! /*!
\brief Executes the sql and returns the result as a string \brief Executes the sql and returns the result as a string
\param [in] dbh The handle \param [in] dbh The handle
@ -2341,21 +2330,15 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cach
*/ */
SWITCH_DECLARE(int) switch_cache_db_affected_rows(switch_cache_db_handle_t *dbh); SWITCH_DECLARE(int) switch_cache_db_affected_rows(switch_cache_db_handle_t *dbh);
extern switch_sql_manager_t switch_cache_db_sql_manager;
/*! /*!
\brief Provides some feedback as to the status of the db connection pool \brief Provides some feedback as to the status of the db connection pool
\param [in] stream stream for status \param [in] stream stream for status
*/ */
SWITCH_DECLARE(void) _switch_cache_db_status(switch_sql_manager_t *sql_manager, switch_stream_handle_t *stream);
SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream); SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream);
SWITCH_DECLARE(switch_status_t) __switch_core_db_handle(switch_sql_manager_t *sql_manager, switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line);
SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line); SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line);
#define switch_core_db_handle(_a) _switch_core_db_handle(_a, __FILE__, __SWITCH_FUNC__, __LINE__) #define switch_core_db_handle(_a) _switch_core_db_handle(_a, __FILE__, __SWITCH_FUNC__, __LINE__)
SWITCH_DECLARE(switch_status_t) _switch_core_recovery_db_handle(switch_sql_manager_t *sql_manager, switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line); SWITCH_DECLARE(switch_status_t) _switch_core_recovery_db_handle(switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line);
#define switch_core_recovery_db_handle(_a) _switch_core_recovery_db_handle(&switch_cache_db_sql_manager, _a, __FILE__, __SWITCH_FUNC__, __LINE__) #define switch_core_recovery_db_handle(_a) _switch_core_recovery_db_handle(_a, __FILE__, __SWITCH_FUNC__, __LINE__)
SWITCH_DECLARE(switch_status_t) _switch_core_persist_db_handle(switch_sql_manager_t *sql_manager, switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line);
#define switch_core_persist_db_handle(_a) _switch_core_persist_db_handle(&switch_cache_db_sql_manager, _a, __FILE__, __SWITCH_FUNC__, __LINE__)
SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_handle_t *db, SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_handle_t *db,
const char *test_sql, const char *drop_sql, const char *reactive_sql); const char *test_sql, const char *drop_sql, const char *reactive_sql);
@ -2364,9 +2347,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_
SWITCH_DECLARE(void) switch_core_set_signal_handlers(void); SWITCH_DECLARE(void) switch_core_set_signal_handlers(void);
SWITCH_DECLARE(uint32_t) switch_core_debug_level(void); SWITCH_DECLARE(uint32_t) switch_core_debug_level(void);
SWITCH_DECLARE(void) switch_cache_db_flush_handles(switch_sql_manager_t *sql_manager); SWITCH_DECLARE(void) switch_cache_db_flush_handles(void);
#define switch_core_cache_db_flush_handles() switch_cache_db_flush_handles(&switch_cache_db_sql_manager)
SWITCH_DECLARE(const char *) switch_core_banner(void); SWITCH_DECLARE(const char *) switch_core_banner(void);
SWITCH_DECLARE(switch_bool_t) switch_core_session_in_thread(switch_core_session_t *session); SWITCH_DECLARE(switch_bool_t) switch_core_session_in_thread(switch_core_session_t *session);
SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number); SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number);

View File

@ -1836,11 +1836,6 @@ typedef struct switch_odbc_handle switch_odbc_handle_t;
typedef struct switch_pgsql_handle switch_pgsql_handle_t; typedef struct switch_pgsql_handle switch_pgsql_handle_t;
typedef struct switch_pgsql_result switch_pgsql_result_t; typedef struct switch_pgsql_result switch_pgsql_result_t;
struct switch_cache_db_handle;
typedef struct switch_cache_db_handle switch_cache_db_handle_t;
struct switch_sql_manager;
typedef struct switch_sql_manager switch_sql_manager_t;
typedef struct switch_io_routines switch_io_routines_t; typedef struct switch_io_routines switch_io_routines_t;
typedef struct switch_speech_handle switch_speech_handle_t; typedef struct switch_speech_handle switch_speech_handle_t;
typedef struct switch_asr_handle switch_asr_handle_t; typedef struct switch_asr_handle switch_asr_handle_t;

View File

@ -2260,7 +2260,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
switch_time_calibrate_clock(); switch_time_calibrate_clock();
break; break;
case SCSC_FLUSH_DB_HANDLES: case SCSC_FLUSH_DB_HANDLES:
switch_core_cache_db_flush_handles(); switch_cache_db_flush_handles();
break; break;
case SCSC_SEND_SIGHUP: case SCSC_SEND_SIGHUP:
handle_SIGHUP(1); handle_SIGHUP(1);

File diff suppressed because it is too large Load Diff