Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8bc9f00

Browse files
author
Peter Mount
committed
Thu Jan 18 17:37:00 GMT 2001 peter@retep.org.uk
- Added new error message into errors.properties "postgresql.notsensitive" This is used by jdbc2.ResultSet when a method is called that should fetch the current value of a row from the database refreshRow() for example. - These methods no longer throw the not implemented but the new noupdate error. This is in preparation for the Updateable ResultSet support which will overide these methods by extending the existing class to implement that functionality, but needed to show something other than notimplemented: moveToCurrentRow() moveToInsertRow() rowDeleted() rowInserted() all update*() methods, except those that took the column as a String as they were already implemented to convert the String to an int. - getFetchDirection() and setFetchDirection() now throws "postgresql.notimp" as we only support one direction. The CursorResultSet will overide this when its implemented. - Created a new class under jdbc2 UpdateableResultSet which extends ResultSet and overides the relevent update methods. This allows us to implement them easily at a later date. - In jdbc2.Connection, the following methods are now implemented: createStatement(type,concurrency); getTypeMap(); setTypeMap(Map); - The JDBC2 type mapping scheme almost complete, just needs SQLInput & SQLOutput to be implemented. - Removed some Statement methods that somehow appeared in Connection. - In jdbc2.Statement() getResultSetConcurrency() getResultSetType() setResultSetConcurrency() setResultSetType() - Finally removed the old 6.5.x driver.
1 parent 45b5d79 commit 8bc9f00

File tree

9 files changed

+345
-193
lines changed

9 files changed

+345
-193
lines changed

src/interfaces/jdbc/CHANGELOG

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
Thu Jan 18 17:30:00 GMT 2001 peter@retep.org.uk
2+
- Added new error message into errors.properties "postgresql.notsensitive"
3+
This is used by jdbc2.ResultSet when a method is called that should
4+
fetch the current value of a row from the database refreshRow() for
5+
example.
6+
- These methods no longer throw the not implemented but the new noupdate
7+
error. This is in preparation for the Updateable ResultSet support
8+
which will overide these methods by extending the existing class to
9+
implement that functionality, but needed to show something other than
10+
notimplemented:
11+
moveToCurrentRow()
12+
moveToInsertRow()
13+
rowDeleted()
14+
rowInserted()
15+
all update*() methods, except those that took the column as a String
16+
as they were already implemented to convert the String to an int.
17+
- getFetchDirection() and setFetchDirection() now throws
18+
"postgresql.notimp" as we only support one direction.
19+
The CursorResultSet will overide this when its implemented.
20+
- Created a new class under jdbc2 UpdateableResultSet which extends
21+
ResultSet and overides the relevent update methods.
22+
This allows us to implement them easily at a later date.
23+
- In jdbc2.Connection, the following methods are now implemented:
24+
createStatement(type,concurrency);
25+
getTypeMap();
26+
setTypeMap(Map);
27+
- The JDBC2 type mapping scheme almost complete, just needs SQLInput &
28+
SQLOutput to be implemented.
29+
- Removed some Statement methods that somehow appeared in Connection.
30+
- In jdbc2.Statement()
31+
getResultSetConcurrency()
32+
getResultSetType()
33+
setResultSetConcurrency()
34+
setResultSetType()
35+
- Finally removed the old 6.5.x driver.
36+
137
Thu Jan 18 12:24:00 GMT 2001 peter@retep.org.uk
238
- These methods in org.postgresql.jdbc2.ResultSet are now implemented:
339
getBigDecimal(int) ie: without a scale (why did this get missed?)

src/interfaces/jdbc/build.xml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
build file to allow ant (http://jakarta.apache.org/ant/) to be used
44
to build the PostgreSQL JDBC Driver.
55
6-
$Id: build.xml,v 1.3 2001/01/18 14:50:14 peter Exp $
6+
$Id: build.xml,v 1.4 2001/01/18 17:37:11 peter Exp $
77
88
-->
99

@@ -95,9 +95,28 @@
9595
</copy>
9696
</target>
9797

98+
<!-- This builds the examples -->
99+
<target name="examples" depends="compile">
100+
<javac srcdir="${src}" destdir="${dest}">
101+
<include name="example/**" />
102+
<exclude name="example/corba/**"/>
103+
</javac>
104+
</target>
105+
106+
<!-- Builds the corba example -->
107+
<target name="corba" if="jdk1.2+">
108+
<exec dir="${src}/example/corba" executable="idl2java">
109+
<arg value="stock.idl" />
110+
</exec>
111+
<javac srcdir="${src}" destdir="${dest}">
112+
<include name="example/corba/**" />
113+
</javac>
114+
</target>
115+
98116
<!-- This builds the jar file containing the driver -->
99-
<target name="jar" depends="compile">
117+
<target name="jar" depends="compile,examples">
100118
<jar jarfile="${jars}/postgresql.jar" basedir="${dest}" includes="org/**" />
119+
<jar jarfile="${jars}/postgresql-examples.jar" basedir="${dest}" includes="example/**" />
101120
</target>
102121

103122
<!--

src/interfaces/jdbc/jdbc.jpx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
<file path="CHANGELOG" />
2828
<file path="Implementation" />
2929
<file path="README" />
30+
<file path="org/postgresql/jdbc2/UpdateableResultSet.java" />
3031
</project>
3132

src/interfaces/jdbc/org/postgresql/Connection.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.postgresql.util.*;
1111

1212
/**
13-
* $Id: Connection.java,v 1.12 2001/01/18 14:50:14 peter Exp $
13+
* $Id: Connection.java,v 1.13 2001/01/18 17:37:12 peter Exp $
1414
*
1515
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
1616
* JDBC2 versions of the Connection class.
@@ -396,6 +396,23 @@ public void addWarning(String msg)
396396
* @exception SQLException if a database error occurs
397397
*/
398398
public java.sql.ResultSet ExecSQL(String sql) throws SQLException
399+
{
400+
return ExecSQL(sql,null);
401+
}
402+
403+
/**
404+
* Send a query to the backend. Returns one of the ResultSet
405+
* objects.
406+
*
407+
* <B>Note:</B> there does not seem to be any method currently
408+
* in existance to return the update count.
409+
*
410+
* @param sql the SQL statement to be executed
411+
* @param stat The Statement associated with this query (may be null)
412+
* @return a ResultSet holding the results
413+
* @exception SQLException if a database error occurs
414+
*/
415+
public java.sql.ResultSet ExecSQL(String sql,java.sql.Statement stat) throws SQLException
399416
{
400417
// added Oct 7 1998 to give us thread safety.
401418
synchronized(pg_stream) {
@@ -541,7 +558,7 @@ public java.sql.ResultSet ExecSQL(String sql) throws SQLException
541558
if (final_error != null)
542559
throw final_error;
543560

544-
return getResultSet(this, fields, tuples, recv_status, update_count, insert_oid);
561+
return getResultSet(this, stat, fields, tuples, recv_status, update_count, insert_oid);
545562
}
546563
}
547564

@@ -852,7 +869,7 @@ private void initObjectTypes()
852869
* This returns a resultset. It must be overridden, so that the correct
853870
* version (from jdbc1 or jdbc2) are returned.
854871
*/
855-
protected abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException;
872+
protected abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn,java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException;
856873

857874
public abstract void close() throws SQLException;
858875

src/interfaces/jdbc/org/postgresql/errors.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ postgresql.geo.point:Conversion of point failed - {0}
3535
postgresql.jvm.version:The postgresql.jar file does not contain the correct JDBC classes for this JVM. Try rebuilding. If that fails, try forcing the version supplying it to the command line using the argument -Djava.version=1.1 or -Djava.version=1.2\nException thrown was {0}
3636
postgresql.lo.init:failed to initialise LargeObject API
3737
postgresql.money:conversion of money failed - {0}.
38-
postgresql.noupdate:This ResultSet is not updateable
38+
postgresql.noupdate:This ResultSet is not updateable.
39+
postgresql.notsensitive:This ResultSet is not sensitive to realtime updates after the query has run.
3940
postgresql.psqlnotimp:The backend currently does not support this feature.
4041
postgresql.prep.is:InputStream as parameter not supported
4142
postgresql.prep.param:No value specified for parameter {0}.

src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.postgresql.util.*;
1818

1919
/**
20-
* $Id: Connection.java,v 1.4 2000/10/09 16:48:17 momjian Exp $
20+
* $Id: Connection.java,v 1.5 2001/01/18 17:37:13 peter Exp $
2121
*
2222
* A Connection represents a session with a specific database. Within the
2323
* context of a Connection, SQL statements are executed and results are
@@ -34,11 +34,11 @@
3434
*
3535
* @see java.sql.Connection
3636
*/
37-
public class Connection extends org.postgresql.Connection implements java.sql.Connection
37+
public class Connection extends org.postgresql.Connection implements java.sql.Connection
3838
{
3939
// This is a cache of the DatabaseMetaData instance for this connection
4040
protected DatabaseMetaData metadata;
41-
41+
4242
/**
4343
* SQL statements without parameters are normally executed using
4444
* Statement objects. If the same SQL statement is executed many
@@ -51,7 +51,7 @@ public java.sql.Statement createStatement() throws SQLException
5151
{
5252
return new Statement(this);
5353
}
54-
54+
5555
/**
5656
* A SQL statement with or without IN parameters can be pre-compiled
5757
* and stored in a PreparedStatement object. This object can then
@@ -74,7 +74,7 @@ public java.sql.PreparedStatement prepareStatement(String sql) throws SQLExcepti
7474
{
7575
return new PreparedStatement(this, sql);
7676
}
77-
77+
7878
/**
7979
* A SQL stored procedure call statement is handled by creating a
8080
* CallableStatement for it. The CallableStatement provides methods
@@ -99,7 +99,7 @@ public java.sql.CallableStatement prepareCall(String sql) throws SQLException
9999
throw new PSQLException("postgresql.con.call");
100100
// return new CallableStatement(this, sql);
101101
}
102-
102+
103103
/**
104104
* A driver may convert the JDBC sql grammar into its system's
105105
* native SQL grammar prior to sending it; nativeSQL returns the
@@ -114,7 +114,7 @@ public String nativeSQL(String sql) throws SQLException
114114
{
115115
return sql;
116116
}
117-
117+
118118
/**
119119
* If a connection is in auto-commit mode, than all its SQL
120120
* statements will be executed and committed as individual
@@ -143,10 +143,10 @@ public void setAutoCommit(boolean autoCommit) throws SQLException
143143
ExecSQL("begin");
144144
this.autoCommit = autoCommit;
145145
}
146-
146+
147147
/**
148148
* gets the current auto-commit state
149-
*
149+
*
150150
* @return Current state of the auto-commit mode
151151
* @exception SQLException (why?)
152152
* @see setAutoCommit
@@ -155,7 +155,7 @@ public boolean getAutoCommit() throws SQLException
155155
{
156156
return this.autoCommit;
157157
}
158-
158+
159159
/**
160160
* The method commit() makes all changes made since the previous
161161
* commit/rollback permanent and releases any database locks currently
@@ -175,11 +175,11 @@ public void commit() throws SQLException
175175
ExecSQL("begin");
176176
autoCommit = false;
177177
}
178-
178+
179179
/**
180180
* The method rollback() drops all changes made since the previous
181181
* commit/rollback and releases any database locks currently held by
182-
* the Connection.
182+
* the Connection.
183183
*
184184
* @exception SQLException if a database access error occurs
185185
* @see commit
@@ -193,7 +193,7 @@ public void rollback() throws SQLException
193193
ExecSQL("begin");
194194
autoCommit = false;
195195
}
196-
196+
197197
/**
198198
* In some cases, it is desirable to immediately release a Connection's
199199
* database and JDBC resources instead of waiting for them to be
@@ -216,7 +216,7 @@ public void close() throws SQLException
216216
pg_stream = null;
217217
}
218218
}
219-
219+
220220
/**
221221
* Tests to see if a Connection is closed
222222
*
@@ -227,7 +227,7 @@ public boolean isClosed() throws SQLException
227227
{
228228
return (pg_stream == null);
229229
}
230-
230+
231231
/**
232232
* A connection's database is able to provide information describing
233233
* its tables, its supported SQL grammar, its stored procedures, the
@@ -243,7 +243,7 @@ public java.sql.DatabaseMetaData getMetaData() throws SQLException
243243
metadata = new DatabaseMetaData(this);
244244
return metadata;
245245
}
246-
246+
247247
/**
248248
* You can put a connection in read-only mode as a hunt to enable
249249
* database optimizations
@@ -258,7 +258,7 @@ public void setReadOnly (boolean readOnly) throws SQLException
258258
{
259259
this.readOnly = readOnly;
260260
}
261-
261+
262262
/**
263263
* Tests to see if the connection is in Read Only Mode. Note that
264264
* we cannot really put the database in read only mode, but we pretend
@@ -271,7 +271,7 @@ public boolean isReadOnly() throws SQLException
271271
{
272272
return readOnly;
273273
}
274-
274+
275275
/**
276276
* A sub-space of this Connection's database may be selected by
277277
* setting a catalog name. If the driver does not support catalogs,
@@ -283,7 +283,7 @@ public void setCatalog(String catalog) throws SQLException
283283
{
284284
// No-op
285285
}
286-
286+
287287
/**
288288
* Return the connections current catalog name, or null if no
289289
* catalog name is set, or we dont support catalogs.
@@ -295,10 +295,10 @@ public String getCatalog() throws SQLException
295295
{
296296
return null;
297297
}
298-
298+
299299
/**
300300
* You can call this method to try to change the transaction
301-
* isolation level using one of the TRANSACTION_* values.
301+
* isolation level using one of the TRANSACTION_* values.
302302
*
303303
* <B>Note:</B> setTransactionIsolation cannot be called while
304304
* in the middle of a transaction
@@ -312,42 +312,42 @@ public String getCatalog() throws SQLException
312312
public void setTransactionIsolation(int level) throws SQLException
313313
{
314314
String q = "SET TRANSACTION ISOLATION LEVEL";
315-
315+
316316
switch(level) {
317-
317+
318318
case java.sql.Connection.TRANSACTION_READ_COMMITTED:
319319
ExecSQL(q + " READ COMMITTED");
320320
return;
321-
321+
322322
case java.sql.Connection.TRANSACTION_SERIALIZABLE:
323323
ExecSQL(q + " SERIALIZABLE");
324324
return;
325-
325+
326326
default:
327327
throw new PSQLException("postgresql.con.isolevel",new Integer(level));
328328
}
329329
}
330-
330+
331331
/**
332332
* Get this Connection's current transaction isolation mode.
333-
*
333+
*
334334
* @return the current TRANSACTION_* mode value
335335
* @exception SQLException if a database access error occurs
336336
*/
337337
public int getTransactionIsolation() throws SQLException
338338
{
339339
ExecSQL("show xactisolevel");
340-
340+
341341
SQLWarning w = getWarnings();
342342
if (w != null) {
343343
if (w.getMessage().indexOf("READ COMMITTED") != -1) return java.sql.Connection.TRANSACTION_READ_COMMITTED; else
344344
if (w.getMessage().indexOf("READ UNCOMMITTED") != -1) return java.sql.Connection.TRANSACTION_READ_UNCOMMITTED; else
345345
if (w.getMessage().indexOf("REPEATABLE READ") != -1) return java.sql.Connection.TRANSACTION_REPEATABLE_READ; else
346-
if (w.getMessage().indexOf("SERIALIZABLE") != -1) return java.sql.Connection.TRANSACTION_SERIALIZABLE;
346+
if (w.getMessage().indexOf("SERIALIZABLE") != -1) return java.sql.Connection.TRANSACTION_SERIALIZABLE;
347347
}
348348
return java.sql.Connection.TRANSACTION_READ_COMMITTED;
349349
}
350-
350+
351351
/**
352352
* The first warning reported by calls on this Connection is
353353
* returned.
@@ -362,7 +362,7 @@ public SQLWarning getWarnings() throws SQLException
362362
{
363363
return firstWarning;
364364
}
365-
365+
366366
/**
367367
* After this call, getWarnings returns null until a new warning
368368
* is reported for this connection.
@@ -373,16 +373,17 @@ public void clearWarnings() throws SQLException
373373
{
374374
firstWarning = null;
375375
}
376-
376+
377377
/**
378378
* This overides the method in org.postgresql.Connection and returns a
379379
* ResultSet.
380380
*/
381-
protected java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException
381+
protected java.sql.ResultSet getResultSet(org.postgresql.Connection conn,java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException
382382
{
383+
// in jdbc1 stat is ignored.
383384
return new org.postgresql.jdbc1.ResultSet((org.postgresql.jdbc1.Connection)conn,fields,tuples,status,updateCount,insertOID);
384385
}
385-
386+
386387
}
387388

388389
// ***********************************************************************

0 commit comments

Comments
 (0)