~ubuntu-branches/ubuntu/wily/libpgjava/wily

« back to all changes in this revision

Viewing changes to src/interfaces/jdbc/Implementation

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2005-04-21 14:25:11 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050421142511-wibh5vc31fkrorx7
Tags: 7.4.7-3
Built with sources...

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
This short document is provided to help programmers through the internals of
2
 
the PostgreSQL JDBC driver.
3
 
 
4
 
Last update: January 17 2001 peter@retep.org.uk
5
 
 
6
 
build.xml
7
 
---------
8
 
 
9
 
As of 7.1, we now use the ANT build tool to build the driver. ANT is part of
10
 
the Apache/Jakarta project, and provides far superior build capabilities. You
11
 
can find ANT from http://jakarta.apache.org/ant/index.html and being pure java
12
 
it will run on any java platform.
13
 
 
14
 
So far I've tested it under JDK1.2.x & JDK1.3 (both Linux & NT) but not yet with
15
 
JDK1.1.8. Because of the latter the Makefile still works for now, but should be
16
 
gone for 7.2.
17
 
 
18
 
Anyhow, to build, simply type ant and the .jar file will be created and put into
19
 
the jars directory.
20
 
 
21
 
Tip: If you run ant from the sources root directory (ie: where the configure
22
 
script is located) you will find another build.xml file. It is advised to run
23
 
ant from that directory as it will then compile some auxilary Java/JDBC
24
 
utilities that are located under the /contrib/retep directory.
25
 
 
26
 
Makefile
27
 
--------
28
 
 
29
 
Prior to 7.1, all compilation must be done by using Make. This is because there
30
 
are three versions of the driver, one for JDBC1 (for JDK 1.1.x) and the others
31
 
for JDBC2 (for JDK 1.2 or later, one standard and one enterprise).
32
 
 
33
 
As of 7.1, ANT is the build tool of choice. Just compare Makefile and build.xml
34
 
to see why! Make just isn't suited to Java.
35
 
 
36
 
Building with just the JDK
37
 
--------------------------
38
 
 
39
 
This is not advised, simply because you have to make sure you include the
40
 
correct classes, and the fact that org.postgresql.Driver is built on the fly.
41
 
Also, javac won't pick up all the classes because some (org.postgresql.geometric
42
 
for example) are loaded dynamically.
43
 
 
44
 
org/postgresql/Driver.java.in
45
 
-----------------------------
46
 
 
47
 
Because there are three versions of the driver, the org.postgresql.Driver class
48
 
is built dynamically. To build correctly ANT copies the Driver.java.in file to
49
 
Driver.java replacing certain values according to the required driver.
50
 
 
51
 
The replaced values are of the format %VALUE%, ie: %MAJORVERSION% is replaced
52
 
with 7 in the 7.1 version of the driver.
53
 
 
54
 
postgresql.jar
55
 
--------------
56
 
 
57
 
This jar file is produced by ANT, and contains the driver for your JDK platform.
58
 
 
59
 
If you downloaded a precompiled binary from the web, you may find that the
60
 
jar file will be named differently. These are identical to this file but are
61
 
named according to the backend and jdk versions.
62
 
 
63
 
The naming convention is of the form: jdbc-#.#-#.##.jar
64
 
 
65
 
ie: for 7.1
66
 
  jdbc-7.1-1.1.jar    JDBC Driver for JDK1.1.8
67
 
  jdbc-7.1-1.2.jar    JDBC Driver for JDK1.2 & JDK1.3
68
 
  jdbc-7.1-1.2ent.jar JDBC Driver for JDK1.2 & JDK1.3 Enterprise Editions
69
 
 
70
 
If in the future there are any 1.3 specific classes then there will be two new
71
 
jar files.
72
 
 
73
 
Note: All the precompiled binaries are built under Linux.
74
 
 
75
 
jdbc.jpx
76
 
--------
77
 
 
78
 
This is a JBuilder4 project file. It's here to allow JBuilder to be used to
79
 
develop the driver. Mainly for it's Editor's features like syntax checking and
80
 
auto-completion etc.
81
 
 
82
 
IMPORTANT: You CAN NOT build the driver from within JBuilder. You must use ANT.
83
 
           This is because of the three versions of the JDK. If you try to use
84
 
           JBuilder, it will try to build everything, and it will just not work.
85
 
 
86
 
Importing packages
87
 
------------------
88
 
 
89
 
In user code, you may have to import one or more packages, if and only if you
90
 
are using the non jdbc extensions (like FastPath, or LargeObject).
91
 
 
92
 
DO NOT import the postgresql, postgresql.jdbc1 or postgresql.jdbc2 packages!
93
 
 
94
 
Internally, some classes will import the packages when there is a link between
95
 
them and the other packages. However, the above rule still applies. It's there
96
 
because Javac becomes confused between the different places that similar class
97
 
names are present.
98
 
 
99
 
However, there are places where they need to refer to classes in the postgresql
100
 
package. In this case, import the individual classes, and not the entire
101
 
package.
102
 
 
103
 
ie:     import postgresql.Field
104
 
 
105
 
    NOT import postgresql.*
106
 
 
107
 
Package Layout
108
 
--------------
109
 
 
110
 
The driver is split into several packages:
111
 
 
112
 
org.postgresql                  core classes that can be accessed by user code
113
 
org.postgresql.core             core classes not normally used externally
114
 
org.postgresql.jdbc1            classes used only in implementing JDBC 1
115
 
org.postgresql.jdbc2            classes used only in implementing JDBC 2
116
 
org.postgresql.fastpath         FastPath to backend functions
117
 
org.postgresql.geometric                2D Geometric types mapped to Java Objects
118
 
org.postgresql.largeobject              Low level Large Object access
119
 
org.postgresql.util                     Utility classes
120
 
 
121
 
 
122
 
Package org.postgresql
123
 
------------------
124
 
 
125
 
This package holds the core classes.
126
 
 
127
 
Driver          registers the driver when it's loaded, and determines which
128
 
                Connection class (in jdbc1 or jdbc2 packages) to use when
129
 
                connecting to a database.
130
 
 
131
 
Field           Used internally to represent a Field
132
 
PG_Stream       Used internally to manage the network stream.
133
 
PostgresqlDataSource
134
 
                Exists in the Java2 Enterprise edition driver only and is the
135
 
                enterprise equivalent to Driver
136
 
 
137
 
        These classes contains common code that is not dependent to the
138
 
        two JDBC specifications.
139
 
 
140
 
Connection      Common code used in Connections, mainly Network Protocol stuff.
141
 
ResultSet       Common code used in ResultSet's
142
 
 
143
 
Package org.postgresql.core
144
 
-----------------------
145
 
 
146
 
New in 7.1, this is where core classes (common to all versions) will exist. Any
147
 
new class that would have gone into org.postgresql must go in here instead.
148
 
 
149
 
BytePoolDim1    Handles a pool of byte[] arrays.
150
 
BytePoolDim2    Handles a pool of byte[][] arrays
151
 
MemoryPool      Interface for managing MemoryPools. Not used (yet).
152
 
ObjectPool      Interface for an Object Pool
153
 
SimpleObjectPool Class that implements ObjectPool and used by BytePoolDim#
154
 
Encoding        Character encoding logic, mainly for Connection and PG_Stream.
155
 
 
156
 
Package org.postgresql.fastpath
157
 
---------------------------
158
 
 
159
 
Fastpath        Handles executing a function on the PostgreSQL Backend
160
 
FastpathArg     Defines an argument for a function call
161
 
 
162
 
Package org.postgresql.geometric
163
 
----------------------------
164
 
 
165
 
PGbox           Maps to postgresql type box
166
 
PGcircle        Maps to postgresql type circle
167
 
PGline          Maps to postgresql type line
168
 
PGlseg          Maps to postgresql type lseg
169
 
PGpath          Maps to postgresql type path
170
 
PGpoint         Maps to postgresql type point
171
 
PGpolygon       Maps to postgresql type polygon
172
 
 
173
 
Package org.postgresql.jdbc1
174
 
------------------------
175
 
 
176
 
The classes in this package handle the JDBC 1 Specification, for JDK 1.1.x
177
 
All interfaces in the java.sql package are present here.
178
 
 
179
 
Package org.postgresql.jdbc2
180
 
------------------------
181
 
 
182
 
The classes in this package handle the JDBC 2 Specification, for JDK 1.2
183
 
All interfaces in the java.sql, and javax.sql packages are present here.
184
 
 
185
 
Package org.postgresql.largeobject
186
 
------------------------------
187
 
 
188
 
LargeObject             Represents an open LargeObject
189
 
LargeObjectManager      Handles the opening and deleting of LargeObjects
190
 
 
191
 
Package org.postgresql.util
192
 
-----------------------
193
 
 
194
 
PGmoney         Maps to postgresql type money
195
 
PGobject        Used to represent postgresql types that have no Java equivalent
196
 
PGtokenizer     Helper class for the geometric types
197
 
Serialize       Used to serialise Java objects into tabes, rather than Blobs
198
 
UnixCrypt       Used to handle crypt authentication
199