Support --disable-glib flag with ODBC driver

This commit is contained in:
Evan Miller
2020-08-10 15:58:22 -04:00
parent d4f7bd6ec5
commit 3c7761f965
7 changed files with 126 additions and 6 deletions

View File

@@ -51,7 +51,7 @@ extern int SQLGetPrivateProfileString( LPCSTR lpszSection,
int cbRetBuffer,
LPCSTR lpszFilename);
#else
static GString* GetIniFileName ();
static GString* GetIniFileName (void);
static int FileExists (const gchar* name);
static int FindSection (FILE* stream, const char* section);
static int GetNextItem (FILE* stream, char** name, char** value);

View File

@@ -19,7 +19,11 @@
#ifndef _connectparams_h_
#define _connectparams_h_
#ifdef HAVE_GLIB
#include <glib.h>
#else
#include <mdbfakeglib.h>
#endif
typedef struct
{
@@ -28,7 +32,7 @@ typedef struct
GHashTable* table;
} ConnectParams;
ConnectParams* NewConnectParams ();
ConnectParams* NewConnectParams (void);
void FreeConnectParams (ConnectParams* params);
gboolean LookupDSN (ConnectParams* params, const gchar* dsnName);

View File

@@ -25,6 +25,7 @@
#include <sqlext.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>
#include "mdbodbc.h"
//#define TRACE(x) fprintf(stderr,"Function %s\n", x);
@@ -101,7 +102,7 @@ TypeInfo type_info[] = {
#define MAX_TYPE_INFO 11
#ifdef ENABLE_ODBC_W
void my_fini();
void my_fini(void);
MDB_CONSTRUCTOR(my_init)
{
@@ -784,7 +785,7 @@ static SQLRETURN SQL_API _SQLDescribeCol(
strcpy(sqlState, "HY090"); // Invalid string or buffer length
return SQL_ERROR;
}
if (snprintf(szColName, cbColNameMax, "%s", sqlcol->name) + 1 > cbColNameMax) {
if (snprintf((char *)szColName, cbColNameMax, "%s", sqlcol->name) + 1 > cbColNameMax) {
strcpy(sqlState, "01004"); // String data, right truncated
ret = SQL_SUCCESS_WITH_INFO;
}