Skip to content

Commit 960c186

Browse files
committed
the bug was not fixed in the snapshot of November 5th. Also the enterprise
edition of the driver did not compile. I have fixed both issues again. I have attached the modified files to this email, maybe you can check them into the repository. (Fixes are marked with //FIXME). Enterprise edition driver now compiles and seems to work. Jan Thomae
1 parent a210023 commit 960c186

File tree

2 files changed

+43
-15
lines changed

2 files changed

+43
-15
lines changed

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

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*
4141
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
4242
*
43-
* $Id: PostgresqlDataSource.java,v 1.1 2000/10/12 08:55:24 peter Exp $
43+
* $Id: PostgresqlDataSource.java,v 1.2 2000/11/10 22:06:26 momjian Exp $
4444
*/
4545

4646

@@ -64,9 +64,12 @@
6464
import javax.naming.Name;
6565
import javax.naming.NamingException;
6666
import javax.naming.spi.ObjectFactory;
67-
import postgresql.util.PSQLException;
68-
import postgresql.xa.XADataSourceImpl;
69-
67+
// FIXME
68+
//import postgresql.util.PSQLException;
69+
//import postgresql.xa.XADataSourceImpl;
70+
import org.postgresql.util.PSQLException;
71+
import org.postgresql.xa.XADataSourceImpl;
72+
//---------
7073

7174
/**
7275
* Implements a JDBC 2.0 {@link javax.sql.DataSource} for the
@@ -191,8 +194,10 @@ public class PostgresqlDataSource
191194
* Each datasource maintains it's own driver, in case of
192195
* driver-specific setup (e.g. pools, log writer).
193196
*/
194-
private transient postgresql.Driver _driver;
195-
197+
// FIXME
198+
// private transient postgresql.Driver _driver;
199+
private transient org.postgresql.Driver _driver;
200+
//---------
196201

197202

198203

@@ -223,8 +228,15 @@ public synchronized Connection getConnection( String user, String password )
223228
// Constructs a driver for use just by this data source
224229
// which will produce TwoPhaseConnection-s. This driver
225230
// is not registered with the driver manager.
226-
_driver = new postgresql.Driver();
227-
_driver.setLogWriter( _logWriter );
231+
// FIXME
232+
// _driver = new postgresql.Driver();
233+
_driver = new org.postgresql.Driver();
234+
//-----------
235+
236+
//FIXME
237+
// _driver.setLogWriter( _logWriter );
238+
// Method seems to be unavailable. Just commented it out.
239+
//----------
228240
} catch ( SQLException except ) {
229241
if ( _logWriter != null )
230242
_logWriter.println( "DataSource: Failed to initialize JDBC driver: " + except );
@@ -260,7 +272,10 @@ public synchronized Connection getConnection( String user, String password )
260272
// attempt or a failure.
261273
try {
262274
conn = _driver.connect( url, info );
263-
if ( ! ( conn instanceof postgresql.jdbc2.Connection ) ) {
275+
// FIXME
276+
// if ( ! ( conn instanceof postgresql.jdbc2.Connection ) ) {
277+
if ( ! ( conn instanceof org.postgresql.jdbc2.Connection ) ) {
278+
//--------
264279
if ( _logWriter != null )
265280
_logWriter.println( "DataSource: JDBC 1 connections not supported" );
266281
throw new PSQLException( "postgresql.ds.onlyjdbc2" );
@@ -289,7 +304,10 @@ public synchronized void setLogWriter( PrintWriter writer )
289304
// synchronizing.
290305
if ( writer != null ) {
291306
if ( _driver != null )
292-
_driver.setLogWriter( writer );
307+
// FIXME
308+
// _driver.setLogWriter( writer );
309+
// Method seems to be unavailable. Commented it out.
310+
//----------
293311
_logWriter = writer;
294312
}
295313
}

src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,20 @@ public Timestamp getTimestamp(int columnIndex) throws SQLException
468468
// This works, but it's commented out because Michael Stephenson's
469469
// solution is better still:
470470
//SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
471-
472-
// Michael Stephenson's solution:
471+
// Modification by Jan Thomae
472+
String sub = s.substring(s.length() - 3, s.length()-2);
473+
if (sub.equals("+") || sub.equals("-")) {
474+
s = s.substring(0, s.length()-3) + "GMT"+ s.substring(s.length()-3, s.length())+":00";
475+
}
476+
// -------
477+
// Michael Stephenson's solution:
473478
SimpleDateFormat df = null;
479+
480+
// Modification by Jan Thomae
481+
if (s.length()>27) {
482+
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzzzzzzzz");
483+
} else
484+
// -------
474485
if (s.length()>21 && s.indexOf('.') != -1) {
475486
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSzzz");
476487
} else if (s.length()>19 && s.indexOf('.') == -1) {
@@ -839,14 +850,14 @@ public boolean absolute(int index) throws SQLException
839850

840851
//if index<0, count from the end of the result set, but check
841852
//to be sure that it is not beyond the first index
842-
if (index<0) {
853+
if (index<0)
843854
if (index>=-rows.size())
844855
internalIndex=rows.size()+index;
845856
else {
846857
beforeFirst();
847858
return false;
848859
}
849-
} else {
860+
850861
//must be the case that index>0,
851862
//find the correct place, assuming that
852863
//the index is not too large
@@ -856,7 +867,6 @@ public boolean absolute(int index) throws SQLException
856867
afterLast();
857868
return false;
858869
}
859-
}
860870

861871
current_row=internalIndex;
862872
this_row = (byte [][])rows.elementAt(internalIndex);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy