#
# GNUMakefile for psqlodbc (Postgres ODBC driver)
#
-# $Header: /home/heikki/psqlodbc-cvs-copy/psqlodbc/Attic/GNUmakefile,v 1.19 2001/09/11 23:27:10 petere Exp $
+# $Header: /home/heikki/psqlodbc-cvs-copy/psqlodbc/Attic/GNUmakefile,v 1.20 2001/09/22 22:54:32 petere Exp $
#
#-------------------------------------------------------------------------
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) -DHAVE_CONFIG_H -DODBCINSTDIR='"$(odbcinst_ini_dir)"'
+override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -DODBCINSTDIR='"$(odbcinst_ini_dir)"'
OBJS = info.o bind.o columninfo.o connection.o convert.o drvconn.o \
environ.o execute.o lobj.o misc.o options.o \
pgtypes.o psqlodbc.o qresult.o results.o socket.o parse.o statement.o \
- gpps.o tuple.o tuplelist.o dlg_specific.o odbcapi.o $(OBJX)
+ tuple.o tuplelist.o dlg_specific.o odbcapi.o
ifdef MULTIBYTE
OBJS += multibyte.o
endif
-SHLIB_LINK = $(filter -lm -lnsl -lsocket, $(LIBS))
+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
+endif
all: all-lib
#include <stdlib.h>
#include <string.h>
-#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#include "isqlext.h"
-#else
-#include "sql.h"
-#include "sqlext.h"
-#endif
#include "pgapifunc.h"
*/
/* Multibyte support Eiji Tokuya 2001-03-15 */
+#include "connection.h"
+
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#include "connection.h"
-
#include "environ.h"
#include "socket.h"
#include "statement.h"
#include "multibyte.h"
#endif
-#ifdef WIN32
-#include <odbcinst.h>
-#endif
#include "pgapifunc.h"
#define STMT_INCREMENT 16 /* how many statement holders to allocate
#include <stdlib.h>
#include <string.h>
-#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#include "isqlext.h"
-#else
-#include <windows.h>
-#include <sql.h>
-#include <sqlext.h>
-#endif
-
typedef enum
{
*/
/* Multibyte support Eiji Tokuya 2001-03-15 */
+#include "convert.h"
+
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#include "psqlodbc.h"
#ifdef MULTIBYTE
#include "multibyte.h"
#endif
-#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#include "isqlext.h"
-#else
-#include <windows.h>
-#include <sql.h>
-#include <sqlext.h>
-#endif
-
-#include "convert.h"
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include "connection.h"
#include "pgapifunc.h"
-#ifndef WIN32
-#ifndef HAVE_STRICMP
-#define stricmp(s1,s2) strcasecmp(s1,s2)
-#define strnicmp(s1,s2,n) strncasecmp(s1,s2,n)
-#endif
-#ifndef SCHAR
-typedef signed char SCHAR;
-
-#endif
-#endif
-
/*
* How to map ODBC scalar functions {fn func(args)} to Postgres.
*/
/* Multibyte support Eiji Tokuya 2001-03-15 */
-#include "psqlodbc.h"
-
-#ifndef WIN32
-#include <string.h>
-#include "gpps.h"
-#define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
-#define SQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d)
-#ifndef HAVE_STRICMP
-#define stricmp(s1,s2) strcasecmp(s1,s2)
-#define strnicmp(s1,s2,n) strncasecmp(s1,s2,n)
-#endif
-#endif
-
#include "dlg_specific.h"
+
#include "convert.h"
#ifdef MULTIBYTE
#include "connection.h"
#ifdef WIN32
-#include <windows.h>
#include <windowsx.h>
-#include <odbcinst.h>
#include "resource.h"
#endif
#define NEAR
#else
#include <winsock.h>
-#include <sqlext.h>
#endif
#include <string.h>
-#ifndef WIN32
-#define stricmp(s1,s2) strcasecmp(s1,s2)
-#define strnicmp(s1,s2,n) strncasecmp(s1,s2,n)
-#else
-#include <windows.h>
+#ifdef WIN32
#include <windowsx.h>
-#include <odbcinst.h>
#include "resource.h"
#endif
#include "pgapifunc.h"
#include "psqlodbc.h"
-#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#include "isqlext.h"
-#else
-#include <windows.h>
-#include <sql.h>
-#include <sqlext.h>
-#endif
-
#define ENV_ALLOC_ERROR 1
/********** Environment Handle *************/
*/
#include "psqlodbc.h"
+
#include <stdio.h>
#include <string.h>
-#ifndef WIN32
-#include "iodbc.h"
-#include "isqlext.h"
-#else
-#include <windows.h>
-#include <sqlext.h>
-#endif
-
#include "connection.h"
#include "statement.h"
#include "qresult.h"
*-------
*/
-#ifndef WIN32
+#if !defined(WIN32) && !defined(WITH_UNIXODBC) && !defined(WITH_IODBC)
#include "gpps.h"
#ifndef WIN32
#include <sys/types.h>
-#include "iodbc.h"
#endif
+#define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
+#define SQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d)
+
#ifdef __cplusplus
extern "C"
{
#include <stdio.h>
#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#include "isqlext.h"
#include <ctype.h>
-#else
-#include <windows.h>
-#include <sql.h>
-#include <sqlext.h>
-
-#include <odbcinst.h>
#endif
#include "tuple.h"
char column_name[MAX_INFO_STRING],
relhasrules[MAX_INFO_STRING];
char **column_names = 0;
- Int4 column_name_len;
+ SQLINTEGER column_name_len;
int total_columns = 0;
char error = TRUE;
ConnInfo *ci;
*/
#include "lobj.h"
-#include "psqlodbc.h"
+
#include "connection.h"
#endif
-/* Undefine these because windows.h will redefine and cause a warning */
-
-#ifdef WIN32
-#undef va_start
-#undef va_end
-#endif
-
-#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#else
-#include <windows.h>
-#include <sql.h>
-#endif
-
/*
* returns STRCPY_FAIL, STRCPY_TRUNCATED, or #bytes copied
#include "psqlodbc.h"
-#ifndef WIN32
-#include "gpps.h"
-#define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
-#endif
-
#include <stdio.h>
/* Uncomment MY_LOG define to compile in the mylog() statements.
#include <stdio.h>
#include <string.h>
-#ifndef WIN32
-#include "iodbc.h"
-#include "isqlext.h"
-#else
-#include <windows.h>
-#include <sqlext.h>
-#endif
#include "pgapifunc.h"
#include "connection.h"
#include "statement.h"
#include <stdio.h>
#include <string.h>
-#ifndef WIN32
-#include "iodbc.h"
-#include "isqlext.h"
-#else
-#include <windows.h>
-#include <sqlext.h>
-#endif
#include "environ.h"
#include "connection.h"
#include "statement.h"
#include "psqlodbc.h"
#include <string.h>
-#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#include "isqlext.h"
-#else
-#include <windows.h>
-#include <sql.h>
-#include <sqlext.h>
-#endif
-
#include "environ.h"
#include "connection.h"
#include "statement.h"
#include "multibyte.h"
#endif
-#ifndef WIN32
-#ifndef HAVE_STRICMP
-#define stricmp(s1,s2) strcasecmp(s1,s2)
-#define strnicmp(s1,s2,n) strncasecmp(s1,s2,n)
-#endif
-#endif
-
#define FLD_INCR 32
#define TAB_INCR 8
#define COL_INCR 16
#include <stdio.h>
#include <string.h>
-#ifndef WIN32
-#include "iodbc.h"
-#include "isqlext.h"
-#else
-#include <windows.h>
-#include <sqlext.h>
-#endif
RETCODE SQL_API PGAPI_AllocConnect(HENV EnvironmentHandle,
HDBC FAR *ConnectionHandle);
#include "connection.h"
#include "qresult.h"
-#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#include "isqlext.h"
-#else
-#include <windows.h>
-#include <sql.h>
-#include <sqlext.h>
-#endif
-
Int4 getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
#include "psqlodbc.h"
#include "dlg_specific.h"
-#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#include "isqlext.h"
-#else
+#ifdef WIN32
#include <winsock.h>
-#include <windows.h>
-#include <sql.h>
-#include <odbcinst.h>
#endif
GLOBAL_VALUES globals;
*
* Comments: See "notice.txt" for copyright and license information.
*
- * $Id: psqlodbc.h,v 1.48 2001/09/08 16:20:16 inoue Exp $
+ * $Id: psqlodbc.h,v 1.49 2001/09/22 22:54:33 petere Exp $
*
*/
#ifndef __PSQLODBC_H__
#define __PSQLODBC_H__
-#ifdef HAVE_CONFIG_H
+#ifndef WIN32
#include "pg_config.h"
+#else
+#include <windows.h>
#endif
#include <stdio.h> /* for FILE* pointers: see GLOBAL_VALUES */
+/* Must come before sql.h */
+#define ODBCVER 0x0250
+
+
+#if defined(WIN32) || defined(WITH_UNIXODBC) || defined(WITH_IODBC)
+#include <sql.h>
+#include <sqlext.h>
+#else
+#include "iodbc.h"
+#include "isql.h"
+#include "isqlext.h"
+#endif
+
+#if defined(WIN32)
+#include <odbcinst.h>
+#elif defined(WITH_UNIXODBC)
+#include <odbcinst.h>
+#elif defined(WITH_IODBC)
+#include <iodbcinst.h>
+#else
+#include "gpps.h"
+#endif
+
#ifndef WIN32
#define Int4 long int
#define UInt4 unsigned int
#define Int2 short
#define UInt2 unsigned short
+
+#if !defined(WITH_UNIXODBC) && !defined(WITH_IODBC)
typedef float SFLOAT;
typedef double SDOUBLE;
+#endif
+
+#ifndef CALLBACK
+#define CALLBACK
+#endif
#else
#define Int4 int
typedef UInt4 Oid;
+#ifndef WIN32
+#define stricmp strcasecmp
+#define strnicmp strncasecmp
+#endif
+
/* Driver stuff */
-#define ODBCVER 0x0250
#define DRIVER_ODBC_VER "02.50"
#define DRIVERNAME "PostgreSQL ODBC"
*/
#include "qresult.h"
+
#include "misc.h"
#include <stdio.h>
#include <string.h>
#include <stdio.h>
-#ifndef WIN32
-#include "iodbc.h"
-#include "isqlext.h"
-#else
-#include <windows.h>
-#include <sqlext.h>
-#endif
#include "pgapifunc.h"
*/
#include "psqlodbc.h"
+
#include "connection.h"
-#include <windows.h>
#include <windowsx.h>
-#include <odbcinst.h>
#include <string.h>
#include <stdlib.h>
#include "resource.h"
*/
#include "socket.h"
+
#include "connection.h"
#ifndef WIN32
#define SOCKETFD SOCKET
#endif
-#include "psqlodbc.h"
-
#define SOCKET_ALREADY_CONNECTED 1
#define SOCKET_HOST_NOT_FOUND 2
#define SOCKET_COULD_NOT_CREATE_SOCKET 3
*/
#include "statement.h"
+
#include "bind.h"
#include "connection.h"
#include "qresult.h"
#include <string.h>
#include <ctype.h>
-#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#else
-#include <windows.h>
-#include <sql.h>
-#endif
#include "pgapifunc.h"
-#ifndef WIN32
-#ifndef HAVE_STRICMP
-#define stricmp(s1,s2) strcasecmp(s1,s2)
-#define strnicmp(s1,s2,n) strncasecmp(s1,s2,n)
-#endif
-#endif
#define PRN_NULLCHECK
#define __STATEMENT_H__
#include "psqlodbc.h"
-#include "bind.h"
-#ifndef WIN32
-#include "iodbc.h"
-#include "isql.h"
-#else
-#include <windows.h>
-#include <sql.h>
-#endif
+#include "bind.h"
#ifndef FALSE
*/
#include "tuple.h"
+
#include <string.h>
#include <stdlib.h>
*/
#include "tuplelist.h"
+
#include <stdlib.h>
#include "tuple.h"