+++ /dev/null
-#-------------------------------------------------------------------------
-#
-# 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
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+# 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
#include "lobj.h"
#include "dlg_specific.h"
-#ifdef MULTIBYTE
#include "multibyte.h"
-#endif
#include "pgapifunc.h"
#include "md5.h"
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;
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;
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);
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);
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)
{
/*
* Multibyte handling is available ?
*/
-#ifdef MULTIBYTE
if (PG_VERSION_GE(self, 6.4))
{
CC_lookup_characterset(self);
return 0;
}
#endif /* UNICODE_SUPPORT */
-#endif /* MULTIBYTE */
ci->updatable_cursors = 0;
#ifdef DRIVER_CURSOR_IMPLEMENT
if (!ci->drivers.use_declarefetch &&
typedef ProtocolVersion MsgType;
-#define PG_PROTOCOL(m,n) (((m) << 16) | (n))
#define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678)
typedef struct CancelRequestPacket
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 */
#include <string.h>
#include <ctype.h>
-#ifdef MULTIBYTE
#include "multibyte.h"
-#endif
#include <time.h>
#ifdef HAVE_LOCALE_H
BOOL proc_no_param;
unsigned int declare_pos;
UInt4 flags;
-#ifdef MULTIBYTE
encoded_str encstr;
-#endif /* MULTIBYTE */
} QueryParse;
static int
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;
}
|| ';' == 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.
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)
{
/*
* From here we are guaranteed to handle a 1-byte character.
*/
-#else
- oldchar = qp->statement[qp->opos];
-#endif
if (qp->in_escape) /* escape check */
{
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;
out = 0,
max;
char *p = NULL;
-#ifdef MULTIBYTE
encoded_str encstr;
-#endif
-
if (used == SQL_NTS)
max = strlen(si);
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)
{
out++;
continue;
}
-#endif
if (convlf && si[i] == '\r' && si[i + 1] == '\n')
continue;
else if (si[i] == '\'' || si[i] == '\\')
#include "convert.h"
-#ifdef MULTIBYTE
#include "multibyte.h"
-#endif
#include "pgapifunc.h"
#ifndef BOOL
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);
#include "convert.h"
-#ifdef MULTIBYTE
#include "multibyte.h"
-#endif
#include "pgapifunc.h"
#ifndef BOOL
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
-
-#if HAVE_PWD_H
#include <pwd.h>
-#endif
#include <sys/types.h>
#include <string.h>
#include "misc.h"
#include "pgtypes.h"
#include "pgapifunc.h"
-#ifdef MULTIBYTE
#include "multibyte.h"
-#endif
/* Trigger related stuff for SQLForeign Keys */
int i, outlen;
const char *in;
BOOL escape_in = FALSE;
-#ifdef MULTIBYTE
encoded_str encstr;
-#endif
if (srclen == SQL_NULL_DATA)
{
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)
}
-#ifdef MULTIBYTE
/*
* Multibyte support stuff for SQLForeignKeys().
* There may be much more effective way in the
}
return ret;
}
-#endif /* MULTIBYTE */
RETCODE SQL_API
PGAPI_ForeignKeys(
*fkey_text;
ConnectionClass *conn;
-#ifdef MULTIBYTE
BOOL pkey_alloced,
fkey_alloced;
-#endif /* MULTIBYTE */
int i,
j,
k,
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
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;
{
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));
#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++)
{
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));
#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++)
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);
#include <string.h>
#ifndef WIN32
-#if HAVE_PWD_H
#include <pwd.h>
-#endif
#include <sys/types.h>
#include <unistd.h>
#else
#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);
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;
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 */
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)
stmt->from_pos = -1;
stmt->where_pos = -1;
-#ifdef MULTIBYTE
while (pptr = ptr, (ptr = getNextToken(conn->ccsc, pptr, token, sizeof(token), &delim, "e, &dquote, &numeric)) != NULL)
-#else
- while (pptr = ptr, (ptr = getNextToken(pptr, token, sizeof(token), &delim, "e, &dquote, &numeric)) != NULL)
-#endif
{
unquoted = !(quote || dquote);
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);
}
}
if (conn->unicode || conn->ms_jet)
return attlen;
#if (ODBCVER >= 0x0300)
-#ifdef MULTIBYTE
return attlen;
-#endif /* MULTIBYTE */
#endif /* ODBCVER */
return p;
}
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;
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;
*
* 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 $
*
*/
#define __PSQLODBC_H__
#ifndef WIN32
-#include "pg_config.h"
+#include "config.h"
#else
#include <windows.h>
#endif
#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 */
/* 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 */