FreeSWITCH API Documentation
1.7.0
|
Go to the source code of this file.
switch_bool_t switch_pgsql_available | ( | void | ) |
Definition at line 819 of file switch_pgsql.c.
References SWITCH_FALSE, and SWITCH_TRUE.
Referenced by _switch_cache_db_get_db_handle(), and switch_load_core_config().
switch_pgsql_status_t switch_pgsql_cancel_real | ( | const char * | file, |
const char * | func, | ||
int | line, | ||
switch_pgsql_handle_t * | handle | ||
) |
Definition at line 266 of file switch_pgsql.c.
References memset(), SWITCH_CHANNEL_ID_LOG, SWITCH_LOG_CRIT, switch_log_printf(), SWITCH_PGSQL_FAIL, switch_pgsql_flush(), and SWITCH_PGSQL_SUCCESS.
switch_pgsql_status_t switch_pgsql_finish_results_real | ( | const char * | file, |
const char * | func, | ||
int | line, | ||
switch_pgsql_handle_t * | handle | ||
) |
Definition at line 457 of file switch_pgsql.c.
References SWITCH_CHANNEL_ID_LOG, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PGSQL_FAIL, switch_pgsql_free_result(), switch_pgsql_next_result, SWITCH_PGSQL_SUCCESS, switch_stristr(), and zstr.
switch_pgsql_status_t switch_pgsql_flush | ( | switch_pgsql_handle_t * | handle | ) |
Definition at line 842 of file switch_pgsql.c.
References SWITCH_CHANNEL_LOG, SWITCH_FALSE, SWITCH_LOG_DEBUG10, switch_log_printf(), and SWITCH_PGSQL_SUCCESS.
Referenced by switch_cache_db_release_db_handle(), switch_pgsql_cancel_real(), switch_pgsql_handle_exec_base_detailed(), and switch_pgsql_next_result_timed().
void switch_pgsql_free_result | ( | switch_pgsql_result_t ** | result | ) |
Definition at line 439 of file switch_pgsql.c.
Referenced by switch_pgsql_finish_results_real(), switch_pgsql_handle_callback_exec_detailed(), and switch_pgsql_handle_exec_string_detailed().
int switch_pgsql_handle_affected_rows | ( | switch_pgsql_handle_t * | handle | ) |
Definition at line 810 of file switch_pgsql.c.
Referenced by switch_cache_db_affected_rows().
switch_pgsql_status_t switch_pgsql_handle_callback_exec_detailed | ( | const char * | file, |
const char * | func, | ||
int | line, | ||
switch_pgsql_handle_t * | handle, | ||
const char * | sql, | ||
switch_core_db_callback_func_t | callback, | ||
void * | pdata, | ||
char ** | err | ||
) |
Execute the sql query and issue a callback for each row returned.
file | the file from which this function is called |
func | the function from which this function is called |
line | the line from which this function is called |
handle | the PGSQL handle |
sql | the sql string to execute |
callback | the callback function to execute |
pdata | the state data passed on each callback invocation |
Definition at line 662 of file switch_pgsql.c.
References switch_assert, SWITCH_CHANNEL_ID_LOG, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PGSQL_FAIL, switch_pgsql_finish_results, switch_pgsql_free_result(), switch_pgsql_handle_exec_base, switch_pgsql_handle_get_error(), switch_pgsql_next_result, SWITCH_PGSQL_SUCCESS, switch_safe_free, switch_str_nil, and zstr.
switch_pgsql_status_t switch_pgsql_handle_connect | ( | switch_pgsql_handle_t * | handle | ) |
Connect to the database specified by the DSN passed to the switch_pgsql_handle_new() call which initialized this handle.
The | database handle to connect to the database. |
Definition at line 489 of file switch_pgsql.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PGSQL_FAIL, switch_pgsql_handle_disconnect(), switch_pgsql_handle_get_error(), SWITCH_PGSQL_STATE_CONNECTED, SWITCH_PGSQL_SUCCESS, and switch_safe_free.
Referenced by _switch_cache_db_get_db_handle().
void switch_pgsql_handle_destroy | ( | switch_pgsql_handle_t ** | handlep | ) |
Definition at line 764 of file switch_pgsql.c.
References switch_pgsql_handle_disconnect(), and switch_safe_free.
Referenced by _switch_cache_db_get_db_handle(), and sql_close().
switch_pgsql_status_t switch_pgsql_handle_disconnect | ( | switch_pgsql_handle_t * | handle | ) |
Disconnects a PGSQL connection from the database.
handle | The PGSQL database handle to disconnect. |
Definition at line 225 of file switch_pgsql.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, switch_log_printf(), SWITCH_PGSQL_FAIL, SWITCH_PGSQL_STATE_CONNECTED, SWITCH_PGSQL_STATE_DOWN, SWITCH_PGSQL_SUCCESS, and switch_safe_free.
Referenced by switch_pgsql_handle_connect(), and switch_pgsql_handle_destroy().
switch_pgsql_status_t switch_pgsql_handle_exec_base_detailed | ( | const char * | file, |
const char * | func, | ||
int | line, | ||
switch_pgsql_handle_t * | handle, | ||
const char * | sql, | ||
char ** | err | ||
) |
Definition at line 576 of file switch_pgsql.c.
References SWITCH_CHANNEL_ID_LOG, SWITCH_FALSE, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PGSQL_FAIL, switch_pgsql_finish_results, switch_pgsql_flush(), switch_pgsql_handle_get_error(), switch_pgsql_send_query(), SWITCH_PGSQL_SUCCESS, switch_str_nil, switch_stristr(), SWITCH_TRUE, and zstr.
Referenced by switch_pgsql_handle_exec_detailed(), and switch_pgsql_handle_exec_string_detailed().
switch_pgsql_status_t switch_pgsql_handle_exec_detailed | ( | const char * | file, |
const char * | func, | ||
int | line, | ||
switch_pgsql_handle_t * | handle, | ||
const char * | sql, | ||
char ** | err | ||
) |
Definition at line 648 of file switch_pgsql.c.
References SWITCH_PGSQL_FAIL, switch_pgsql_finish_results, and switch_pgsql_handle_exec_base_detailed().
switch_pgsql_status_t switch_pgsql_handle_exec_string_detailed | ( | const char * | file, |
const char * | func, | ||
int | line, | ||
switch_pgsql_handle_t * | handle, | ||
const char * | sql, | ||
char * | resbuf, | ||
size_t | len, | ||
char ** | err | ||
) |
Definition at line 521 of file switch_pgsql.c.
References SWITCH_PGSQL_FAIL, switch_pgsql_finish_results, switch_pgsql_free_result(), switch_pgsql_handle_exec_base_detailed(), switch_pgsql_next_result, and SWITCH_PGSQL_SUCCESS.
char* switch_pgsql_handle_get_error | ( | switch_pgsql_handle_t * | handle | ) |
Definition at line 796 of file switch_pgsql.c.
References switch_strdup.
Referenced by switch_pgsql_handle_callback_exec_detailed(), switch_pgsql_handle_connect(), switch_pgsql_handle_exec_base_detailed(), switch_pgsql_next_result_timed(), switch_pgsql_send_query(), and switch_pgsql_SQLEndTran().
switch_pgsql_state_t switch_pgsql_handle_get_state | ( | switch_pgsql_handle_t * | handle | ) |
Definition at line 787 of file switch_pgsql.c.
References SWITCH_PGSQL_STATE_ERROR, and SWITCH_PGSQL_STATE_INIT.
switch_pgsql_handle_t* switch_pgsql_handle_new | ( | const char * | dsn | ) |
Create a new handle for the PGSQL connection.
dsn | The DSN of the database to connect to. See documentation for PQconnectdb() at http://www.postgresql.org/docs/9.0/static/libpq-connect.html. The DSN MUST be prefixed with 'pgsql;' to use the switch_cache_db* functionality. However, the DSN passed to this function directly MUST NOT be prefixed with 'pgsql;'. |
Definition at line 66 of file switch_pgsql.c.
References DEFAULT_PGSQL_RETRIES, memset(), SWITCH_FALSE, SWITCH_PGSQL_STATE_INIT, switch_safe_free, and SWITCH_TRUE.
Referenced by _switch_cache_db_get_db_handle().
switch_pgsql_status_t switch_pgsql_next_result_timed | ( | switch_pgsql_handle_t * | handle, |
switch_pgsql_result_t ** | result_out, | ||
int | msec | ||
) |
Definition at line 287 of file switch_pgsql.c.
References memset(), SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, SWITCH_LOG_DEBUG, switch_log_printf(), switch_micro_time_now(), switch_pgsql_cancel, SWITCH_PGSQL_FAIL, switch_pgsql_flush(), switch_pgsql_handle_get_error(), SWITCH_PGSQL_STATE_ERROR, SWITCH_PGSQL_SUCCESS, and switch_safe_free.
switch_pgsql_status_t switch_pgsql_send_query | ( | switch_pgsql_handle_t * | handle, |
const char * | sql | ||
) |
Definition at line 246 of file switch_pgsql.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, switch_log_printf(), SWITCH_PGSQL_FAIL, switch_pgsql_finish_results, switch_pgsql_handle_get_error(), SWITCH_PGSQL_SUCCESS, and switch_safe_free.
Referenced by switch_pgsql_handle_exec_base_detailed().
void switch_pgsql_set_num_retries | ( | switch_pgsql_handle_t * | handle, |
int | num_retries | ||
) |
Sets the number of retries if the PGSQL connection fails.
handle | A fully allocated switch_pgsql_handle_t returned from a call to switch_pgsql_handle_new(). |
num_retries | How many times to retry connecting to the database if this connection fails. |
Definition at line 216 of file switch_pgsql.c.
switch_pgsql_status_t switch_pgsql_SQLEndTran | ( | switch_pgsql_handle_t * | handle, |
switch_bool_t | commit | ||
) |
Definition at line 865 of file switch_pgsql.c.
References SWITCH_CHANNEL_LOG, SWITCH_FALSE, SWITCH_LOG_CRIT, switch_log_printf(), SWITCH_PGSQL_FAIL, switch_pgsql_handle_get_error(), SWITCH_PGSQL_SUCCESS, and switch_safe_free.
Referenced by do_trans(), switch_cache_db_persistant_execute_trans_full(), and switch_core_sqldb_start().
switch_pgsql_status_t switch_pgsql_SQLSetAutoCommitAttr | ( | switch_pgsql_handle_t * | handle, |
switch_bool_t | on | ||
) |
Definition at line 828 of file switch_pgsql.c.
References SWITCH_FALSE, SWITCH_PGSQL_SUCCESS, and SWITCH_TRUE.
Referenced by do_trans(), switch_cache_db_persistant_execute_trans_full(), and switch_core_sqldb_start().