[Asterisk-cvs] asterisk/cdr Makefile,1.31,1.32 cdr_tds.c,1.14,1.15

markster markster
Sat Oct 29 14:57:06 CDT 2005


Update of /usr/cvsroot/asterisk/cdr
In directory mongoose.digium.com:/tmp/cvs-serv9569/cdr

Modified Files:
	Makefile cdr_tds.c 
Log Message:
Merge TDS cdr fixes (bug #5517, with slight mods)


Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr/Makefile,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- Makefile	30 Aug 2005 15:59:25 -0000	1.31
+++ Makefile	29 Oct 2005 18:49:25 -0000	1.32
@@ -40,6 +40,15 @@
 # FreeTDS stuff...
 #
 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/tds.h),)
+  ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h | grep -c 0.63),1)
+    CFLAGS += -DFREETDS_0_63
+  else
+	ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h | grep -c 0.62),1)
+      CFLAGS += -DFREETDS_0_62
+    else
+      CFLAGS += -DFREETDS_PRE_0_62
+    endif
+  endif
   MODS+=cdr_tds.so
 endif
 

Index: cdr_tds.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr/cdr_tds.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cdr_tds.c	26 Oct 2005 13:03:17 -0000	1.14
+++ cdr_tds.c	29 Oct 2005 18:49:25 -0000	1.15
@@ -77,8 +77,7 @@
 #include "asterisk/module.h"
 #include "asterisk/logger.h"
 
-#if !defined(TDS_INT_EXIT) 
-#define TDS_PRE_0_62
+#ifdef FREETDS_PRE_0_62
 #warning "You have older TDS, you should upgrade!"
 #endif
 
@@ -111,7 +110,7 @@
 	char *accountcode, *src, *dst, *dcontext, *clid, *channel, *dstchannel, *lastapp, *lastdata, *uniqueid;
 	int res = 0;
 	int retried = 0;
-#ifdef TDS_PRE_0_62
+#ifdef FREETDS_PRE_0_62
 	TDS_INT result_type;
 #endif
 
@@ -205,7 +204,7 @@
 			retried = 1;	/* note that we have now tried */
 		}
 
-#ifdef TDS_PRE_0_62
+#ifdef FREETDS_PRE_0_62
 		if (!connected || (tds_submit_query(tds, sqlcmd) != TDS_SUCCEED) || (tds_process_simple_query(tds, &result_type) != TDS_SUCCEED || result_type != TDS_CMD_SUCCEED))
 #else
 		if (!connected || (tds_submit_query(tds, sqlcmd) != TDS_SUCCEED) || (tds_process_simple_query(tds) != TDS_SUCCEED))
@@ -434,7 +433,11 @@
 
 static int mssql_connect(void)
 {
+#ifdef FREETDS_0_63
+	TDSCONNECTION *connection = NULL;
+#else
 	TDSCONNECTINFO *connection = NULL;
+#endif
 	char query[128];
 
 	/* Connect to M$SQL Server */
@@ -449,7 +452,7 @@
 	tds_set_passwd(login, password);
 	tds_set_app(login, "TSQL");
 	tds_set_library(login, "TDS-Library");
-#ifndef TDS_PRE_0_62
+#ifndef FREETDS_PRE_0_62
 	tds_set_client_charset(login, charset);
 #endif
 	tds_set_language(login, language);
@@ -479,15 +482,23 @@
 	{
 		ast_log(LOG_ERROR, "Failed to connect to MSSQL server.\n");
 		tds = NULL;	/* freed by tds_connect() on error */
+#ifdef FREETDS_0_63
+		tds_free_connection(connection);
+#else
 		tds_free_connect(connection);
+#endif
 		connection = NULL;
 		goto connect_fail;
 	}
+#ifdef FREETDS_0_63
+	tds_free_connection(connection);
+#else
 	tds_free_connect(connection);
+#endif
 	connection = NULL;
 
 	sprintf(query, "USE %s", dbname);
-#ifdef TDS_PRE_0_62
+#ifdef FREETDS_PRE_0_62
 	if ((tds_submit_query(tds, query) != TDS_SUCCEED) || (tds_process_simple_query(tds, &result_type) != TDS_SUCCEED || result_type != TDS_CMD_SUCCEED))
 #else
 	if ((tds_submit_query(tds, query) != TDS_SUCCEED) || (tds_process_simple_query(tds) != TDS_SUCCEED))
@@ -527,7 +538,7 @@
 	struct ast_config *cfg;
 	struct ast_variable *var;
 	char *ptr = NULL;
-#ifdef TDS_PRE_0_62
+#ifdef FREETDS_PRE_0_62
 	TDS_INT result_type;
 #endif
 




More information about the svn-commits mailing list