[asterisk-commits] juggie: branch group/NoLossCDR-Redux2 r104867 - /team/group/NoLossCDR-Redux2/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 27 18:02:19 CST 2008


Author: juggie
Date: Wed Feb 27 18:02:19 2008
New Revision: 104867

URL: http://svn.digium.com/view/asterisk?view=rev&rev=104867
Log:
update cdr_odbc

Modified:
    team/group/NoLossCDR-Redux2/cdr/cdr_odbc.c

Modified: team/group/NoLossCDR-Redux2/cdr/cdr_odbc.c
URL: http://svn.digium.com/view/asterisk/team/group/NoLossCDR-Redux2/cdr/cdr_odbc.c?view=diff&rev=104867&r1=104866&r2=104867
==============================================================================
--- team/group/NoLossCDR-Redux2/cdr/cdr_odbc.c (original)
+++ team/group/NoLossCDR-Redux2/cdr/cdr_odbc.c Wed Feb 27 18:02:19 2008
@@ -128,10 +128,11 @@
 {
 	struct odbc_obj *obj = ast_odbc_request_obj(dsn, 0);
 	SQLHSTMT stmt;
+	int res = 0;
 
 	if (!obj) {
 		ast_log(LOG_ERROR, "Unable to retrieve database handle.  CDR failed.\n");
-		return -1;
+		return AST_CDR_POST_FAILED;
 	}
 
 	stmt = ast_odbc_prepare_and_execute(obj, prepare_cb, cdr);
@@ -141,12 +142,18 @@
 		SQLRowCount(stmt, &rows);
 		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 
-		if (rows == 0)
+		if (rows == 0) {
 			ast_log(LOG_WARNING, "CDR successfully ran, but inserted 0 rows?\n");
-	} else
+			res = AST_CDR_POST_FAILED;
+		} else {
+			res = AST_CDR_POST_OK;
+		}
+	} else {
 		ast_log(LOG_ERROR, "CDR prepare or execute failed\n");
+		res = AST_CDR_POST_FAILED;
+	}
 	ast_odbc_release_obj(obj);
-	return 0;
+	return res;
 }
 
 static int odbc_load_module(int reload)




More information about the asterisk-commits mailing list