mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 20:31:00 +08:00
Moved ODBC ConnectParams into struct _hdbc
So now struct _hdbc contains the real allocated data. SQLAllocConnect doesn't hack it anymore with its own stucture.
This commit is contained in:
parent
eefddaffcc
commit
aac9c61536
@ -30,6 +30,7 @@
|
||||
# include <iodbcinst.h>
|
||||
#endif
|
||||
|
||||
#include "connectparams.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -40,6 +41,7 @@ struct _henv {
|
||||
};
|
||||
struct _hdbc {
|
||||
struct _henv *henv;
|
||||
ConnectParams* params;
|
||||
};
|
||||
struct _hstmt {
|
||||
struct _hdbc *hdbc;
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "mdbodbc.h"
|
||||
#include "connectparams.h"
|
||||
|
||||
//#define TRACE(x) fprintf(stderr,"Function %s\n", x);
|
||||
#define TRACE(x)
|
||||
@ -185,16 +184,6 @@ static void LogError (const char* error)
|
||||
lastError[_MAX_ERROR_LEN] = '\0'; /* in case we had a long message */
|
||||
}
|
||||
|
||||
/*
|
||||
* Driver specific connectionn information
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct _hdbc hdbc;
|
||||
ConnectParams* params;
|
||||
} ODBCConnection;
|
||||
|
||||
static SQLRETURN do_connect (
|
||||
SQLHDBC hdbc,
|
||||
char *database)
|
||||
@ -226,7 +215,7 @@ static SQLRETURN SQL_API _SQLDriverConnect(
|
||||
TRACE("_SQLDriverConnect");
|
||||
strcpy (lastError, "");
|
||||
|
||||
params = ((ODBCConnection*) hdbc)->params;
|
||||
params = ((struct _hdbc*) hdbc)->params;
|
||||
|
||||
if ((dsn = ExtractDSN (params, (gchar*)szConnStrIn))) {
|
||||
if (!LookupDSN (params, dsn)){
|
||||
@ -550,12 +539,12 @@ static SQLRETURN SQL_API _SQLAllocConnect(
|
||||
SQLHDBC *phdbc)
|
||||
{
|
||||
struct _henv *env;
|
||||
ODBCConnection* dbc;
|
||||
struct _hdbc* dbc;
|
||||
|
||||
TRACE("_SQLAllocConnect");
|
||||
env = (struct _henv *) henv;
|
||||
dbc = (SQLHDBC) g_malloc0(sizeof (ODBCConnection));
|
||||
dbc->hdbc.henv=env;
|
||||
dbc = (SQLHDBC) g_malloc0(sizeof(struct _hdbc));
|
||||
dbc->henv=env;
|
||||
|
||||
dbc->params = NewConnectParams ();
|
||||
*phdbc=dbc;
|
||||
@ -683,7 +672,7 @@ static SQLRETURN SQL_API _SQLConnect(
|
||||
TRACE("_SQLConnect");
|
||||
strcpy (lastError, "");
|
||||
|
||||
params = ((ODBCConnection*) hdbc)->params;
|
||||
params = ((struct _hdbc*) hdbc)->params;
|
||||
|
||||
params->dsnName = g_string_assign (params->dsnName, (gchar*)szDSN);
|
||||
|
||||
@ -1212,7 +1201,7 @@ SQLRETURN SQL_API SQLFreeHandle(
|
||||
static SQLRETURN SQL_API _SQLFreeConnect(
|
||||
SQLHDBC hdbc)
|
||||
{
|
||||
ODBCConnection* dbc = (ODBCConnection*) hdbc;
|
||||
struct _hdbc* dbc = (struct _hdbc*) hdbc;
|
||||
|
||||
TRACE("_SQLFreeConnect");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user