mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 22:26:49 +02:00
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
This commit is contained in:
parent
a210023008
commit
960c186184
@ -40,7 +40,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $Id: PostgresqlDataSource.java,v 1.1 2000/10/12 08:55:24 peter Exp $
|
* $Id: PostgresqlDataSource.java,v 1.2 2000/11/10 22:06:26 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -64,9 +64,12 @@ import javax.naming.Context;
|
|||||||
import javax.naming.Name;
|
import javax.naming.Name;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
import javax.naming.spi.ObjectFactory;
|
import javax.naming.spi.ObjectFactory;
|
||||||
import postgresql.util.PSQLException;
|
// FIXME
|
||||||
import postgresql.xa.XADataSourceImpl;
|
//import postgresql.util.PSQLException;
|
||||||
|
//import postgresql.xa.XADataSourceImpl;
|
||||||
|
import org.postgresql.util.PSQLException;
|
||||||
|
import org.postgresql.xa.XADataSourceImpl;
|
||||||
|
//---------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a JDBC 2.0 {@link javax.sql.DataSource} for the
|
* Implements a JDBC 2.0 {@link javax.sql.DataSource} for the
|
||||||
@ -191,8 +194,10 @@ public class PostgresqlDataSource
|
|||||||
* Each datasource maintains it's own driver, in case of
|
* Each datasource maintains it's own driver, in case of
|
||||||
* driver-specific setup (e.g. pools, log writer).
|
* driver-specific setup (e.g. pools, log writer).
|
||||||
*/
|
*/
|
||||||
private transient postgresql.Driver _driver;
|
// FIXME
|
||||||
|
// private transient postgresql.Driver _driver;
|
||||||
|
private transient org.postgresql.Driver _driver;
|
||||||
|
//---------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -223,8 +228,15 @@ public class PostgresqlDataSource
|
|||||||
// Constructs a driver for use just by this data source
|
// Constructs a driver for use just by this data source
|
||||||
// which will produce TwoPhaseConnection-s. This driver
|
// which will produce TwoPhaseConnection-s. This driver
|
||||||
// is not registered with the driver manager.
|
// is not registered with the driver manager.
|
||||||
_driver = new postgresql.Driver();
|
// FIXME
|
||||||
_driver.setLogWriter( _logWriter );
|
// _driver = new postgresql.Driver();
|
||||||
|
_driver = new org.postgresql.Driver();
|
||||||
|
//-----------
|
||||||
|
|
||||||
|
//FIXME
|
||||||
|
// _driver.setLogWriter( _logWriter );
|
||||||
|
// Method seems to be unavailable. Just commented it out.
|
||||||
|
//----------
|
||||||
} catch ( SQLException except ) {
|
} catch ( SQLException except ) {
|
||||||
if ( _logWriter != null )
|
if ( _logWriter != null )
|
||||||
_logWriter.println( "DataSource: Failed to initialize JDBC driver: " + except );
|
_logWriter.println( "DataSource: Failed to initialize JDBC driver: " + except );
|
||||||
@ -260,7 +272,10 @@ public class PostgresqlDataSource
|
|||||||
// attempt or a failure.
|
// attempt or a failure.
|
||||||
try {
|
try {
|
||||||
conn = _driver.connect( url, info );
|
conn = _driver.connect( url, info );
|
||||||
if ( ! ( conn instanceof postgresql.jdbc2.Connection ) ) {
|
// FIXME
|
||||||
|
// if ( ! ( conn instanceof postgresql.jdbc2.Connection ) ) {
|
||||||
|
if ( ! ( conn instanceof org.postgresql.jdbc2.Connection ) ) {
|
||||||
|
//--------
|
||||||
if ( _logWriter != null )
|
if ( _logWriter != null )
|
||||||
_logWriter.println( "DataSource: JDBC 1 connections not supported" );
|
_logWriter.println( "DataSource: JDBC 1 connections not supported" );
|
||||||
throw new PSQLException( "postgresql.ds.onlyjdbc2" );
|
throw new PSQLException( "postgresql.ds.onlyjdbc2" );
|
||||||
@ -289,7 +304,10 @@ public class PostgresqlDataSource
|
|||||||
// synchronizing.
|
// synchronizing.
|
||||||
if ( writer != null ) {
|
if ( writer != null ) {
|
||||||
if ( _driver != null )
|
if ( _driver != null )
|
||||||
_driver.setLogWriter( writer );
|
// FIXME
|
||||||
|
// _driver.setLogWriter( writer );
|
||||||
|
// Method seems to be unavailable. Commented it out.
|
||||||
|
//----------
|
||||||
_logWriter = writer;
|
_logWriter = writer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -468,9 +468,20 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
// This works, but it's commented out because Michael Stephenson's
|
// This works, but it's commented out because Michael Stephenson's
|
||||||
// solution is better still:
|
// solution is better still:
|
||||||
//SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
//SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// Modification by Jan Thomae
|
||||||
|
String sub = s.substring(s.length() - 3, s.length()-2);
|
||||||
|
if (sub.equals("+") || sub.equals("-")) {
|
||||||
|
s = s.substring(0, s.length()-3) + "GMT"+ s.substring(s.length()-3, s.length())+":00";
|
||||||
|
}
|
||||||
|
// -------
|
||||||
// Michael Stephenson's solution:
|
// Michael Stephenson's solution:
|
||||||
SimpleDateFormat df = null;
|
SimpleDateFormat df = null;
|
||||||
|
|
||||||
|
// Modification by Jan Thomae
|
||||||
|
if (s.length()>27) {
|
||||||
|
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzzzzzzzz");
|
||||||
|
} else
|
||||||
|
// -------
|
||||||
if (s.length()>21 && s.indexOf('.') != -1) {
|
if (s.length()>21 && s.indexOf('.') != -1) {
|
||||||
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSzzz");
|
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSzzz");
|
||||||
} else if (s.length()>19 && s.indexOf('.') == -1) {
|
} else if (s.length()>19 && s.indexOf('.') == -1) {
|
||||||
@ -839,14 +850,14 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
|
|
||||||
//if index<0, count from the end of the result set, but check
|
//if index<0, count from the end of the result set, but check
|
||||||
//to be sure that it is not beyond the first index
|
//to be sure that it is not beyond the first index
|
||||||
if (index<0) {
|
if (index<0)
|
||||||
if (index>=-rows.size())
|
if (index>=-rows.size())
|
||||||
internalIndex=rows.size()+index;
|
internalIndex=rows.size()+index;
|
||||||
else {
|
else {
|
||||||
beforeFirst();
|
beforeFirst();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//must be the case that index>0,
|
//must be the case that index>0,
|
||||||
//find the correct place, assuming that
|
//find the correct place, assuming that
|
||||||
//the index is not too large
|
//the index is not too large
|
||||||
@ -856,7 +867,6 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
afterLast();
|
afterLast();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
current_row=internalIndex;
|
current_row=internalIndex;
|
||||||
this_row = (byte [][])rows.elementAt(internalIndex);
|
this_row = (byte [][])rows.elementAt(internalIndex);
|
||||||
|
Loading…
Reference in New Issue
Block a user