Added Unix build environment as supplied by Peter Eisentraut.
authorDave Page <dpage@pgadmin.org>
Wed, 16 Oct 2002 07:39:54 +0000 (07:39 +0000)
committerDave Page <dpage@pgadmin.org>
Wed, 16 Oct 2002 07:39:54 +0000 (07:39 +0000)
15 files changed:
GNUmakefile [deleted file]
Makefile.am [new file with mode: 0644]
configure.ac [new file with mode: 0644]
connection.c
connection.h
convert.c
dlg_specific.c
dlg_wingui.c
gpps.c
info.c
misc.c
parse.c
pgtypes.c
psqlodbc.h
setup.c

diff --git a/GNUmakefile b/GNUmakefile
deleted file mode 100644 (file)
index 599a188..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#-------------------------------------------------------------------------
-#
-# GNUMakefile for psqlodbc (Postgres ODBC driver)
-#
-# $Header: /home/heikki/psqlodbc-cvs-copy/psqlodbc/Attic/GNUmakefile,v 1.23 2001/11/12 00:54:28 inoue Exp $
-#
-#-------------------------------------------------------------------------
-
-subdir = src/interfaces/odbc
-top_builddir = ../../..
-include $(top_builddir)/src/Makefile.global
-
-# Shared library parameters
-ifeq ($(with_unixodbc),yes)
-NAME = odbcpsql
-else
-NAME = psqlodbc
-endif
-SO_MAJOR_VERSION = 0
-SO_MINOR_VERSION = 27
-
-override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -DFRONTEND -DMD5_ODBC
-
-
-OBJS = info.o bind.o columninfo.o connection.o convert.o drvconn.o \
-        environ.o execute.o lobj.o md5.o misc.o options.o \
-        pgtypes.o psqlodbc.o qresult.o results.o socket.o parse.o statement.o \
-        tuple.o tuplelist.o dlg_specific.o odbcapi.o
-
-ifdef MULTIBYTE
-OBJS += multibyte.o
-endif
-
-SHLIB_LINK += $(filter -lm -lnsl -lsocket, $(LIBS))
-ifeq ($(with_unixodbc),yes)
-SHLIB_LINK += -lodbcinst
-endif
-ifeq ($(with_iodbc),yes)
-SHLIB_LINK += -liodbcinst
-endif
-ifeq ($(with_unixodbc)$(with_iodbc),nono)
-OBJS += gpps.o
-override CPPFLAGS += -DODBCINSTDIR='"$(odbcinst_ini_dir)"'
-endif
-
-all: all-lib odbc-drop.sql
-
-# Shared library stuff
-include $(top_srcdir)/src/Makefile.shlib
-
-# Symbols must be resolved to the version in the shared library because
-# the driver manager (e.g., iodbc) provides some symbols with the same
-# names and we don't want those.  (This issue is probably ELF specific.)
-LINK.shared += $(shlib_symbolic)
-
-odbc-drop.sql: odbc.sql
-   sed -n '/^CREATE OR REPLACE FUNCTION/s/CREATE OR REPLACE FUNCTION \([^ (][^ (]*([^)]*)\).*/DROP FUNCTION \1;/p' $< >$@
-
-install: all installdirs
-   $(INSTALL_DATA) $(srcdir)/odbc.sql $(DESTDIR)$(datadir)/odbc.sql
-   $(INSTALL_DATA) odbc-drop.sql $(DESTDIR)$(datadir)/odbc-drop.sql
-   $(MAKE) install-lib
-
-installdirs:
-   $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(datadir)
-
-uninstall: uninstall-lib
-   rm -f $(DESTDIR)$(datadir)/odbc.sql $(DESTDIR)$(datadir)/odbc-drop.sql
-
-clean distclean maintainer-clean: clean-lib
-   rm -f $(OBJS)
-   rm -f odbc-drop.sql
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..d810d13
--- /dev/null
@@ -0,0 +1,52 @@
+#-------------------------------------------------------------------------
+#
+# Makefile.am for psqlodbc (PostgreSQL ODBC driver)
+#
+# $Header: /home/heikki/psqlodbc-cvs-copy/psqlodbc/Makefile.am,v 1.1 2002/10/16 07:39:53 dpage Exp $
+#
+#-------------------------------------------------------------------------
+
+AUTOMAKE_OPTIONS = 1.6 foreign
+
+lib_LTLIBRARIES = psqlodbc.la
+
+psqlodbc_la_LDFLAGS = -module -no-undefined -avoid-version
+
+psqlodbc_la_SOURCES = \
+   info.c bind.c columninfo.c connection.c convert.c drvconn.c \
+   environ.c execute.c lobj.c win_md5.c misc.c options.c \
+   pgtypes.c psqlodbc.c qresult.c results.c socket.c parse.c \
+   statement.c tuple.c tuplelist.c dlg_specific.c odbcapi.c \
+   multibyte.c \
+   gpps.c
+
+psqlodbc_la_SOURCES += \
+   bind.h columninfo.h connection.h convert.h descriptor.h \
+   dlg_specific.h environ.h gpps.h iodbc.h isql.h isqlext.h \
+   lobj.h md5.h misc.h multibyte.h pgapifunc.h pgtypes.h \
+   psqlodbc.h qresult.h resource.h socket.h statement.h tuple.h \
+   tuplelist.h version.h
+
+EXTRA_psqlodbc_la_SOURCES = md5.c
+
+if with_unixodbc
+psqlodbc_la_LIBADD = -lodbcinst
+else
+if with_iodbc
+psqlodbc_la_LIBADD = -liodbcinst
+else
+AM_CPPFLAGS = -DODBCINSTDIR='"$(odbcinst_ini_dir)"'
+endif
+endif
+
+dist_pkgdata_DATA = odbc.sql odbc-drop.sql
+BUILT_SOURCES = odbc-drop.sql
+
+EXTRA_DIST = license.txt notice.txt readme.txt odbcinst.ini libtool.m4
+MAINTAINERCLEANFILES = odbc-drop.sql \
+   Makefile.in config.guess config.h.in config.sub configure \
+   install-sh missing mkinstalldirs aclocal.m4 ltmain.sh \
+   libtool.m4 depcomp
+
+$(srcdir)/odbc-drop.sql: $(srcdir)/odbc.sql
+   sed -n '/^CREATE OR REPLACE FUNCTION/s/CREATE OR REPLACE FUNCTION \([^ (][^ (]*([^)]*)\).*/DROP FUNCTION \1;/p' $(srcdir)/odbc.sql >$(srcdir)/odbc-drop.sql
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..437565f
--- /dev/null
@@ -0,0 +1,47 @@
+# Process this file with autoconf to produce a configure script.
+AC_INIT(psqlodbc, 7.2.3, [pgsql-odbc@postgresql.org])
+AC_PREREQ(2.52)
+AM_INIT_AUTOMAKE
+AC_CONFIG_SRCDIR([bind.c])
+AM_CONFIG_HEADER([config.h])
+AM_MAINTAINER_MODE
+
+
+PGAC_ARG_BOOL(with, unixodbc, no,
+              [  --with-unixodbc         build ODBC driver for unixODBC],
+              [AC_DEFINE(WITH_UNIXODBC, 1,
+                         [Define to 1 to build with unixODBC support (--with-unixodbc)])])
+
+PGAC_ARG_BOOL(with, iodbc, no,
+              [  --with-iodbc            build ODBC driver for iODBC],
+              [AC_DEFINE(WITH_IODBC, 1,
+                         [Define to 1 to build with iODBC support (--with-iodbc)])])
+
+if test "$with_unixodbc" = yes && test "$with_iodbc" = yes; then
+  AC_MSG_ERROR([ODBC driver cannot be built for both unixODBC and iODBC])
+fi
+
+AM_CONDITIONAL(with_unixodbc, [test $with_unixodbc = yes])
+AM_CONDITIONAL(with_iodbc, [test $with_iodbc = yes])
+
+# Allow for overriding the default location of the odbcinst.ini
+# file which is normally ${sysconfdir} (i.e., ${prefix}/etc).
+PGAC_ARG_REQ(with, odbcinst,
+             [  --with-odbcinst=DIR     default directory for odbcinst.ini [sysconfdir]],
+             [odbcinst_ini_dir=$withval],
+             [odbcinst_ini_dir="\${sysconfdir}"])
+AC_SUBST([odbcinst_ini_dir])
+
+AC_PROG_CC
+
+AC_LIBTOOL_WIN32_DLL
+AC_DISABLE_STATIC
+AC_LIBTOOL_DLOPEN
+AC_PROG_LIBTOOL
+
+AC_CHECK_HEADERS([locale.h])
+AC_CHECK_TYPES(uint8)
+PGAC_VAR_INT_TIMEZONE
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
index 0cf0d723cf1003e79793d9601afc986762369973..328c439cae6be4d03166e21620dd8d16366c0906 100644 (file)
@@ -30,9 +30,7 @@
 #include "lobj.h"
 #include "dlg_specific.h"
 
-#ifdef MULTIBYTE
 #include "multibyte.h"
-#endif
 
 #include "pgapifunc.h"
 #include "md5.h"
@@ -294,10 +292,8 @@ CC_Constructor()
        rv->result_uncommitted = 0;
        rv->schema_support = 0;
        rv->isolation = SQL_TXN_READ_COMMITTED;
-#ifdef MULTIBYTE
        rv->client_encoding = NULL;
        rv->server_encoding = NULL;
-#endif   /* MULTIBYTE */
        rv->current_schema = NULL;
 
 
@@ -502,14 +498,12 @@ CC_cleanup(ConnectionClass *self)
    self->status = CONN_NOT_CONNECTED;
    self->transact_status = CONN_IN_AUTOCOMMIT;
    CC_conninfo_init(&(self->connInfo));
-#ifdef MULTIBYTE
    if (self->client_encoding)
        free(self->client_encoding);
    self->client_encoding = NULL;
    if (self->server_encoding)
        free(self->server_encoding);
    self->server_encoding = NULL;
-#endif   /* MULTIBYTE */
    if (self->current_schema)
        free(self->current_schema);
    self->current_schema = NULL;
@@ -623,10 +617,7 @@ CC_connect(ConnectionClass *self, char password_req, char *salt_para)
    char        msgbuffer[ERROR_MSG_LENGTH];
    char        salt[5], notice[512];
    static char *func = "CC_connect";
-
-#ifdef MULTIBYTE
    char       *encoding;
-#endif   /* MULTIBYTE */
 
    mylog("%s: entering...\n", func);
 
@@ -654,7 +645,6 @@ CC_connect(ConnectionClass *self, char password_req, char *salt_para)
             ci->drivers.bools_as_char,
             TABLE_NAME_STORAGE_LEN);
 
-#ifdef MULTIBYTE
        encoding = check_client_encoding(ci->conn_settings);
        if (encoding && strcmp(encoding, "OTHER"))
            self->client_encoding = strdup(encoding);
@@ -670,11 +660,6 @@ CC_connect(ConnectionClass *self, char password_req, char *salt_para)
             ci->drivers.extra_systable_prefixes,
             ci->drivers.conn_settings,
             encoding ? encoding : "");
-#else
-       qlog("                extra_systable_prefixes='%s', conn_settings='%s'\n",
-            ci->drivers.extra_systable_prefixes,
-            ci->drivers.conn_settings);
-#endif
 
        if (self->status != CONN_NOT_CONNECTED)
        {
@@ -960,7 +945,6 @@ another_version_retry:
    /*
     *  Multibyte handling is available ?
     */
-#ifdef MULTIBYTE
    if (PG_VERSION_GE(self, 6.4))
    {
        CC_lookup_characterset(self);
@@ -1002,7 +986,6 @@ another_version_retry:
        return 0;
    }
 #endif /* UNICODE_SUPPORT */
-#endif /* MULTIBYTE */
    ci->updatable_cursors = 0;
 #ifdef DRIVER_CURSOR_IMPLEMENT
    if (!ci->drivers.use_declarefetch &&
index 186fac5de021b206ff39e003a1f31d2ceefa2e6e..9993da47f4f57c10a5759d069060ae403be72452 100644 (file)
@@ -154,7 +154,6 @@ typedef struct _StartupPacket6_2
 
 typedef ProtocolVersion MsgType;
 
-#define PG_PROTOCOL(m,n)   (((m) << 16) | (n))
 #define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678)
 
 typedef struct CancelRequestPacket
@@ -315,10 +314,8 @@ struct ConnectionClass_
    char        unicode;
    char        result_uncommitted;
    char        schema_support;
-#ifdef MULTIBYTE
    char        *client_encoding;
    char        *server_encoding;
-#endif   /* MULTIBYTE */
    int     ccsc;
    int     be_pid; /* pid returned by backend */
    int     be_key; /* auth code needed to send cancel */
index c2f95d2b90d37a4d27d20fdd72f388ab590ec45c..811740b7e6f42b3d6e0f5905875699dede603a71 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -23,9 +23,7 @@
 #include <string.h>
 #include <ctype.h>
 
-#ifdef MULTIBYTE
 #include "multibyte.h"
-#endif
 
 #include <time.h>
 #ifdef HAVE_LOCALE_H
@@ -1233,9 +1231,7 @@ typedef struct _QueryParse {
    BOOL        proc_no_param;
    unsigned    int declare_pos;
    UInt4       flags;
-#ifdef MULTIBYTE
    encoded_str encstr;
-#endif   /* MULTIBYTE */
 }  QueryParse;
 
 static int
@@ -1254,9 +1250,7 @@ QP_initialize(QueryParse *q, const StatementClass *stmt)
    q->proc_no_param = TRUE;
    q->declare_pos = 0;
    q->flags = 0;
-#ifdef MULTIBYTE
    make_encoded_str(&q->encstr, SC_get_conn(stmt), q->statement);
-#endif   /* MULTIBYTE */
 
    return q->stmt_len;
 }
@@ -1649,11 +1643,8 @@ insert_without_target(const char *stmt, int *endpos)
        || ';' == wstmt[0];
 }
 
-#ifdef MULTIBYTE
 #define        my_strchr(conn, s1,c1) pg_mbschr(conn->ccsc, s1,c1)
-#else
-#define        my_strchr(conn, s1,c1) strchr(s1,c1)
-#endif
+
 /*
  * This function inserts parameters into an SQL statements.
  * It will also modify a SELECT statement for use with declare/fetch cursors.
@@ -1880,7 +1871,6 @@ inner_process_tokens(QueryParse *qp, QueryBuild *qb)
            CVT_APPEND_DATA(qb, qp->statement + qp->from_pos + 5, qp->where_pos - qp->from_pos - 5);
        }
    }
-#ifdef MULTIBYTE
    oldchar = encoded_byte_check(&qp->encstr, qp->opos);
    if (ENCODE_STATUS(qp->encstr) != 0)
    {
@@ -1891,9 +1881,6 @@ inner_process_tokens(QueryParse *qp, QueryBuild *qb)
    /*
     * From here we are guaranteed to handle a 1-byte character.
     */
-#else
-   oldchar = qp->statement[qp->opos];
-#endif
 
    if (qp->in_escape)          /* escape check */
    {
@@ -2710,10 +2697,8 @@ processParameters(QueryParse *qp, QueryBuild *qb,
        retval = inner_process_tokens(qp, qb);
        if (retval == SQL_ERROR)
            return retval;
-#ifdef MULTIBYTE
        if (ENCODE_STATUS(qp->encstr) != 0)
            continue;
-#endif
        if (qp->in_dquote || qp->in_quote || qp->in_escape)
            continue;
 
@@ -3161,10 +3146,7 @@ convert_special_chars(const char *si, char *dst, int used, BOOL convlf, int ccsc
                out = 0,
                max;
    char       *p = NULL;
-#ifdef MULTIBYTE
    encoded_str encstr;
-#endif
-
 
    if (used == SQL_NTS)
        max = strlen(si);
@@ -3175,13 +3157,10 @@ convert_special_chars(const char *si, char *dst, int used, BOOL convlf, int ccsc
        p = dst;
        p[0] = '\0';
    }
-#ifdef MULTIBYTE
    encoded_str_constr(&encstr, ccsc, si);
-#endif
 
    for (i = 0; i < max && si[i]; i++)
    {
-#ifdef MULTIBYTE
        encoded_nextchar(&encstr);
        if (ENCODE_STATUS(encstr) != 0)
        {
@@ -3190,7 +3169,6 @@ convert_special_chars(const char *si, char *dst, int used, BOOL convlf, int ccsc
            out++;
            continue;
        }
-#endif
        if (convlf && si[i] == '\r' && si[i + 1] == '\n')
            continue;
        else if (si[i] == '\'' || si[i] == '\\')
index 4f96a6f7c561ad9b15a0a98a9ee105147f1f49fe..f65b878296c4111dac0edc1afaf4785aba0744ee 100644 (file)
@@ -21,9 +21,7 @@
 
 #include "convert.h"
 
-#ifdef MULTIBYTE
 #include "multibyte.h"
-#endif
 #include "pgapifunc.h"
 
 #ifndef BOOL
@@ -535,16 +533,10 @@ getDSNinfo(ConnInfo *ci, char overwrite)
         ci->fake_oid_index,
         ci->show_system_tables);
 
-#ifdef MULTIBYTE
    check_client_encoding(ci->conn_settings);
    qlog("          conn_settings='%s',conn_encoding='%s'\n",
         ci->conn_settings,
         check_client_encoding(ci->conn_settings));
-#else
-   qlog("          conn_settings='%s'\n",
-        ci->conn_settings);
-#endif
-
    qlog("          translation_dll='%s',translation_option='%s'\n",
         ci->translation_dll,
         ci->translation_option);
index 1eb304a1268d51c50314bfecb70446e1b6004eba..07c4136e03a7d975609c33969449bd17e335f073 100644 (file)
@@ -22,9 +22,7 @@
 
 #include "convert.h"
 
-#ifdef MULTIBYTE
 #include "multibyte.h"
-#endif
 #include "pgapifunc.h"
 
 #ifndef BOOL
diff --git a/gpps.c b/gpps.c
index ee73a23eb4e6bbb7e02ea19c02a2482d317d2f5d..5f6be62907277b3ac8982dccd3618fd8870fb1ed 100644 (file)
--- a/gpps.c
+++ b/gpps.c
 #include <stdio.h>
 #include <unistd.h>
 #include <ctype.h>
-
-#if HAVE_PWD_H
 #include <pwd.h>
-#endif
 
 #include <sys/types.h>
 #include <string.h>
diff --git a/info.c b/info.c
index e633137693dfefc0c0e64b2e33c28d43bc3101ce..f130f9d97cf1900370ecc5cf6e6a14df8d63a978 100644 (file)
--- a/info.c
+++ b/info.c
@@ -37,9 +37,7 @@
 #include "misc.h"
 #include "pgtypes.h"
 #include "pgapifunc.h"
-#ifdef MULTIBYTE
 #include "multibyte.h"
-#endif
 
 
 /* Trigger related stuff for SQLForeign Keys */
@@ -1517,9 +1515,7 @@ reallyEscapeCatalogEscapes(const char *src, int srclen, char *dest, int dst_len,
    int i, outlen;
    const char *in;
    BOOL    escape_in = FALSE;
-#ifdef MULTIBYTE
    encoded_str encstr;
-#endif
 
    if (srclen == SQL_NULL_DATA)
    {
@@ -1530,19 +1526,15 @@ reallyEscapeCatalogEscapes(const char *src, int srclen, char *dest, int dst_len,
        srclen = strlen(src);
    if (srclen <= 0)
        return STRCPY_FAIL;
-#ifdef MULTIBYTE
    encoded_str_constr(&encstr, ccsc, src);
-#endif
    for (i = 0, in = src, outlen = 0; i < srclen && outlen < dst_len; i++, in++)
    {
-#ifdef MULTIBYTE
                 encoded_nextchar(&encstr);
                 if (ENCODE_STATUS(encstr) != 0)
                 {
                         dest[outlen++] = *in;
                         continue;
                 }
-#endif
        if (escape_in)
        {
            switch (*in)
@@ -2977,7 +2969,6 @@ PGAPI_PrimaryKeys(
 }
 
 
-#ifdef MULTIBYTE
 /*
  * Multibyte support stuff for SQLForeignKeys().
  * There may be much more effective way in the
@@ -3201,7 +3192,6 @@ getClientColumnName(ConnectionClass *conn, UInt4 relid, char *serverColumnName,
    }
    return ret;
 }
-#endif   /* MULTIBYTE */
 
 RETCODE        SQL_API
 PGAPI_ForeignKeys(
@@ -3246,10 +3236,8 @@ char     schema_fetched[SCHEMA_NAME_STORAGE_LEN + 1];
               *fkey_text;
 
    ConnectionClass *conn;
-#ifdef MULTIBYTE
    BOOL        pkey_alloced,
                fkey_alloced;
-#endif   /* MULTIBYTE */
    int         i,
                j,
                k,
@@ -3348,10 +3336,8 @@ char     schema_fetched[SCHEMA_NAME_STORAGE_LEN + 1];
    make_string(szFkTableName, cbFkTableName, fk_table_needed);
 
    conn = SC_get_conn(stmt);
-#ifdef MULTIBYTE
    pkey_text = fkey_text = NULL;
    pkey_alloced = fkey_alloced = FALSE;
-#endif   /* MULTIBYTE */
 
    /*
     * Case #2 -- Get the foreign keys in the specified table (fktab) that
@@ -3620,21 +3606,15 @@ if (conn->schema_support)
                    num_keys = 0;
                    break;
                }
-#ifdef MULTIBYTE
                pkey_text = getClientColumnName(conn, relid2, pkey_ptr, &pkey_alloced);
-#else
-               pkey_text = pkey_ptr;
-#endif   /* MULTIBYTE */
                mylog("%s: pkey_ptr='%s', pkey='%s'\n", func, pkey_text, pkey);
                if (strcmp(pkey_text, pkey))
                {
                    num_keys = 0;
                    break;
                }
-#ifdef MULTIBYTE
                if (pkey_alloced)
                    free(pkey_text);
-#endif   /* MULTIBYTE */
                /* Get to next primary key */
                for (k = 0; k < 2; k++)
                    pkey_ptr += strlen(pkey_ptr) + 1;
@@ -3688,13 +3668,9 @@ if (conn->schema_support)
            {
                row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField));
 
-#ifdef MULTIBYTE
                pkey_text = getClientColumnName(conn, relid2, pkey_ptr, &pkey_alloced);
                fkey_text = getClientColumnName(conn, relid1, fkey_ptr, &fkey_alloced);
-#else
-               pkey_text = pkey_ptr;
-               fkey_text = fkey_ptr;
-#endif   /* MULTIBYTE */
+
                mylog("%s: pk_table = '%s', pkey_ptr = '%s'\n", func, pk_table_fetched, pkey_text);
                set_tuplefield_null(&row->tuple[0]);
                set_tuplefield_string(&row->tuple[1], GET_SCHEMA_NAME(schema_fetched));
@@ -3719,14 +3695,12 @@ if (conn->schema_support)
 #endif   /* ODBCVER >= 0x0300 */
 
                QR_add_tuple(res, row);
-#ifdef MULTIBYTE
                if (fkey_alloced)
                    free(fkey_text);
                fkey_alloced = FALSE;
                if (pkey_alloced)
                    free(pkey_text);
                pkey_alloced = FALSE;
-#endif   /* MULTIBYTE */
                /* next primary/foreign key */
                for (i = 0; i < 2; i++)
                {
@@ -3996,13 +3970,9 @@ if (conn->schema_support)
 
            for (k = 0; k < num_keys; k++)
            {
-#ifdef MULTIBYTE
                pkey_text = getClientColumnName(conn, relid1, pkey_ptr, &pkey_alloced);
                fkey_text = getClientColumnName(conn, relid2, fkey_ptr, &fkey_alloced);
-#else
-               pkey_text = pkey_ptr;
-               fkey_text = fkey_ptr;
-#endif   /* MULTIBYTE */
+
                mylog("pkey_ptr = '%s', fk_table = '%s', fkey_ptr = '%s'\n", pkey_text, fk_table_fetched, fkey_text);
 
                row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField));
@@ -4036,14 +4006,12 @@ if (conn->schema_support)
 #endif   /* ODBCVER >= 0x0300 */
 
                QR_add_tuple(res, row);
-#ifdef MULTIBYTE
                if (pkey_alloced)
                    free(pkey_text);
                pkey_alloced = FALSE;
                if (fkey_alloced)
                    free(fkey_text);
                fkey_alloced = FALSE;
-#endif   /* MULTIBYTE */
 
                /* next primary/foreign key */
                for (j = 0; j < 2; j++)
@@ -4062,12 +4030,10 @@ if (conn->schema_support)
        PGAPI_FreeStmt(htbl_stmt, SQL_DROP);
        return SQL_ERROR;
    }
-#ifdef MULTIBYTE
    if (pkey_alloced)
        free(pkey_text);
    if (fkey_alloced)
        free(fkey_text);
-#endif   /* MULTIBYTE */
 
    PGAPI_FreeStmt(htbl_stmt, SQL_DROP);
 
diff --git a/misc.c b/misc.c
index ea8f2563a1f1523e12b5dad8406ebfd249d825fc..05f8eaeb4798eb7089c7356f7236e80067862d41 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -19,9 +19,7 @@
 #include <string.h>
 
 #ifndef WIN32
-#if HAVE_PWD_H
 #include <pwd.h>
-#endif
 #include <sys/types.h>
 #include <unistd.h>
 #else
diff --git a/parse.c b/parse.c
index 8d52341181e18f58e4f0f8719f0a6cb8e1ea2a99..a72c3fc1866aa837691d5cb4339ea57ff4fa3508 100644 (file)
--- a/parse.c
+++ b/parse.c
 #include "pgtypes.h"
 #include "pgapifunc.h"
 
-#ifdef MULTIBYTE
 #include "multibyte.h"
-#endif
 
 #define FLD_INCR   32
 #define TAB_INCR   8
 #define COL_INCR   16
 
-#ifdef MULTIBYTE
 char      *getNextToken(int ccsc, char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric);
-#else
-char      *getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric);
-#endif /* MULTIBYTE */
 void       getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k);
 char       searchColInfo(COL_INFO *col_info, FIELD_INFO *fi);
 
@@ -76,18 +70,14 @@ Int4 FI_scale(const FIELD_INFO *fi)
 
 char *
 getNextToken(
-#ifdef MULTIBYTE
    int ccsc, /* client encoding */
-#endif /* MULTIBYTE */
    char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric)
 {
    int         i = 0;
    int         out = 0;
    char        qc,
                in_escape = FALSE;
-#ifdef MULTIBYTE
    encoded_str encstr;
-#endif
 
    if (smax <= 1)
        return NULL;
@@ -114,20 +104,16 @@ getNextToken(
    if (numeric)
        *numeric = FALSE;
 
-#ifdef MULTIBYTE
    encoded_str_constr(&encstr, ccsc, &s[i]);
-#endif
    /* get the next token */
    while (s[i] != '\0' && out < smax)
    {
-#ifdef MULTIBYTE
        encoded_nextchar(&encstr);
        if (ENCODE_STATUS(encstr) != 0)
        {
            token[out++] = s[i++];
            continue;
        }
-#endif
        if (isspace((unsigned char) s[i]) || s[i] == ',')
            break;
        /* Handle quoted stuff */
@@ -148,14 +134,12 @@ getNextToken(
            i++;                /* dont return the quote */
            while (s[i] != '\0' && out != smax)
            {
-#ifdef MULTIBYTE
                encoded_nextchar(&encstr);
                if (ENCODE_STATUS(encstr) != 0)
                {
                    token[out++] = s[i++];
                    continue;
                }
-#endif
                if (s[i] == qc && !in_escape)
                    break;
                if (s[i] == '\\' && !in_escape)
@@ -360,11 +344,7 @@ parse_statement(StatementClass *stmt)
    stmt->from_pos = -1;
    stmt->where_pos = -1;
 
-#ifdef MULTIBYTE
    while (pptr = ptr, (ptr = getNextToken(conn->ccsc, pptr, token, sizeof(token), &delim, &quote, &dquote, &numeric)) != NULL)
-#else
-   while (pptr = ptr, (ptr = getNextToken(pptr, token, sizeof(token), &delim, &quote, &dquote, &numeric)) != NULL)
-#endif
    {
        unquoted = !(quote || dquote);
 
@@ -707,20 +687,16 @@ parse_statement(StatementClass *stmt)
                if (!dquote)
                {
                    char       *ptr;
-#ifdef MULTIBYTE
                    encoded_str encstr;
                    make_encoded_str(&encstr, conn, ti[stmt->ntab]->name);
-#endif   /* MULTIBYTE */
 
                    /* lower case table name */
                    for (ptr = ti[stmt->ntab]->name; *ptr; ptr++)
                    {
-#ifdef MULTIBYTE
                        encoded_nextchar(&encstr);
                        if (ENCODE_STATUS(encstr) != 0)
                            ptr++;
                        else
-#endif   /* MULTIBYTE */
                            *ptr = tolower((unsigned char) *ptr);
                    }
                }
index bd89eac421e6edd2fdb2f8072204a195e47ef5ea..5d0b421311b1a21def34fa10fc78aa569d6a8adc 100644 (file)
--- a/pgtypes.c
+++ b/pgtypes.c
@@ -706,9 +706,7 @@ getCharColumnSize(StatementClass *stmt, Int4 type, int col, int handle_unknown_s
                if (conn->unicode || conn->ms_jet)
                    return attlen;
 #if (ODBCVER >= 0x0300)
-#ifdef MULTIBYTE
                return attlen;
-#endif /* MULTIBYTE */
 #endif /* ODBCVER */
                return p;
        }
@@ -1000,12 +998,10 @@ pgtype_buffer_length(StatementClass *stmt, Int4 type, int col, int handle_unknow
            Int4    prec = pgtype_column_size(stmt, type, col, handle_unknown_size_as), maxvarc;
            if (conn->unicode)
                return prec * 2;
-#ifdef MULTIBYTE
            /* after 7.2 */
            if (PG_VERSION_GE(conn, 7.2))
                coef = 3;
            else
-#endif   /* MULTIBYTE */
            if ((conn->connInfo).lf_conversion)
                /* CR -> CR/LF */
                coef = 2;
@@ -1079,12 +1075,10 @@ pgtype_transfer_octet_length(StatementClass *stmt, Int4 type, int col, int handl
        case PG_TYPE_BPCHAR:
            if (conn->unicode)
                return prec * 2;
-#ifdef MULTIBYTE
            /* after 7.2 */
            if (PG_VERSION_GE(conn, 7.2))
                coef = 3;
            else
-#endif   /* MULTIBYTE */
            if ((conn->connInfo).lf_conversion)
                /* CR -> CR/LF */
                coef = 2;
index 68365cd748f70b57f9426c0afba05785a78bf646..2c3b7f70c5ee8eaa868d8a6c47a9266e767e6ac5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Comments:       See "notice.txt" for copyright and license information.
  *
- * $Id: psqlodbc.h,v 1.71 2002/09/23 08:08:21 hinoue Exp $
+ * $Id: psqlodbc.h,v 1.72 2002/10/16 07:39:53 dpage Exp $
  *
  */
 
@@ -13,7 +13,7 @@
 #define __PSQLODBC_H__
 
 #ifndef WIN32
-#include "pg_config.h"
+#include "config.h"
 #else
 #include <windows.h>
 #endif
@@ -117,9 +117,8 @@ typedef UInt4 Oid;
 #endif   /* WIN32 */
 
 /* Limits */
-#ifdef WIN32
 #define BLCKSZ                     4096
-#endif
+#define MAXPGPATH                  1024
 
 #define MAX_MESSAGE_LEN                65536       /* This puts a limit on
                                                 * query size but I don't */
diff --git a/setup.c b/setup.c
index 7320cbba58e9eee0f111de8d546585feccd5fc38..9fad9dba46ed9102d01bc488987cdcae330db647 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -32,10 +32,6 @@ extern GLOBAL_VALUES globals;
 /* Constants */
 #define MIN(x,y)     ((x) < (y) ? (x) : (y))
 
-#ifdef WIN32
-#define MAXPGPATH      (255+1)
-#endif
-
 #define MAXKEYLEN      (15+1)  /* Max keyword length */
 #define MAXDESC            (255+1) /* Max description length */
 #define MAXDSNAME      (32+1)  /* Max data source name length */