Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit364a7eb

Browse files
committed
Provide some initial support for building the ODBC driver for
an already installed iODBC or unixODBC driver manager. In particular,use the include files provided by the driver manager over our own,and use the odbcinst library of the driver manager rather than gpps.c.Migrate portability sections common to several files into psqlodbc.h.
1 parent39ceaa1 commit364a7eb

39 files changed

+605
-656
lines changed

‎configure

Lines changed: 497 additions & 436 deletions
Large diffs are not rendered by default.

‎configure.in

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,23 @@ fi
567567

568568
AC_MSG_CHECKING([whether to build the ODBC driver])
569569
PGAC_ARG_BOOL(enable, odbc, no, [ --enable-odbc build the ODBC driver package])
570-
AC_MSG_RESULT([$enable_odbc])
570+
PGAC_ARG_BOOL(with, unixodbc, no, [ --with-unixodbc build ODBC driver for unixODBC])
571+
PGAC_ARG_BOOL(with, iodbc, no, [ --with-iodbc build ODBC driver for iODBC])
572+
if test "$with_unixodbc" = yes && test "$with_iodbc" = yes; then
573+
AC_MSG_ERROR([ODBC driver cannot be built for both unixODBC and iODBC])
574+
fi
575+
if test "$with_unixodbc" = yes || test "$with_iodbc" = yes; then
576+
enable_odbc=yes
577+
fi
578+
case $enable_odbc:$with_unixodbc:$with_iodbc in
579+
yes:no:no) AC_MSG_RESULT([yes (stand-alone)]);;
580+
yes:yes:no) AC_MSG_RESULT([yes (unixODBC)]); AC_DEFINE(WITH_UNIXODBC);;
581+
yes:no:yes) AC_MSG_RESULT([yes (iODBC)]); AC_DEFINE(WITH_IODBC);;
582+
no:*) AC_MSG_RESULT(no);;
583+
esac
571584
AC_SUBST([enable_odbc])
585+
AC_SUBST([with_unixodbc])
586+
AC_SUBST([with_iodbc])
572587

573588

574589
# Allow for overriding the default location of the odbcinst.ini

‎src/Makefile.global.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-makefile-*-
2-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.138 2001/09/17 23:00:27 petere Exp $
2+
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.139 2001/09/22 22:54:32 petere Exp $
33

44
#------------------------------------------------------------------------------
55
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -127,6 +127,8 @@ with_tcl= @with_tcl@
127127
enable_pltcl_unknown= @enable_pltcl_unknown@
128128
with_tk= @with_tk@
129129
enable_odbc= @enable_odbc@
130+
with_iodbc= @with_iodbc@
131+
with_unixodbc= @with_unixodbc@
130132
MULTIBYTE= @MULTIBYTE@
131133
enable_shared= @enable_shared@
132134
enable_rpath= @enable_rpath@

‎src/Makefile.shlib

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Copyright (c) 1998, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.53 2001/09/11 23:20:41 petere Exp $
9+
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.54 2001/09/22 22:54:32 petere Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -263,6 +263,7 @@ ifeq ($(PORTNAME), beos)
263263
SHLIB_LINK+= -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
264264
endif
265265

266+
SHLIB_LINK := $(filter -L%, $(LDFLAGS)) $(SHLIB_LINK)
266267
ifeq ($(enable_rpath), yes)
267268
SHLIB_LINK += $(rpath)
268269
endif

‎src/include/pg_config.h.in

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* or in pg_config.h afterwards. Of course, if you edit pg_config.h, then your
99
* changes will be overwritten the next time you run configure.
1010
*
11-
* $Id: pg_config.h.in,v 1.6 2001/09/14 10:36:52 ishii Exp $
11+
* $Id: pg_config.h.in,v 1.7 2001/09/22 22:54:32 petere Exp $
1212
*/
1313

1414
#ifndefPG_CONFIG_H
@@ -98,6 +98,13 @@
9898
/* location of locale files */
9999
#undef LOCALEDIR
100100

101+
/* Define to build the ODBC driver for unixODBC */
102+
#undef WITH_UNIXODBC
103+
104+
/* Define to build the ODBC driver for iODBC */
105+
#undef WITH_IODBC
106+
107+
101108
/*
102109
*------------------------------------------------------------------------
103110
* Part 2: feature symbols and limits that are user-configurable, but

‎src/interfaces/libpq/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.58 2001/09/21 20:31:48 tgl Exp $
7+
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.59 2001/09/22 22:54:32 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -30,7 +30,7 @@ endif
3030
# Add libraries that libpq depends (or might depend) on into the
3131
# shared library link. (The order in which you list them here doesn't
3232
# matter.)
33-
SHLIB_LINK +=$(filter -L%,$(LDFLAGS))$(filter -lcrypt -ldes -lkrb -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl,$(LIBS))
33+
SHLIB_LINK +=$(filter -lcrypt -ldes -lkrb -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl,$(LIBS))
3434

3535

3636
all: all-lib

‎src/interfaces/odbc/GNUmakefile

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# GNUMakefile for psqlodbc (Postgres ODBC driver)
44
#
5-
# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.19 2001/09/11 23:27:10 petere Exp $
5+
# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.20 2001/09/22 22:54:32 petere Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -11,23 +11,36 @@ top_builddir = ../../..
1111
include$(top_builddir)/src/Makefile.global
1212

1313
# Shared library parameters
14+
ifeq ($(with_unixodbc),yes)
15+
NAME = odbcpsql
16+
else
1417
NAME = psqlodbc
18+
endif
1519
SO_MAJOR_VERSION = 0
1620
SO_MINOR_VERSION = 27
1721

18-
overrideCPPFLAGS := -I$(srcdir)$(CPPFLAGS) -DHAVE_CONFIG_H -DODBCINSTDIR='"$(odbcinst_ini_dir)"'
22+
overrideCPPFLAGS := -I$(srcdir)$(CPPFLAGS) -DODBCINSTDIR='"$(odbcinst_ini_dir)"'
1923

2024

2125
OBJS = info.o bind.o columninfo.o connection.o convert.o drvconn.o\
2226
environ.o execute.o lobj.o misc.o options.o\
2327
pgtypes.o psqlodbc.o qresult.o results.o socket.o parse.o statement.o\
24-
gpps.otuple.o tuplelist.o dlg_specific.o odbcapi.o$(OBJX)
28+
tuple.o tuplelist.o dlg_specific.o odbcapi.o
2529

2630
ifdefMULTIBYTE
2731
OBJS += multibyte.o
2832
endif
2933

30-
SHLIB_LINK =$(filter -lm -lnsl -lsocket,$(LIBS))
34+
SHLIB_LINK +=$(filter -lm -lnsl -lsocket,$(LIBS))
35+
ifeq ($(with_unixodbc),yes)
36+
SHLIB_LINK += -lodbcinst
37+
endif
38+
ifeq ($(with_iodbc),yes)
39+
SHLIB_LINK += -liodbcinst
40+
endif
41+
ifeq ($(with_unixodbc)$(with_iodbc),nono)
42+
OBJS += gpps.o
43+
endif
3144

3245
all: all-lib
3346

‎src/interfaces/odbc/bind.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@
2222
#include<stdlib.h>
2323
#include<string.h>
2424

25-
#ifndefWIN32
26-
#include"iodbc.h"
27-
#include"isql.h"
28-
#include"isqlext.h"
29-
#else
30-
#include"sql.h"
31-
#include"sqlext.h"
32-
#endif
3325
#include"pgapifunc.h"
3426

3527

‎src/interfaces/odbc/connection.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
*/
1515
/* Multibyte supportEiji Tokuya 2001-03-15 */
1616

17+
#include"connection.h"
18+
1719
#include<stdio.h>
1820
#include<string.h>
1921
#include<ctype.h>
2022

21-
#include"connection.h"
22-
2323
#include"environ.h"
2424
#include"socket.h"
2525
#include"statement.h"
@@ -31,9 +31,6 @@
3131
#include"multibyte.h"
3232
#endif
3333

34-
#ifdefWIN32
35-
#include<odbcinst.h>
36-
#endif
3734
#include"pgapifunc.h"
3835

3936
#defineSTMT_INCREMENT 16/* how many statement holders to allocate

‎src/interfaces/odbc/connection.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@
1414
#include<stdlib.h>
1515
#include<string.h>
1616

17-
#ifndefWIN32
18-
#include"iodbc.h"
19-
#include"isql.h"
20-
#include"isqlext.h"
21-
#else
22-
#include<windows.h>
23-
#include<sql.h>
24-
#include<sqlext.h>
25-
#endif
26-
2717

2818
typedefenum
2919
{

‎src/interfaces/odbc/convert.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,16 @@
1717
*/
1818
/* Multibyte support Eiji Tokuya2001-03-15*/
1919

20+
#include"convert.h"
21+
2022
#include<stdio.h>
2123
#include<string.h>
2224
#include<ctype.h>
2325

24-
#include"psqlodbc.h"
2526
#ifdefMULTIBYTE
2627
#include"multibyte.h"
2728
#endif
2829

29-
#ifndefWIN32
30-
#include"iodbc.h"
31-
#include"isql.h"
32-
#include"isqlext.h"
33-
#else
34-
#include<windows.h>
35-
#include<sql.h>
36-
#include<sqlext.h>
37-
#endif
38-
39-
#include"convert.h"
4030
#include<time.h>
4131
#include<math.h>
4232
#include<stdlib.h>
@@ -48,17 +38,6 @@
4838
#include"connection.h"
4939
#include"pgapifunc.h"
5040

51-
#ifndefWIN32
52-
#ifndefHAVE_STRICMP
53-
#definestricmp(s1,s2) strcasecmp(s1,s2)
54-
#definestrnicmp(s1,s2,n) strncasecmp(s1,s2,n)
55-
#endif
56-
#ifndefSCHAR
57-
typedefsignedcharSCHAR;
58-
59-
#endif
60-
#endif
61-
6241

6342
/*
6443
*How to map ODBC scalar functions {fn func(args)} to Postgres.

‎src/interfaces/odbc/dlg_specific.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,8 @@
1717
*/
1818
/* Multibyte supportEiji Tokuya 2001-03-15 */
1919

20-
#include"psqlodbc.h"
21-
22-
#ifndefWIN32
23-
#include<string.h>
24-
#include"gpps.h"
25-
#defineSQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
26-
#defineSQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d)
27-
#ifndefHAVE_STRICMP
28-
#definestricmp(s1,s2)strcasecmp(s1,s2)
29-
#definestrnicmp(s1,s2,n)strncasecmp(s1,s2,n)
30-
#endif
31-
#endif
32-
3320
#include"dlg_specific.h"
21+
3422
#include"convert.h"
3523

3624
#ifdefMULTIBYTE

‎src/interfaces/odbc/dlg_specific.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
#include"connection.h"
1414

1515
#ifdefWIN32
16-
#include<windows.h>
1716
#include<windowsx.h>
18-
#include<odbcinst.h>
1917
#include"resource.h"
2018
#endif
2119

‎src/interfaces/odbc/drvconn.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,12 @@
2525
#defineNEAR
2626
#else
2727
#include<winsock.h>
28-
#include<sqlext.h>
2928
#endif
3029

3130
#include<string.h>
3231

33-
#ifndefWIN32
34-
#definestricmp(s1,s2)strcasecmp(s1,s2)
35-
#definestrnicmp(s1,s2,n)strncasecmp(s1,s2,n)
36-
#else
37-
#include<windows.h>
32+
#ifdefWIN32
3833
#include<windowsx.h>
39-
#include<odbcinst.h>
4034
#include"resource.h"
4135
#endif
4236
#include"pgapifunc.h"

‎src/interfaces/odbc/environ.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@
1111

1212
#include"psqlodbc.h"
1313

14-
#ifndefWIN32
15-
#include"iodbc.h"
16-
#include"isql.h"
17-
#include"isqlext.h"
18-
#else
19-
#include<windows.h>
20-
#include<sql.h>
21-
#include<sqlext.h>
22-
#endif
23-
2414
#defineENV_ALLOC_ERROR 1
2515

2616
/**********Environment Handle*************/

‎src/interfaces/odbc/execute.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,10 @@
1414
*/
1515

1616
#include"psqlodbc.h"
17+
1718
#include<stdio.h>
1819
#include<string.h>
1920

20-
#ifndefWIN32
21-
#include"iodbc.h"
22-
#include"isqlext.h"
23-
#else
24-
#include<windows.h>
25-
#include<sqlext.h>
26-
#endif
27-
2821
#include"connection.h"
2922
#include"statement.h"
3023
#include"qresult.h"

‎src/interfaces/odbc/gpps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*-------
2020
*/
2121

22-
#ifndefWIN32
22+
#if !defined(WIN32)&& !defined(WITH_UNIXODBC)&& !defined(WITH_IODBC)
2323

2424
#include"gpps.h"
2525

‎src/interfaces/odbc/gpps.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88

99
#ifndefWIN32
1010
#include<sys/types.h>
11-
#include"iodbc.h"
1211
#endif
1312

13+
#defineSQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
14+
#defineSQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d)
15+
1416
#ifdef__cplusplus
1517
extern"C"
1618
{

‎src/interfaces/odbc/info.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,7 @@
2222
#include<stdio.h>
2323

2424
#ifndefWIN32
25-
#include"iodbc.h"
26-
#include"isql.h"
27-
#include"isqlext.h"
2825
#include<ctype.h>
29-
#else
30-
#include<windows.h>
31-
#include<sql.h>
32-
#include<sqlext.h>
33-
34-
#include<odbcinst.h>
3526
#endif
3627

3728
#include"tuple.h"
@@ -2060,7 +2051,7 @@ PGAPI_Statistics(
20602051
charcolumn_name[MAX_INFO_STRING],
20612052
relhasrules[MAX_INFO_STRING];
20622053
char**column_names=0;
2063-
Int4column_name_len;
2054+
SQLINTEGERcolumn_name_len;
20642055
inttotal_columns=0;
20652056
charerror= TRUE;
20662057
ConnInfo*ci;

‎src/interfaces/odbc/lobj.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414

1515
#include"lobj.h"
16-
#include"psqlodbc.h"
16+
1717
#include"connection.h"
1818

1919

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp