Skip to content

Commit 6e66468

Browse files
author
Byron Nikolaidis
committed
Version 06-30-0248
1 parent 2a67742 commit 6e66468

39 files changed

+4545
-282
lines changed

src/interfaces/odbc/Config.mk

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
#
3+
#
4+
#
5+
6+
#============ Default for all system ==============
7+
OS = UNX
8+
SHELL = /bin/sh
9+
AR = ar r
10+
DLSUFFIX= so
11+
INCDIR = /include
12+
OBJX =
13+
RANLIB = ranlib
14+
INSTALL = /usr/bin/install
15+
INSTALL_DATA = $(INSTALL) -c -m 644
16+
MKDIR = mkdir
17+
DESTDIR = /usr/local
18+
LIBDIR = /lib
19+
INSTHEADERS = isql.h isqlext.h iodbc.h
20+
DESTLIBDIR = $(DESTDIR)$(LIBDIR)
21+
DESTINCDIR = $(DESTDIR)$(INCDIR)/iodbc
22+
ODBCSYSTEMDIR = /usr/home/gryschuk
23+
24+
# Remove the comment characters from the section you want to
25+
# use below, make sure all other sections are commented out.
26+
27+
#============== Linux ELF =========================
28+
CC = gcc
29+
PIC = -fPIC
30+
CFLAGSX = -g
31+
#CFLAGSX = -g -Wall -DMY_LOG -DQ_LOG
32+
LDFLAGS = -shared
33+
LIBS = -ldl
34+
35+
#============= FreeBSD 2.x ========================
36+
# I don't know if this would work but you can always just try it.
37+
# PIC = -fPIC
38+
# CFLAGSX = -g -Wall
39+
# LDFLAGS = -Bshareable
40+
# LIBS =
41+
42+
#===| end of file 'Config.mk' |===
43+
44+

src/interfaces/odbc/Makefile.unx

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
# .include "Version.mk"
3+
# .include "Config.mk"
4+
include Version.mk
5+
include Config.mk
6+
#==============================================================================
7+
# Makefile
8+
#
9+
# UNIX Makefile to build the CLI for PostgreSQL/Postgres95
10+
#
11+
#==============================================================================
12+
# Site specific configuration (UNIX)
13+
#==============================================================================
14+
#
15+
# option switches
16+
#
17+
# debug: select this to enable debugging of the software
18+
#DEBUG = -D_DEBUG
19+
#
20+
#==============================================================================
21+
22+
#---| definitions |------------------------------------------------------------
23+
24+
# NAME = cli
25+
NAME = psqlodbc
26+
27+
OBJECTS = info.o bind.o columninfo.o connection.o convert.o drvconn.o \
28+
environ.o execute.o lobj.o misc.o options.o \
29+
pgtypes.o psqlodbc.o qresult.o results.o socket.o statement.o \
30+
gpps.o tuple.o tuplelist.o dlg_specific.o $(OBJX)
31+
32+
#CFLAGS = -c $(DEBUG) -D$(PG_ENV) -O $(PIC) $(ANSI) -I$(PG_INCLUDE) \
33+
# -I$(ODBC_INCLUDE) -D$(DLDAPI) $(CFLAGSX) -DHAVE_CONFIG_H \
34+
# -DVERSION=\"$(VERSION)$(EXTVER)\"
35+
CFLAGS = -g -c -Wall $(DEBUG) -O $(PIC) $(ANSI) -I. -I.. \
36+
-I$(PG_INCLUDE) -I$(ODBC_INCLUDE) $(CFLAGSX) -DHAVE_CONFIG_H
37+
38+
shlib = lib$(NAME)-$(VERSION).$(DLSUFFIX)
39+
DESTDIR = /usr/local
40+
LIBDIR = /lib
41+
42+
#---| global dependencies |----------------------------------------------------
43+
44+
#all: $(OBJECTS) lib dll
45+
46+
all: $(OBJECTS) dll
47+
48+
clean:
49+
-rm -f core *.o *~ *.core
50+
51+
delete: clean
52+
53+
delete_all: delete
54+
-rm -f /usr/local/lib/lib$(NAME)_$(MSQL_ENV).a
55+
-rm -f /usr/local/lib/lib$(NAME)_$(MSQL_ENV).$(DLSUFFIX)
56+
57+
#---| local dependencies |-----------------------------------------------------
58+
#log.o: ../SRC_LOG/log.c ../SRC_LOG/log.h
59+
# $(CC) $(CFLAGS) -I../SRC_LOG ../SRC_LOG/log.c
60+
61+
lib:
62+
$(AR) lib$(NAME)$(PG_ENV).a $(OBJECTS)
63+
$(RANLIB) lib$(NAME)$(PG_ENV).a
64+
65+
dll: $(OBJECTS)
66+
$(LD) $(LDFLAGS) -L$(PG_LIBPATH) $(OBJECTS) \
67+
-o $(shlib) $(LIBS) $(PG_LIBS)
68+
69+
install-shlib: $(shlib)
70+
$(INSTALL_DATA) $(shlib) $(DESTDIR)$(LIBDIR)/$(shlib)
71+
rm -f $(DESTDIR)$(LIBDIR)/lib$(NAME).so
72+
ln -sf $(shlib) $(DESTDIR)$(LIBDIR)/lib$(NAME).so
73+
74+
install-headers: $(INSTHEADERS)
75+
if [ -d $(DESTDIR)$(INCDIR)/iodbc ]; then : ; else $(MKDIR) $(DESTDIR)$(INCDIR)/iodbc; fi
76+
$(INSTALL_DATA) $(INSTHEADERS) $(DESTDIR)$(INCDIR)/iodbc
77+
78+
install-ini: odbcinst.ini
79+
$(INSTALL_DATA) odbcinst.ini /etc
80+
81+
install: install-headers install-shlib install-ini
82+
83+
#==============================================================================
84+
85+

src/interfaces/odbc/README.Linux

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
2+
Unix port of psqlodbc, brought to you by:
3+
Gerald Gryschuk([email protected])
4+
5+
This is the first release of a port of psqlodbc to Unix(specifically Linux),
6+
as such the installation may not be as straight forward as it could be(then
7+
again it might be). As well the only testing of the driver has been with
8+
the real project I'm working on, since it seems to be working there I assumed
9+
it was ready to go out. This port works with Ke Jin's iodbc driver manager
10+
although there is no theoretical reason why it couldn't work with other
11+
driver managers for UNIX(I know of none though). The FreeODBC site
12+
(http://users.ids.net/~bjepson/freeODBC/) has a link to download the current
13+
version of iodbc(iodbc-2.12).
14+
15+
This driver has been successfully compiled and tested on a RedHat 4.1 system
16+
using both gcc 2.7.2 and egcs 1.0.2.
17+
18+
INSTALLATION:
19+
20+
If you have a system any where close to mine this will be easy, just
21+
copy Makefile.lnx to Makefile then type 'make' and see what happens. Note
22+
that if you have not enabled logging(read the file misc.h) then you
23+
may get alot of warning messages, just ignore these, they shouldn't be
24+
a problem. If this doesn't work, well... I don't know what to say, see if
25+
you can figure out what's wrong,fix it and send me a message. If everything
26+
makes o.k. you can 'make install' which will install the shared library
27+
(in /usr/local/lib) and a WINDOWS type INI file in /etc (called odbcinst.ini,
28+
see CONFIGURATION below). If you want to program using this driver do a
29+
'make install-headers' which will install programming header files in
30+
/usr/local/include/iodbc. If you don't like these install locations edit
31+
Config.mk and change the environment variable DESTDIR(and possible DESTINCDIR
32+
to get rid of the /iodbc) to suit your system.
33+
34+
CONFIGURATION:
35+
36+
The psqlodbc driver reads two Windows type INI files for configuration,
37+
one called odbcinst.ini located in /etc which is used for system wide
38+
configuration of the driver and one in the users home directory called
39+
.odbc.ini, which can be used to override the system wide settings. Note that
40+
the location of odbcinst is currently hardcoded into the source so if you
41+
want to change this you have to change it in the source as well. This latter
42+
file is also searched for by iodbc and is where
43+
the DataSource definitions are placed. The format of both files is exactly
44+
like that of a Windows INI file using key,value pairs. A DataSource definition
45+
is started with a section name enclosed in square brackets i.e. [PostODBC].
46+
Comments are started using a ';' character and are restricted to being
47+
only on seperate lines(i.e. no comments are allowed on definition lines).
48+
The important keywords for psqlodbc are:
49+
Driver = (location where the psqlodbc library was installed)
50+
ex. Driver = /usr/local/lib/libpspqlodbc.so
51+
52+
ServerName = hostname or ip-address of postgreSQL server
53+
ex. ServerName = simpsons.springfield.com
54+
or ServerName = 192.1.1.1
55+
56+
Database = name of database to connect to
57+
ex. Database = template1
58+
59+
Port = tcp port that the postgreSQL server is listening on, note
60+
that this need not be set as the driver defaults to the
61+
default postgreSQL port of 5432. Of course if your server
62+
is listening on a different port than you need to say
63+
what it is here.
64+
65+
Username = name of authorized postgreSQL user
66+
ex. Username = homer
67+
68+
Password = the password for the user named in Username. Note
69+
that if you have password checking on in postgreSQL
70+
you have to have this field. Unfortunately this means
71+
storing clear text passwords in a file. If this bothers
72+
you, well... write a dialog box routine and send it
73+
to me.
74+
ex. Password = Doh!
75+
76+
ReadOnly = 0 or 1. Default is 1 => database IS readonly. If
77+
set to 0, database is read-write.
78+
ex. ReadOnly = 0
79+
80+
Protocol = 6.2 to force the use of Postgres 6.2 protocol
81+
82+
The odbcinst.ini file is where sytem wide settings are kept. There are
83+
quite a number of these, all of which have built-in defaults. Since I'm
84+
not even sure what they are all for I won't try to describe them, check
85+
the file dlg_specific.h for a list and some explanation. Two that I found
86+
useful are Debug and CommLog, which can be used to tailor logging of messages
87+
by the driver(note that you have to have defined MY_LOG and Q_LOG during
88+
compilation of the driver, see the file misc.h for an explanation). If
89+
you have logging On(ie. CommLog = 1 and/or Debug = 1) then logging will
90+
occur to the files /tmp/mylog.log(Debug, only developers will be
91+
interested) and /tmp/psqlodbc.log(end user log file).
92+
93+
USE:
94+
run an ODBC enabled application :-) .
95+
96+
O.k. Well, the only ODBC compliant applications that I can
97+
"guarantee" to work are those that are compiled using the following
98+
headers that come with this driver, iodbc.h, isql.h and isqlext.h.
99+
100+
BUGS,etc.
101+
102+
If you have problems with compiling/installing or making this
103+
package send e-mail to me at:
104+
[email protected] or to the pgsql-interfaces mailing list
105+
106+
107+
Ports to different Unices are greatly appreciated and can probably be
108+
sent to me for now(although this may change shortly).
109+
110+
Bugs of a general nature should still be sent to the current
111+
maintainer or to the interfaces list.
112+
113+

src/interfaces/odbc/Version.mk

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VERSION = 0.24
2+
EXTVER = .2
3+

src/interfaces/odbc/bind.c

+12
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,27 @@
1212
* Comments: See "notice.txt" for copyright and license information.
1313
*
1414
*/
15+
16+
#ifdef HAVE_CONFIG_H
17+
#include <config.h>
18+
#endif
19+
1520
#include "bind.h"
1621
#include "environ.h"
1722
#include "statement.h"
1823
#include "qresult.h"
1924
#include "pgtypes.h"
2025
#include <stdlib.h>
2126
#include <malloc.h>
27+
28+
#ifdef HAVE_IODBC
29+
#include "iodbc.h"
30+
#include "isql.h"
31+
#include "isqlext.h"
32+
#else
2233
#include <sql.h>
2334
#include <sqlext.h>
35+
#endif
2436

2537
// Bind parameters on a statement handle
2638

src/interfaces/odbc/columninfo.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "socket.h"
1717
#include <stdlib.h>
1818
#include <malloc.h>
19+
#include <string.h>
1920

2021
ColumnInfoClass *
2122
CI_Constructor()

src/interfaces/odbc/config.h

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#define HAVE_IODBC 1
2+
#define UNIX 1
3+
#define HAVE_PARAM_H 1
4+
#define HAVE_PWD_H 1
5+
#define HAVE_STRICMP 0

0 commit comments

Comments
 (0)