]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9611 [mod_odbc_cdr] fix sql insert failed do not write csv file and csv Duplicate...
authordingding <cdevelop@qq.com>
Wed, 5 Oct 2016 04:36:44 +0000 (12:36 +0800)
committerdingding <cdevelop@qq.com>
Wed, 5 Oct 2016 04:36:44 +0000 (12:36 +0800)
src/mod/event_handlers/mod_odbc_cdr/mod_odbc_cdr.c

index 5ce035811ffeefe31d2fee9a4844494bba233297..6bdfe7ef3b353ad1659c360cf5db8ccac0d83891 100644 (file)
@@ -308,22 +308,22 @@ static switch_status_t odbc_cdr_reporting(switch_core_session_t *session)
                                if (globals.debug_sql == SWITCH_TRUE) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "sql %s\n", sql);
                                }
-                               if (odbc_cdr_execute_sql_no_callback(sql) == SWITCH_STATUS_FALSE) {
+                               if (odbc_cdr_execute_sql_no_callback(sql) != SWITCH_STATUS_SUCCESS) {
                                        insert_fail = SWITCH_TRUE;
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error executing query %s\n", sql);
                                }
 
                                if (globals.write_csv == ODBC_CDR_CSV_ALWAYS) {
                                        if (insert_fail == SWITCH_TRUE) {
-                                               full_path = switch_mprintf("%s%s%s.csv", globals.csv_fail_path, SWITCH_PATH_SEPARATOR, uuid);
+                                               full_path = switch_mprintf("%s%s%s_%s.csv", globals.csv_fail_path, SWITCH_PATH_SEPARATOR, uuid, table_name);
                                        } else {
-                                               full_path = switch_mprintf("%s%s%s.csv", globals.csv_path, SWITCH_PATH_SEPARATOR, uuid);
+                                               full_path = switch_mprintf("%s%s%s_%s.csv", globals.csv_path, SWITCH_PATH_SEPARATOR, uuid, table_name);
                                        }
                                        assert(full_path);
                                        write_cdr(full_path, stream_value.data);
                                        switch_safe_free(full_path);
                                } else if (globals.write_csv == ODBC_CDR_CSV_ON_FAIL && insert_fail == SWITCH_TRUE) {
-                                       full_path = switch_mprintf("%s%s%s.csv", globals.csv_fail_path, SWITCH_PATH_SEPARATOR, uuid);
+                                       full_path = switch_mprintf("%s%s%s_%s.csv", globals.csv_fail_path, SWITCH_PATH_SEPARATOR, uuid, table_name);
                                        assert(full_path);
                                        write_cdr(full_path, stream_value.data);
                                        switch_safe_free(full_path);