postgresql/src/interfaces/odbc
Bruce Momjian 3fe3acb844 I have made the couple of mods required to make the odbc driver with
postgres build and use unixODBC (http://www.unixodbc.org)

This patch was applied against the postgresql-7.0beta1 build

Any problems let me know.

Nick Gorham
2000-06-09 16:03:09 +00:00
..
acconfig.h Update source code to Byron's v6.30.0250 sources plus minor cleanup 1998-10-06 05:58:41 +00:00
bind.c Cleanup of <> and "" 2000-05-29 21:25:07 +00:00
bind.h Update for version 6-40-0002 and re-merge Thomas' changes. 1998-12-29 01:49:58 +00:00
columninfo.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
columninfo.h Update for version 06-40-0001 1998-11-11 21:54:01 +00:00
config.guess Forgot that odbc had its own copies of config.sub/config.guess. 2000-03-21 06:35:22 +00:00
config.h.in Update source code to Byron's v6.30.0250 sources plus minor cleanup 1998-10-06 05:58:41 +00:00
Config.mk Update source code to Byron's v6.30.0250 sources plus minor cleanup 1998-10-06 05:58:41 +00:00
config.sub Forgot that odbc had its own copies of config.sub/config.guess. 2000-03-21 06:35:22 +00:00
configure Remove configure check for how to abbreviate 'tr A-Z a-z', and instead 2000-05-16 02:14:15 +00:00
configure.in Remove configure check for how to abbreviate 'tr A-Z a-z', and instead 2000-05-16 02:14:15 +00:00
connection.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
connection.h Rename readonly to onlyread in odbc. Use varargs properly. 1999-11-30 02:44:09 +00:00
convert.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
convert.h Update for version 6-40-0002 and re-merge Thomas' changes. 1998-12-29 01:49:58 +00:00
dlg_specific.c I have made the couple of mods required to make the odbc driver with 2000-06-09 16:03:09 +00:00
dlg_specific.h Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
drvconn.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
environ.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
environ.h Update source code to Byron's v6.30.0250 sources plus minor cleanup 1998-10-06 05:58:41 +00:00
execute.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
GNUmakefile.in Moved configure script from src/ to the top level directory. Moved 2000-06-06 22:01:15 +00:00
gpps.c More odbc include cleanups 2000-06-08 17:08:54 +00:00
gpps.h Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
info.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
install-sh Update source code to Byron's v6.30.0250 sources plus minor cleanup 1998-10-06 05:58:41 +00:00
iodbc.h Update source code to Byron's v6.30.0250 sources plus minor cleanup 1998-10-06 05:58:41 +00:00
isql.h Version 06-30-0248 1998-07-22 23:47:48 +00:00
isqlext.h Irix fixes from Murad Nayal 2000-05-22 23:56:44 +00:00
license.txt Update odbc driver to current version V.0244 1998-06-03 20:33:45 +00:00
lobj.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
lobj.h Version 06-30-0248 1998-07-22 23:47:48 +00:00
Makefile.global.in Centralized shared-library build knowledge in a new file, 1998-10-19 00:00:51 +00:00
misc.c Remove NT-specific file open defines by defining our own open macros for 2000-06-02 15:57:44 +00:00
misc.h I have made the couple of mods required to make the odbc driver with 2000-06-09 16:03:09 +00:00
notice.txt Update odbc driver to current version V.0244 1998-06-03 20:33:45 +00:00
odbcinst.ini Version 06-30-0248 1998-07-22 23:47:48 +00:00
options.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
parse.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
pgtypes.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
pgtypes.h Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
psqlodbc.c Update for version 6-40-0002 and re-merge Thomas' changes. 1998-12-29 01:49:58 +00:00
psqlodbc.def Replace old PostODBC driver with new one... 1998-04-13 15:02:05 +00:00
psqlodbc.h More odbc include cleanups 2000-06-08 17:08:54 +00:00
psqlodbc.rc update to 6.40.0009 and provide WIN32 defines for auto-configured items 2000-02-28 03:31:36 +00:00
qresult.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
qresult.h Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
readme.txt Update source code to Byron's v6.30.0250 sources plus minor cleanup 1998-10-06 05:58:41 +00:00
resource.h Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
results.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
setup.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
setup.rul Update 06-40-0003 1999-01-06 20:44:08 +00:00
socket.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
socket.h Update for version 6-40-0002 and re-merge Thomas' changes. 1998-12-29 01:49:58 +00:00
statement.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
statement.h driver v06-40-0007 1999-09-03 04:41:45 +00:00
TODO.txt Update source code to Byron's v6.30.0250 sources plus minor cleanup 1998-10-06 05:58:41 +00:00
tuple.c Remove // comments from ODBC. 2000-05-27 03:35:14 +00:00
tuple.h Update source code to Byron's v6.30.0250 sources plus minor cleanup 1998-10-06 05:58:41 +00:00
tuplelist.c Update odbc driver to current version V.0244 1998-06-03 20:33:45 +00:00
tuplelist.h Update odbc driver to current version V.0244 1998-06-03 20:33:45 +00:00
Version.mk Update int28out and out8out and _in_ functions to handle trailing zeros 2000-01-10 15:41:34 +00:00

Readme for psqlodbc.dll                         4/15/98
-------------------------------------------------------------------------------
Latest binary and source updates available at http://www.insightdist.com/psqlodbc


I.  Building the Driver from the source code

This section describes how to build the PostgreSQL ODBC Driver (psqlodbc.dll).
Microsoft Visual C++ version 4.0 or higher is required.  There is no manually 
constructed Makefile.  The visual C++ environment automatically generates one
during the build process. Thus, the project binary files (".ncb", ".mdp", ".aps") 
nor the makefile are really distributed as part of the source code release
(although they are probably in there anyway).

1.  Create a new project workspace with the type DLL.  For the name, type in the
    name "psqlodbc".

2.  The above step creates the directory "psqlodbc" under the 
    "\<Visual C++ top level directory>\projects" path to hold the source files.
    (example, \msdev\projects\psqlodbc).  Now, either unzip the source code release
    into this directory or just copy all the files into this directory.

3.  Insert all of the source files (*.c, *.h, *.rc, *.def) into the Visual project
    using the "Insert files into project" command.  You may have to do 2 inserts --
    the first to get the 'c' and header files, and the second to get the def file.
    Don't forget the .def file since it is an important part of the release.
    You can even insert ".txt" files into the projects -- they will do nothing.
	
4.  Add the "wsock32.lib" library to the end of the list of libraries for linking
    using the Build settings menu.
	
5.  Select the type of build on the toolbar (i.e., Release or Debug).  This is
    one of the useful features of the visual c++ environment in that you can
    browse the entire project if you build the "Debug" release.  For release
    purposes however, select "Release" build.

6.  Build the dll by selecting Build from the build menu.

7.  When complete, the "psqlodbc.dll" file is under the "Release" subdirectory.
    (i.e., "\msdev\projects\psqlodbc\release\psqlodbc.dll")



II.  Using Large Objects for handling LongVarBinary (OLE Objects in Access)

Large objects are mapped to LONGVARBINARY in the driver to allow storing things like
OLE objects in Microsoft Access.  Multiple SQLPutData and SQLGetData calls are usually
used to send and retrieve these objects.  The driver creates a new large object and simply
inserts its 'identifier' into the respective table.  However, since Postgres uses an 'Oid'
to identify a Large Object, it is necessary to create a new Postgres type to be able
to discriminate between an ordinary Oid and a Large Object Oid.  Until this new type
becomes an official part of Postgres, it must be added into the desired database and
looked up for each connection.  The type used in the driver is simply called "lo" and
here is the command used to create it:

create type lo (internallength=4,externallength=10,input=int4in,output=int4out,
                default='',passedbyvalue);

Once this is done, simply use the new 'lo' type to define columns in that database.  Note
that this must be done for each database you want to use large objects in with the driver.
When the driver sees an 'lo' type, it will handle it as LONGVARBINARY.

Another important note is that this new type is lacking in functionality.  It will not
cleanup after itself on updates and deletes, thus leaving orphans around and using up
extra disk space.  And currently, Postgres does not support the vacuuming of large
objects.  Hopefully in the future, a real large object data type will be available.

But for now, it sure is fun to stick a Word document, Visio document, or avi of a dancing
baby into a database column, even if you will fill up your server's hard disk after a while!



III.  Using Row Versioning feature and creating the missing equals operator

In order to use row versioning, you must overload the int4eq function for use
with the xid type.  Also, you need to create an operator to compare xid to int4.
You must do this for each database you want to use this feature on.
Here are the details:

create function int4eq(xid,int4)
  returns bool
  as ''
  language 'internal';

create operator = (
        leftarg=xid,
        rightarg=int4,
        procedure=int4eq,
        commutator='=',
        negator='<>',
        restrict=eqsel,
        join=eqjoinsel
        );