Get ODBC driver to work for iODBC

This commit is contained in:
whydoubt 2004-10-16 14:21:13 +00:00
parent 44fde416d4
commit 26cd3ee1ba
7 changed files with 39 additions and 26 deletions

View File

@ -1,3 +1,11 @@
Sat Oct 16 09:19:16 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
* INSTALL:
* README:
* configure.in:
* include/mdbodbc.h:
* src/odbc/connectparams.c:
* src/odbc/odbc.c: Get ODBC driver to work for iODBC
Fri Sep 24 00:07:10 CDT 2004 Jeff Smith <whydoubt@yahoo.com> Fri Sep 24 00:07:10 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
* doc/install.sgml: Document odbcinst.ini entry * doc/install.sgml: Document odbcinst.ini entry

View File

@ -41,12 +41,15 @@ Installation Options
==================== ====================
configure can be passed any of the following flags to turn on other configure can be passed any of the following flags to turn on other
capabilities. capabilities. Note that the options --with-unixodbc and --with-iodbc are
mutually exclusive.
--enable-sql will cause the SQL engine to be built, you must have flex --enable-sql will cause the SQL engine to be built, you must have flex
and bison (or yacc) installed for this option. and bison (or yacc) installed for this option.
--with-unixodbc specifies the location of the unixODBC driver manager and --with-unixodbc specifies the location of the unixODBC driver manager and
causes the ODBC driver to be built. causes the unixODBC driver to be built.
--with-iodbc specifies the location of the iODBC driver manager and
causes the iODBC driver to be built.
Installation from CVS Sources Installation from CVS Sources

4
README
View File

@ -10,8 +10,8 @@ pieces are:
and data, show the version of the files, and other useful stuff. and data, show the version of the files, and other useful stuff.
. mdb-sql - a command line SQL tool that allows one to type sql queries and . mdb-sql - a command line SQL tool that allows one to type sql queries and
get results. get results.
. odbc - An ODBC driver for use with unixODBC driver manager. Allows . odbc - An ODBC driver for use with unixODBC or iODBC driver manager.
one to use MDB files with PHP for example. Allows one to use MDB files with PHP for example.
. gmdb2 - The Gnome MDB File Viewer and debugger. Still alpha, but making . gmdb2 - The Gnome MDB File Viewer and debugger. Still alpha, but making
great progress. great progress.

View File

@ -60,6 +60,14 @@ if test "$with_iodbc"; then
ODBC_CFLAGS="-I$with_iodbc/include" ODBC_CFLAGS="-I$with_iodbc/include"
ODBC_LIBS="-L$with_iodbc/lib" ODBC_LIBS="-L$with_iodbc/lib"
CFLAGS="$CFLAGS -DIODBC" CFLAGS="$CFLAGS -DIODBC"
OLDLDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $ODBC_LIBS"
AC_CHECK_LIB(iodbcinst, SQLGetPrivateProfileString,
[ODBC_LIBS="$ODBC_LIBS -liodbcinst"
AC_DEFINE_UNQUOTED(HAVE_SQLGETPRIVATEPROFILESTRING, 1,
[Define to 1 if you have the SQLGetPrivateProfileString function.])])
LDFLAGS=$OLDLDFLAGS
fi fi
dnl check for unixODBC dnl check for unixODBC
@ -70,6 +78,14 @@ if test "$with_unixodbc"; then
ODBC_CFLAGS="-I$with_unixodbc/include" ODBC_CFLAGS="-I$with_unixodbc/include"
ODBC_LIBS="-L$with_unixodbc/lib" ODBC_LIBS="-L$with_unixodbc/lib"
CFLAGS="$CFLAGS -DUNIXODBC" CFLAGS="$CFLAGS -DUNIXODBC"
OLDLDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $ODBC_LIBS"
AC_CHECK_LIB(odbcinst, SQLGetPrivateProfileString,
[ODBC_LIBS="$ODBC_LIBS -lodbcinst"
AC_DEFINE_UNQUOTED(HAVE_SQLGETPRIVATEPROFILESTRING, 1,
[Define to 1 if you have the SQLGetPrivateProfileString function.])])
LDFLAGS=$OLDLDFLAGS
fi fi
if test "x$HAVE_ODBC" = "xtrue"; then if test "x$HAVE_ODBC" = "xtrue"; then
@ -79,12 +95,6 @@ if test "x$HAVE_ODBC" = "xtrue"; then
exit 1 exit 1
fi fi
OLDLDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $ODBC_LIBS"
AC_CHECK_LIB(odbcinst, SQLGetPrivateProfileString, [ODBC_LIBS="$ODBC_LIBS -lodbcinst"
AC_DEFINE_UNQUOTED(HAVE_SQLGETPRIVATEPROFILESTRING, 1, [Define to 1 if you have the SQLGetPrivateProfileString function.])])
LDFLAGS=$OLDLDFLAGS
AC_SUBST(ODBC_CFLAGS) AC_SUBST(ODBC_CFLAGS)
AC_SUBST(ODBC_LIBS) AC_SUBST(ODBC_LIBS)
OPTDIRS="$OPTDIRS odbc" OPTDIRS="$OPTDIRS odbc"

View File

@ -22,16 +22,12 @@
#include <mdbtools.h> #include <mdbtools.h>
#include <mdbsql.h> #include <mdbsql.h>
#ifdef UNIXODBC
#include <sql.h> #include <sql.h>
#include <sqlext.h> #include <sqlext.h>
#include <odbcinst.h> #if defined(UNIXODBC)
#elif defined(MDB_NO_DM) # include <odbcinst.h>
#include <sql.h> #elif defined(IODBC)
#include <sqlext.h> # include <iodbcinst.h>
#else /* IODBC */
#include "isql.h"
#include "isqlext.h"
#endif #endif
@ -40,7 +36,7 @@ extern "C" {
#endif #endif
static char rcsid_sql_h [ ] = static char rcsid_sql_h [ ] =
"$Id: mdbodbc.h,v 1.3 2004/03/04 21:25:09 brianb Exp $"; "$Id: mdbodbc.h,v 1.4 2004/10/16 14:21:15 whydoubt Exp $";
static void *no_unused_sql_h_warn[]={rcsid_sql_h, no_unused_sql_h_warn}; static void *no_unused_sql_h_warn[]={rcsid_sql_h, no_unused_sql_h_warn};
struct _henv { struct _henv {

View File

@ -93,7 +93,7 @@ void FreeConnectParams (ConnectParams* params)
} }
#if !HAVE_SQLGETPRIVATEPROFILESTRING #if !HAVE_SQLGETPRIVATEPROFILESTRING
int LoadDSN ( static int LoadDSN (
const gchar* iniFileName, const gchar* dsnName, GHashTable* table) const gchar* iniFileName, const gchar* dsnName, GHashTable* table)
{ {
FILE* stream; FILE* stream;
@ -500,6 +500,7 @@ static gboolean cleanup (gpointer key, gpointer value, gpointer user_data)
#define ODBCINST_PROMPTTYPE_COMBOBOX 3 #define ODBCINST_PROMPTTYPE_COMBOBOX 3
#define ODBCINST_PROMPTTYPE_FILENAME 4 #define ODBCINST_PROMPTTYPE_FILENAME 4
#define ODBCINST_PROMPTTYPE_HIDDEN 5 #define ODBCINST_PROMPTTYPE_HIDDEN 5
#define ODBCINST_PROMPTTYPE_TEXTEDIT_PASSWORD 6
typedef struct tODBCINSTPROPERTY typedef struct tODBCINSTPROPERTY
{ {

View File

@ -17,13 +17,8 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifdef UNIXODBC
#include <sql.h> #include <sql.h>
#include <sqlext.h> #include <sqlext.h>
#else
#include "isql.h"
#include "isqlext.h"
#endif
#include <mdbodbc.h> #include <mdbodbc.h>
@ -32,7 +27,7 @@
#include "connectparams.h" #include "connectparams.h"
static char software_version[] = "$Id: odbc.c,v 1.24 2004/09/23 05:07:12 whydoubt Exp $"; static char software_version[] = "$Id: odbc.c,v 1.25 2004/10/16 14:21:16 whydoubt Exp $";
static void *no_unused_var_warn[] = {software_version, static void *no_unused_var_warn[] = {software_version,
no_unused_var_warn}; no_unused_var_warn};