msvc odbc build

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4854 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-04-05 10:07:25 +00:00
parent 18b782a000
commit 90d2d377e2
4 changed files with 25 additions and 8 deletions

View File

@ -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 @@ typedef enum {
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 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
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:

View File

@ -59,6 +59,12 @@ SWITCH_BEGIN_EXTERN_C
*/
#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>)

View File

@ -28,6 +28,7 @@
* switch_odbc.c -- ODBC
*
*/
#include <switch.h>
#include <switch_odbc.h>
struct switch_odbc_handle {
@ -162,7 +163,6 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_hand
return SWITCH_ODBC_SUCCESS;
}
return SWITCH_ODBC_FAIL;
}
static int db_is_up(switch_odbc_handle_t *handle)
@ -227,7 +227,7 @@ static int db_is_up(switch_odbc_handle_t *handle)
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_exec(switch_odbc_handle_
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 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
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);

View File

@ -351,6 +351,10 @@
RelativePath="..\..\src\switch_log.c"
>
</File>
<File
RelativePath="..\..\src\switch_odbc.c"
>
</File>
<File
RelativePath="..\..\src\switch_regex.c"
>
@ -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
@ -457,6 +461,10 @@
RelativePath="..\..\src\include\switch_module_interfaces.h"
>
</File>
<File
RelativePath="..\..\src\include\switch_odbc.h"
>
</File>
<File
RelativePath="..\..\src\include\switch_platform.h"
>