1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

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.
This commit is contained in:
Peter Mount
2001-01-18 17:37:15 +00:00
parent 45b5d792af
commit 8bc9f0016b
9 changed files with 347 additions and 195 deletions

View File

@ -1,3 +1,39 @@
Thu Jan 18 17:30: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.
Thu Jan 18 12:24:00 GMT 2001 peter@retep.org.uk Thu Jan 18 12:24:00 GMT 2001 peter@retep.org.uk
- These methods in org.postgresql.jdbc2.ResultSet are now implemented: - These methods in org.postgresql.jdbc2.ResultSet are now implemented:
getBigDecimal(int) ie: without a scale (why did this get missed?) getBigDecimal(int) ie: without a scale (why did this get missed?)

View File

@ -3,7 +3,7 @@
build file to allow ant (http://jakarta.apache.org/ant/) to be used build file to allow ant (http://jakarta.apache.org/ant/) to be used
to build the PostgreSQL JDBC Driver. to build the PostgreSQL JDBC Driver.
$Id: build.xml,v 1.3 2001/01/18 14:50:14 peter Exp $ $Id: build.xml,v 1.4 2001/01/18 17:37:11 peter Exp $
--> -->
@ -95,9 +95,28 @@
</copy> </copy>
</target> </target>
<!-- This builds the examples -->
<target name="examples" depends="compile">
<javac srcdir="${src}" destdir="${dest}">
<include name="example/**" />
<exclude name="example/corba/**"/>
</javac>
</target>
<!-- Builds the corba example -->
<target name="corba" if="jdk1.2+">
<exec dir="${src}/example/corba" executable="idl2java">
<arg value="stock.idl" />
</exec>
<javac srcdir="${src}" destdir="${dest}">
<include name="example/corba/**" />
</javac>
</target>
<!-- This builds the jar file containing the driver --> <!-- This builds the jar file containing the driver -->
<target name="jar" depends="compile"> <target name="jar" depends="compile,examples">
<jar jarfile="${jars}/postgresql.jar" basedir="${dest}" includes="org/**" /> <jar jarfile="${jars}/postgresql.jar" basedir="${dest}" includes="org/**" />
<jar jarfile="${jars}/postgresql-examples.jar" basedir="${dest}" includes="example/**" />
</target> </target>
<!-- <!--

View File

@ -27,5 +27,6 @@
<file path="CHANGELOG" /> <file path="CHANGELOG" />
<file path="Implementation" /> <file path="Implementation" />
<file path="README" /> <file path="README" />
<file path="org/postgresql/jdbc2/UpdateableResultSet.java" />
</project> </project>

View File

@ -10,7 +10,7 @@ import org.postgresql.largeobject.*;
import org.postgresql.util.*; import org.postgresql.util.*;
/** /**
* $Id: Connection.java,v 1.12 2001/01/18 14:50:14 peter Exp $ * $Id: Connection.java,v 1.13 2001/01/18 17:37:12 peter Exp $
* *
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or * This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
* JDBC2 versions of the Connection class. * JDBC2 versions of the Connection class.
@ -396,6 +396,23 @@ public abstract class Connection
* @exception SQLException if a database error occurs * @exception SQLException if a database error occurs
*/ */
public java.sql.ResultSet ExecSQL(String sql) throws SQLException public java.sql.ResultSet ExecSQL(String sql) throws SQLException
{
return ExecSQL(sql,null);
}
/**
* Send a query to the backend. Returns one of the ResultSet
* objects.
*
* <B>Note:</B> there does not seem to be any method currently
* in existance to return the update count.
*
* @param sql the SQL statement to be executed
* @param stat The Statement associated with this query (may be null)
* @return a ResultSet holding the results
* @exception SQLException if a database error occurs
*/
public java.sql.ResultSet ExecSQL(String sql,java.sql.Statement stat) throws SQLException
{ {
// added Oct 7 1998 to give us thread safety. // added Oct 7 1998 to give us thread safety.
synchronized(pg_stream) { synchronized(pg_stream) {
@ -541,7 +558,7 @@ public abstract class Connection
if (final_error != null) if (final_error != null)
throw final_error; throw final_error;
return getResultSet(this, fields, tuples, recv_status, update_count, insert_oid); return getResultSet(this, stat, fields, tuples, recv_status, update_count, insert_oid);
} }
} }
@ -852,7 +869,7 @@ public abstract class Connection
* This returns a resultset. It must be overridden, so that the correct * This returns a resultset. It must be overridden, so that the correct
* version (from jdbc1 or jdbc2) are returned. * version (from jdbc1 or jdbc2) are returned.
*/ */
protected abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException; 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;
public abstract void close() throws SQLException; public abstract void close() throws SQLException;

View File

@ -35,7 +35,8 @@ postgresql.geo.point:Conversion of point failed - {0}
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} 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}
postgresql.lo.init:failed to initialise LargeObject API postgresql.lo.init:failed to initialise LargeObject API
postgresql.money:conversion of money failed - {0}. postgresql.money:conversion of money failed - {0}.
postgresql.noupdate:This ResultSet is not updateable postgresql.noupdate:This ResultSet is not updateable.
postgresql.notsensitive:This ResultSet is not sensitive to realtime updates after the query has run.
postgresql.psqlnotimp:The backend currently does not support this feature. postgresql.psqlnotimp:The backend currently does not support this feature.
postgresql.prep.is:InputStream as parameter not supported postgresql.prep.is:InputStream as parameter not supported
postgresql.prep.param:No value specified for parameter {0}. postgresql.prep.param:No value specified for parameter {0}.

View File

@ -17,7 +17,7 @@ import org.postgresql.largeobject.*;
import org.postgresql.util.*; import org.postgresql.util.*;
/** /**
* $Id: Connection.java,v 1.4 2000/10/09 16:48:17 momjian Exp $ * $Id: Connection.java,v 1.5 2001/01/18 17:37:13 peter Exp $
* *
* A Connection represents a session with a specific database. Within the * A Connection represents a session with a specific database. Within the
* context of a Connection, SQL statements are executed and results are * context of a Connection, SQL statements are executed and results are
@ -378,8 +378,9 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
* This overides the method in org.postgresql.Connection and returns a * This overides the method in org.postgresql.Connection and returns a
* ResultSet. * ResultSet.
*/ */
protected java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException 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
{ {
// in jdbc1 stat is ignored.
return new org.postgresql.jdbc1.ResultSet((org.postgresql.jdbc1.Connection)conn,fields,tuples,status,updateCount,insertOID); return new org.postgresql.jdbc1.ResultSet((org.postgresql.jdbc1.Connection)conn,fields,tuples,status,updateCount,insertOID);
} }

View File

@ -17,7 +17,7 @@ import org.postgresql.largeobject.*;
import org.postgresql.util.*; import org.postgresql.util.*;
/** /**
* $Id: Connection.java,v 1.4 2000/10/09 16:48:18 momjian Exp $ * $Id: Connection.java,v 1.5 2001/01/18 17:37:14 peter Exp $
* *
* A Connection represents a session with a specific database. Within the * A Connection represents a session with a specific database. Within the
* context of a Connection, SQL statements are executed and results are * context of a Connection, SQL statements are executed and results are
@ -39,6 +39,8 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
// This is a cache of the DatabaseMetaData instance for this connection // This is a cache of the DatabaseMetaData instance for this connection
protected DatabaseMetaData metadata; protected DatabaseMetaData metadata;
protected java.util.Map typemap;
/** /**
* SQL statements without parameters are normally executed using * SQL statements without parameters are normally executed using
* Statement objects. If the same SQL statement is executed many * Statement objects. If the same SQL statement is executed many
@ -49,9 +51,30 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
*/ */
public java.sql.Statement createStatement() throws SQLException public java.sql.Statement createStatement() throws SQLException
{ {
return new Statement(this); // The spec says default of TYPE_FORWARD_ONLY but everyone is used to
// using TYPE_SCROLL_INSENSITIVE
return createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
} }
/**
* SQL statements without parameters are normally executed using
* Statement objects. If the same SQL statement is executed many
* times, it is more efficient to use a PreparedStatement
*
* @param resultSetType to use
* @param resultSetCuncurrency to use
* @return a new Statement object
* @exception SQLException passed through from the constructor
*/
public java.sql.Statement createStatement(int resultSetType,int resultSetConcurrency) throws SQLException
{
Statement s = new Statement(this);
s.setResultSetType(resultSetType);
s.setResultSetConcurrency(resultSetConcurrency);
return s;
}
/** /**
* A SQL statement with or without IN parameters can be pre-compiled * A SQL statement with or without IN parameters can be pre-compiled
* and stored in a PreparedStatement object. This object can then * and stored in a PreparedStatement object. This object can then
@ -72,7 +95,15 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
*/ */
public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException
{ {
return new PreparedStatement(this, sql); return prepareStatement(sql,java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
}
public java.sql.PreparedStatement prepareStatement(String sql,int resultSetType,int resultSetConcurrency) throws SQLException
{
PreparedStatement s = new PreparedStatement(this,sql);
s.setResultSetType(resultSetType);
s.setResultSetConcurrency(resultSetConcurrency);
return s;
} }
/** /**
@ -96,10 +127,19 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
*/ */
public java.sql.CallableStatement prepareCall(String sql) throws SQLException public java.sql.CallableStatement prepareCall(String sql) throws SQLException
{ {
throw new PSQLException("postgresql.con.call"); return prepareCall(sql,java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
// return new CallableStatement(this, sql);
} }
public java.sql.CallableStatement prepareCall(String sql,int resultSetType,int resultSetConcurrency) throws SQLException
{
throw new PSQLException("postgresql.con.call");
//CallableStatement s = new CallableStatement(this,sql);
//s.setResultSetType(resultSetType);
//s.setResultSetConcurrency(resultSetConcurrency);
//return s;
}
/** /**
* A driver may convert the JDBC sql grammar into its system's * A driver may convert the JDBC sql grammar into its system's
* native SQL grammar prior to sending it; nativeSQL returns the * native SQL grammar prior to sending it; nativeSQL returns the
@ -378,8 +418,15 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
* This overides the method in org.postgresql.Connection and returns a * This overides the method in org.postgresql.Connection and returns a
* ResultSet. * ResultSet.
*/ */
protected java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount, int insertOID) throws SQLException 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
{ {
// In 7.1 we now test concurrency to see which class to return. If we are not working with a
// Statement then default to a normal ResultSet object.
if(stat!=null) {
if(stat.getResultSetConcurrency()==java.sql.ResultSet.CONCUR_UPDATABLE)
return new org.postgresql.jdbc2.UpdateableResultSet((org.postgresql.jdbc2.Connection)conn,fields,tuples,status,updateCount,insertOID);
}
return new org.postgresql.jdbc2.ResultSet((org.postgresql.jdbc2.Connection)conn,fields,tuples,status,updateCount,insertOID); return new org.postgresql.jdbc2.ResultSet((org.postgresql.jdbc2.Connection)conn,fields,tuples,status,updateCount,insertOID);
} }
@ -387,54 +434,40 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
// JDBC 2 extensions // JDBC 2 extensions
// ***************** // *****************
public java.sql.Statement createStatement(int resultSetType,int resultSetConcurrency) throws SQLException
{
// normal create followed by 2 sets?
throw org.postgresql.Driver.notImplemented();
}
public java.sql.PreparedStatement prepareStatement(String sql,int resultSetType,int resultSetConcurrency) throws SQLException
{
// normal prepare followed by 2 sets?
throw org.postgresql.Driver.notImplemented();
}
public java.sql.CallableStatement prepareCall(String sql,int resultSetType,int resultSetConcurrency) throws SQLException
{
// normal prepare followed by 2 sets?
throw org.postgresql.Driver.notImplemented();
}
public int getResultSetConcurrency() throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public int getResultSetType() throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public java.util.Map getTypeMap() throws SQLException public java.util.Map getTypeMap() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // new in 7.1
return typemap;
} }
public void setResultSetConcurrency(int value) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public void setResultSetType(int type) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public void setTypeMap(java.util.Map map) throws SQLException public void setTypeMap(java.util.Map map) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // new in 7.1
typemap=map;
} }
/**
* This overides the standard internal getObject method so that we can
* check the jdbc2 type map first
*
* @return PGobject for this type, and set to value
* @exception SQLException if value is not correct for this type
* @see org.postgresql.util.Serialize
*/
public Object getObject(String type,String value) throws SQLException
{
if(typemap!=null) {
SQLData d = (SQLData) typemap.get(type);
if(d!=null) {
// Handle the type (requires SQLInput & SQLOutput classes to be implemented)
throw org.postgresql.Driver.notImplemented();
}
}
// Default to the original method
return super.getObject(type,value);
}
} }
// *********************************************************************** // ***********************************************************************

View File

@ -59,6 +59,8 @@ import org.postgresql.util.*;
*/ */
public class ResultSet extends org.postgresql.ResultSet implements java.sql.ResultSet public class ResultSet extends org.postgresql.ResultSet implements java.sql.ResultSet
{ {
protected org.postgresql.jdbc2.Statement statement;
/** /**
* Create a new ResultSet - Note that we create ResultSets to * Create a new ResultSet - Note that we create ResultSets to
* represent the results of everything. * represent the results of everything.
@ -1086,7 +1088,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void insertRow() throws SQLException public void insertRow() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public boolean isAfterLast() throws SQLException public boolean isAfterLast() throws SQLException
@ -1120,12 +1123,14 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void moveToCurrentRow() throws SQLException public void moveToCurrentRow() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void moveToInsertRow() throws SQLException public void moveToInsertRow() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public boolean previous() throws SQLException public boolean previous() throws SQLException
@ -1138,7 +1143,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void refreshRow() throws SQLException public void refreshRow() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); throw new PSQLException("postgresql.notsensitive");
} }
// Peter: Implemented in 7.0 // Peter: Implemented in 7.0
@ -1150,40 +1155,49 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public boolean rowDeleted() throws SQLException public boolean rowDeleted() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
return false; // javac complains about not returning a value!
} }
public boolean rowInserted() throws SQLException public boolean rowInserted() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
return false; // javac complains about not returning a value!
} }
public boolean rowUpdated() throws SQLException public boolean rowUpdated() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
return false; // javac complains about not returning a value!
} }
public void setFetchDirection(int direction) throws SQLException public void setFetchDirection(int direction) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // In 7.1, the backend doesn't yet support this
throw new PSQLException("postgresql.psqlnotimp");
} }
public void setFetchSize(int rows) throws SQLException public void setFetchSize(int rows) throws SQLException
{ {
// Sub-classes should implement this as part of their cursor support
throw org.postgresql.Driver.notImplemented(); throw org.postgresql.Driver.notImplemented();
} }
public void setKeysetSize(int keys) throws SQLException //public void setKeysetSize(int keys) throws SQLException
{ //{
throw org.postgresql.Driver.notImplemented(); //throw org.postgresql.Driver.notImplemented();
} //}
public void updateAsciiStream(int columnIndex, public void updateAsciiStream(int columnIndex,
java.io.InputStream x, java.io.InputStream x,
int length int length
) throws SQLException ) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateAsciiStream(String columnName, public void updateAsciiStream(String columnName,
@ -1198,7 +1212,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
java.math.BigDecimal x java.math.BigDecimal x
) throws SQLException ) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateBigDecimal(String columnName, public void updateBigDecimal(String columnName,
@ -1213,7 +1228,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
int length int length
) throws SQLException ) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateBinaryStream(String columnName, public void updateBinaryStream(String columnName,
@ -1226,7 +1242,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateBoolean(int columnIndex,boolean x) throws SQLException public void updateBoolean(int columnIndex,boolean x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateBoolean(String columnName,boolean x) throws SQLException public void updateBoolean(String columnName,boolean x) throws SQLException
@ -1236,7 +1253,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateByte(int columnIndex,byte x) throws SQLException public void updateByte(int columnIndex,byte x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateByte(String columnName,byte x) throws SQLException public void updateByte(String columnName,byte x) throws SQLException
@ -1251,7 +1269,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateBytes(int columnIndex,byte[] x) throws SQLException public void updateBytes(int columnIndex,byte[] x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateCharacterStream(int columnIndex, public void updateCharacterStream(int columnIndex,
@ -1259,7 +1278,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
int length int length
) throws SQLException ) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateCharacterStream(String columnName, public void updateCharacterStream(String columnName,
@ -1272,7 +1292,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateDate(int columnIndex,java.sql.Date x) throws SQLException public void updateDate(int columnIndex,java.sql.Date x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateDate(String columnName,java.sql.Date x) throws SQLException public void updateDate(String columnName,java.sql.Date x) throws SQLException
@ -1282,7 +1303,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateDouble(int columnIndex,double x) throws SQLException public void updateDouble(int columnIndex,double x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateDouble(String columnName,double x) throws SQLException public void updateDouble(String columnName,double x) throws SQLException
@ -1292,7 +1314,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateFloat(int columnIndex,float x) throws SQLException public void updateFloat(int columnIndex,float x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateFloat(String columnName,float x) throws SQLException public void updateFloat(String columnName,float x) throws SQLException
@ -1302,7 +1325,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateInt(int columnIndex,int x) throws SQLException public void updateInt(int columnIndex,int x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateInt(String columnName,int x) throws SQLException public void updateInt(String columnName,int x) throws SQLException
@ -1312,7 +1336,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateLong(int columnIndex,long x) throws SQLException public void updateLong(int columnIndex,long x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateLong(String columnName,long x) throws SQLException public void updateLong(String columnName,long x) throws SQLException
@ -1322,7 +1347,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateNull(int columnIndex) throws SQLException public void updateNull(int columnIndex) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateNull(String columnName) throws SQLException public void updateNull(String columnName) throws SQLException
@ -1332,7 +1358,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateObject(int columnIndex,Object x) throws SQLException public void updateObject(int columnIndex,Object x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateObject(String columnName,Object x) throws SQLException public void updateObject(String columnName,Object x) throws SQLException
@ -1342,7 +1369,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateObject(int columnIndex,Object x,int scale) throws SQLException public void updateObject(int columnIndex,Object x,int scale) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateObject(String columnName,Object x,int scale) throws SQLException public void updateObject(String columnName,Object x,int scale) throws SQLException
@ -1352,12 +1380,14 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateRow() throws SQLException public void updateRow() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateShort(int columnIndex,short x) throws SQLException public void updateShort(int columnIndex,short x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateShort(String columnName,short x) throws SQLException public void updateShort(String columnName,short x) throws SQLException
@ -1367,7 +1397,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateString(int columnIndex,String x) throws SQLException public void updateString(int columnIndex,String x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateString(String columnName,String x) throws SQLException public void updateString(String columnName,String x) throws SQLException
@ -1377,7 +1408,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateTime(int columnIndex,Time x) throws SQLException public void updateTime(int columnIndex,Time x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateTime(String columnName,Time x) throws SQLException public void updateTime(String columnName,Time x) throws SQLException
@ -1387,7 +1419,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public void updateTimestamp(int columnIndex,Timestamp x) throws SQLException public void updateTimestamp(int columnIndex,Timestamp x) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // only sub-classes implement CONCUR_UPDATEABLE
notUpdateable();
} }
public void updateTimestamp(String columnName,Timestamp x) throws SQLException public void updateTimestamp(String columnName,Timestamp x) throws SQLException
@ -1406,7 +1439,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
* It's used currently by getStatement() but may also with the new core * It's used currently by getStatement() but may also with the new core
* package. * package.
*/ */
public void setStatement(org.postgresql.Statement statement) { public void setStatement(org.postgresql.jdbc2.Statement statement) {
this.statement=statement; this.statement=statement;
} }

View File

@ -30,6 +30,8 @@ public class Statement implements java.sql.Statement
int timeout = 0; // The timeout for a query (not used) int timeout = 0; // The timeout for a query (not used)
boolean escapeProcessing = true;// escape processing flag boolean escapeProcessing = true;// escape processing flag
private Vector batch=null; private Vector batch=null;
int resultsettype; // the resultset type to return
int concurrency; // is it updateable or not?
/** /**
* Constructor for a Statement. It simply sets the connection * Constructor for a Statement. It simply sets the connection
@ -40,6 +42,8 @@ public class Statement implements java.sql.Statement
public Statement (Connection c) public Statement (Connection c)
{ {
connection = c; connection = c;
resultsettype = java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE;
concurrency = java.sql.ResultSet.CONCUR_READ_ONLY;
} }
/** /**
@ -271,6 +275,10 @@ public class Statement implements java.sql.Statement
sql=connection.EscapeSQL(sql); sql=connection.EscapeSQL(sql);
result = connection.ExecSQL(sql); result = connection.ExecSQL(sql);
// New in 7.1, required for ResultSet.getStatement() to work
((org.postgresql.jdbc2.ResultSet)result).setStatement(this);
return (result != null && ((org.postgresql.ResultSet)result).reallyResultSet()); return (result != null && ((org.postgresql.ResultSet)result).reallyResultSet());
} }
@ -369,27 +377,30 @@ public class Statement implements java.sql.Statement
public int getFetchDirection() throws SQLException public int getFetchDirection() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); throw new PSQLException("postgresql.psqlnotimp");
} }
public int getFetchSize() throws SQLException public int getFetchSize() throws SQLException
{ {
// This one can only return a valid value when were a cursor?
throw org.postgresql.Driver.notImplemented(); throw org.postgresql.Driver.notImplemented();
} }
public int getKeysetSize() throws SQLException //public int getKeysetSize() throws SQLException
{ //{
throw org.postgresql.Driver.notImplemented(); // throw org.postgresql.Driver.notImplemented();
} //}
public int getResultSetConcurrency() throws SQLException public int getResultSetConcurrency() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // new in 7.1
return concurrency;
} }
public int getResultSetType() throws SQLException public int getResultSetType() throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); // new in 7.1
return resultsettype;
} }
public void setFetchDirection(int direction) throws SQLException public void setFetchDirection(int direction) throws SQLException
@ -402,19 +413,19 @@ public class Statement implements java.sql.Statement
throw org.postgresql.Driver.notImplemented(); throw org.postgresql.Driver.notImplemented();
} }
public void setKeysetSize(int keys) throws SQLException //public void setKeysetSize(int keys) throws SQLException
{ //{
throw org.postgresql.Driver.notImplemented(); // throw org.postgresql.Driver.notImplemented();
} //}
public void setResultSetConcurrency(int value) throws SQLException public void setResultSetConcurrency(int value) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); concurrency=value;
} }
public void setResultSetType(int value) throws SQLException public void setResultSetType(int value) throws SQLException
{ {
throw org.postgresql.Driver.notImplemented(); resultsettype=value;
} }
} }