# Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment
-AC_INIT([freeswitch], [1.3.5b], bugs@freeswitch.org)
+AC_INIT([freeswitch], [1.3.5], bugs@freeswitch.org)
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [3])
-AC_SUBST(SWITCH_VERSION_MICRO, [5b])
+AC_SUBST(SWITCH_VERSION_MICRO, [5])
AC_SUBST(SWITCH_VERSION_REVISION, [])
AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t **dbh)
{
if (dbh && *dbh) {
+
+ switch((*dbh)->type) {
+ case SCDB_TYPE_PGSQL:
+ {
+ switch_pgsql_flush((*dbh)->native_handle.pgsql_dbh);
+ }
+ break;
+ default:
+ break;
+ }
+
switch_mutex_lock(sql_manager.dbh_mutex);
(*dbh)->last_used = switch_epoch_time_now(NULL);
switch (type) {
case SCDB_TYPE_PGSQL:
{
- db_name = connection_options->odbc_options.dsn;
+ db_name = connection_options->pgsql_options.dsn;
odbc_user = NULL;
odbc_pass = NULL;
}
ret = SWITCH_PGSQL_FAIL;
}
PQfreeCancel(cancel);
- {
- PGresult *tmp = NULL;
- /* Make sure the query is fully cancelled */
- while ((tmp = PQgetResult(handle->con)) != NULL) PQclear(tmp);
- }
+ switch_pgsql_flush(handle);
+
#endif
return ret;
}
return SWITCH_PGSQL_SUCCESS;
error:
- {
- PGresult *tmp = NULL;
- /* Make sure the failed connection does not have any transactions marked as in progress */
- while ((tmp = PQgetResult(handle->con)) != NULL) PQclear(tmp);
- /* Try to reconnect to the DB if we were dropped */
- db_is_up(handle);
- }
+ /* Make sure the failed connection does not have any transactions marked as in progress */
+ switch_pgsql_flush(handle);
+
+ /* Try to reconnect to the DB if we were dropped */
+ db_is_up(handle);
+
#endif
return SWITCH_PGSQL_FAIL;
}
#ifdef SWITCH_HAVE_PGSQL
char *err_str = NULL, *er = NULL;
+
+
+ switch_pgsql_flush(handle);
handle->affected_rows = 0;
if (!db_is_up(handle)) {
#endif
}
+SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_flush(switch_pgsql_handle_t *handle)
+{
+#ifdef SWITCH_HAVE_PGSQL
+
+ PGresult *tmp = NULL;
+ int x = 0;
+
+ /* Make sure the query is fully cleared */
+ while ((tmp = PQgetResult(handle->con)) != NULL) {
+ PQclear(tmp);
+ x++;
+ }
+
+ if (x) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Flushing %d results\n", x);
+ }
+
+ return SWITCH_PGSQL_SUCCESS;
+#else
+ return (switch_pgsql_status_t) SWITCH_FALSE;
+#endif
+}
+
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_SQLEndTran(switch_pgsql_handle_t *handle, switch_bool_t commit)
{
#ifdef SWITCH_HAVE_PGSQL