[Freeswitch-svn] [commit] r4854 - in freeswitch/trunk: src src/include w32/Library

Freeswitch SVN mikej at freeswitch.org
Thu Apr 5 06:07:26 EDT 2007


Author: mikej
Date: Thu Apr  5 06:07:25 2007
New Revision: 4854

Modified:
   freeswitch/trunk/src/include/switch_odbc.h
   freeswitch/trunk/src/include/switch_platform.h
   freeswitch/trunk/src/switch_odbc.c
   freeswitch/trunk/w32/Library/FreeSwitchCore.vcproj

Log:
msvc odbc build

Modified: freeswitch/trunk/src/include/switch_odbc.h
==============================================================================
--- freeswitch/trunk/src/include/switch_odbc.h	(original)
+++ freeswitch/trunk/src/include/switch_odbc.h	Thu Apr  5 06:07:25 2007
@@ -44,7 +44,9 @@
 #endif
 #include <sqltypes.h>
 
-SWITCH_BEGIN_EXTERN_C struct switch_odbc_handle;
+SWITCH_BEGIN_EXTERN_C 
+
+struct switch_odbc_handle;
 
 typedef enum {
 	SWITCH_ODBC_STATE_INIT,
@@ -59,7 +61,7 @@
 	SWITCH_ODBC_FAIL = -1
 } switch_odbc_status_t;
 
-SWITCH_DECLARE(switch_odbc_handle_t) * switch_odbc_handle_new(char *dsn, char *username, char *password);
+SWITCH_DECLARE(switch_odbc_handle_t *) switch_odbc_handle_new(char *dsn, char *username, char *password);
 SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_disconnect(switch_odbc_handle_t *handle);
 SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_handle_t *handle);
 SWITCH_DECLARE(void) switch_odbc_handle_destroy(switch_odbc_handle_t **handlep);
@@ -69,6 +71,7 @@
 																	  char *sql, switch_core_db_callback_func_t callback, void *pdata);
 SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, SQLHSTMT stmt);
 SWITCH_END_EXTERN_C
+
 #endif
 /* For Emacs:
  * Local Variables:

Modified: freeswitch/trunk/src/include/switch_platform.h
==============================================================================
--- freeswitch/trunk/src/include/switch_platform.h	(original)
+++ freeswitch/trunk/src/include/switch_platform.h	Thu Apr  5 06:07:25 2007
@@ -59,6 +59,12 @@
  */
 #pragma warning(disable:4100 4200 4204 4706 4819 4132 4510 4512 4610 4996)
 
+#define SWITCH_HAVE_ODBC 1
+
+#ifdef _MSC_VER
+#  pragma comment(lib, "odbc32.lib")
+#endif
+
 #pragma include_alias(<libteletone.h>,				<../../libs/libteletone/src/libteletone.h>)
 #pragma include_alias(<libteletone_generate.h>,		<../../libs/libteletone/src/libteletone_generate.h>)
 #pragma include_alias(<libteletone_detect.h>,		<../../libs/libteletone/src/libteletone_detect.h>)

Modified: freeswitch/trunk/src/switch_odbc.c
==============================================================================
--- freeswitch/trunk/src/switch_odbc.c	(original)
+++ freeswitch/trunk/src/switch_odbc.c	Thu Apr  5 06:07:25 2007
@@ -28,6 +28,7 @@
  * switch_odbc.c -- ODBC
  *
  */
+#include <switch.h>
 #include <switch_odbc.h>
 
 struct switch_odbc_handle {
@@ -162,7 +163,6 @@
 		return SWITCH_ODBC_SUCCESS;
 	}
 
-	return SWITCH_ODBC_FAIL;
 }
 
 static int db_is_up(switch_odbc_handle_t *handle)
@@ -227,7 +227,7 @@
 
 SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, SQLHSTMT *rstmt)
 {
-	SQLHSTMT stmt;
+	SQLHSTMT stmt = NULL;
 	int result;
 
 	if (!db_is_up(handle)) {
@@ -270,7 +270,7 @@
 SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odbc_handle_t *handle,
 																	  char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
-	SQLHSTMT stmt;
+	SQLHSTMT stmt = NULL;
 	SQLSMALLINT c = 0, x = 0;
 	SQLINTEGER m = 0;
 	int result;
@@ -320,7 +320,7 @@
 			names[y] = malloc(name_len);
 			memset(names[y], 0, name_len);
 
-			SQLDescribeCol(stmt, x, (SQLCHAR *) names[y], name_len, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
+			SQLDescribeCol(stmt, x, (SQLCHAR *) names[y], (SQLSMALLINT)name_len, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
 			ColumnSize++;
 
 			vals[y] = malloc(ColumnSize);

Modified: freeswitch/trunk/w32/Library/FreeSwitchCore.vcproj
==============================================================================
--- freeswitch/trunk/w32/Library/FreeSwitchCore.vcproj	(original)
+++ freeswitch/trunk/w32/Library/FreeSwitchCore.vcproj	Thu Apr  5 06:07:25 2007
@@ -352,6 +352,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\switch_odbc.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\switch_regex.c"
 				>
 			</File>
@@ -418,11 +422,11 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\include\switch_core.h"
+				RelativePath="..\..\src\include\private\switch_core.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\include\private\switch_core.h"
+				RelativePath="..\..\src\include\switch_core.h"
 				>
 			</File>
 			<File
@@ -458,6 +462,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\include\switch_odbc.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\include\switch_platform.h"
 				>
 			</File>



More information about the Freeswitch-svn mailing list