mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
Added org/postgresql/DriverClass.java to the list of files removed by make clean (it's dynamically built)
Fixed Statement, so that the update count is valid when an SQL DELETE operation is done. While fixing the update count, made it easier to get the OID of the last insert as well. Example is in example/basic.java
This commit is contained in:
@ -19,6 +19,7 @@ public abstract class ResultSet
|
||||
protected Field fields[]; // The field descriptions
|
||||
protected String status; // Status of the result
|
||||
protected int updateCount; // How many rows did we get back?
|
||||
protected int insertOID; // The oid of an inserted row
|
||||
protected int current_row; // Our pointer to where we are at
|
||||
protected byte[][] this_row; // the current row result
|
||||
protected Connection connection; // the connection which we returned from
|
||||
@ -40,17 +41,35 @@ public abstract class ResultSet
|
||||
* @param updateCount the number of rows affected by the operation
|
||||
* @param cursor the positioned update/delete cursor name
|
||||
*/
|
||||
public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
|
||||
public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID)
|
||||
{
|
||||
this.connection = conn;
|
||||
this.fields = fields;
|
||||
this.rows = tuples;
|
||||
this.status = status;
|
||||
this.updateCount = updateCount;
|
||||
this.insertOID = insertOID;
|
||||
this.this_row = null;
|
||||
this.current_row = -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new ResultSet - Note that we create ResultSets to
|
||||
* represent the results of everything.
|
||||
*
|
||||
* @param fields an array of Field objects (basically, the
|
||||
* ResultSet MetaData)
|
||||
* @param tuples Vector of the actual data
|
||||
* @param status the status string returned from the back end
|
||||
* @param updateCount the number of rows affected by the operation
|
||||
* @param cursor the positioned update/delete cursor name
|
||||
*/
|
||||
public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
|
||||
{
|
||||
this(conn,fields,tuples,status,updateCount,0);
|
||||
}
|
||||
|
||||
/**
|
||||
* We at times need to know if the resultSet we are working
|
||||
* with is the result of an UPDATE, DELETE or INSERT (in which
|
||||
@ -148,6 +167,14 @@ public abstract class ResultSet
|
||||
return fields[field-1].getOID();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the OID of the last inserted row
|
||||
*/
|
||||
public int getInsertedOID()
|
||||
{
|
||||
return insertOID;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is part of the JDBC API, but is required by org.postgresql.Field
|
||||
*/
|
||||
|
Reference in New Issue
Block a user