33 #ifndef SWITCH_PGSQL_H
34 #define SWITCH_PGSQL_H
38 #define DEFAULT_PGSQL_RETRIES 120
42 struct switch_pgsql_handle;
43 struct switch_pgsql_result;
99 #define switch_pgsql_cancel(handle) switch_pgsql_cancel_real(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, handle)
102 #define switch_pgsql_next_result(h, r) switch_pgsql_next_result_timed(h, r, 10000)
107 #define switch_pgsql_finish_results(handle) switch_pgsql_finish_results_real(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, handle)
111 #define switch_pgsql_handle_exec_base(handle, sql, err) switch_pgsql_handle_exec_base_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, handle, sql, err)
117 #define switch_pgsql_handle_exec(handle, sql, err) switch_pgsql_handle_exec_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, handle, sql, err)
121 #define switch_pgsql_handle_exec_string(handle, sql, resbuf, len, err) switch_pgsql_handle_exec_string_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, handle, sql, resbuf, len, err)
151 #define switch_pgsql_handle_callback_exec(handle, sql, callback, pdata, err) \
152 switch_pgsql_handle_callback_exec_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, \
153 handle, sql, callback, pdata, err)
switch_bool_t switch_pgsql_available(void)
#define SWITCH_END_EXTERN_C
void switch_pgsql_set_num_retries(switch_pgsql_handle_t *handle, int num_retries)
Sets the number of retries if the PGSQL connection fails.
struct switch_pgsql_handle switch_pgsql_handle_t
switch_pgsql_state_t switch_pgsql_handle_get_state(switch_pgsql_handle_t *handle)
switch_pgsql_status_t switch_pgsql_SQLEndTran(switch_pgsql_handle_t *handle, switch_bool_t commit)
switch_pgsql_status_t switch_pgsql_SQLSetAutoCommitAttr(switch_pgsql_handle_t *handle, switch_bool_t on)
int(* switch_core_db_callback_func_t)(void *pArg, int argc, char **argv, char **columnNames)
void switch_pgsql_free_result(switch_pgsql_result_t **result)
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)
switch_pgsql_status_t switch_pgsql_cancel_real(const char *file, const char *func, int line, switch_pgsql_handle_t *handle)
struct switch_pgsql_result switch_pgsql_result_t
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)
switch_pgsql_status_t switch_pgsql_flush(switch_pgsql_handle_t *handle)
switch_pgsql_status_t switch_pgsql_finish_results_real(const char *file, const char *func, int line, switch_pgsql_handle_t *handle)
switch_pgsql_status_t switch_pgsql_send_query(switch_pgsql_handle_t *handle, const char *sql)
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.
int switch_pgsql_handle_affected_rows(switch_pgsql_handle_t *handle)
switch_pgsql_handle_t * switch_pgsql_handle_new(const char *dsn)
Create a new handle for the PGSQL connection.
switch_pgsql_status_t switch_pgsql_handle_disconnect(switch_pgsql_handle_t *handle)
Disconnects a PGSQL connection from the database.
char * switch_pgsql_handle_get_error(switch_pgsql_handle_t *handle)
void switch_pgsql_handle_destroy(switch_pgsql_handle_t **handlep)
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 initi...
switch_pgsql_status_t switch_pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pgsql_result_t **result_out, int seconds)
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)
#define SWITCH_BEGIN_EXTERN_C