Skip to content

Commit

Permalink
This commit was manufactured by cvs2svn to create tag 'Release_1_5_0_…
Browse files Browse the repository at this point in the history
…RC4'.
  • Loading branch information
nobody committed Jul 27, 2004
1 parent 70e7e87 commit fa50d8e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 197 deletions.
27 changes: 0 additions & 27 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
2004-07-23 14:15 rrokytskyy

* client-java/src/etc/: release_notes.pdf, release_notes.sxw:

reimported as binary version

2004-07-23 14:10 rrokytskyy

* client-java/src/etc/: release_notes.pdf, release_notes.sxw:

removed due to incorrect type (imported as text)

2004-07-23 13:33 rrokytskyy

* client-java/src/etc/: release_notes.html, release_notes.pdf,
release_notes.sxw:

updated release notes

2004-07-23 12:14 rrokytskyy

*

deprecated batch updates until they are correctly implemented
client-java/src/main/org/firebirdsql/jdbc/AbstractCallableStatement
.java:

2004-07-22 19:32 rrokytskyy

* client-java/src/etc/: release_notes.pdf, release_notes.sxw:
Expand Down
13 changes: 6 additions & 7 deletions src/main/org/firebirdsql/jdbc/AbstractStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,12 @@ public ResultSet getResultSet() throws SQLException {
return rs;
} // end of if ()
else {
if (isResultSet) {
currentRs = new FBResultSet(c, this, fixedStmt,
resultSetListener, false, rsType, rsConcurrency, false);

if (isResultSet){
currentRs = new FBResultSet(
c, this, fixedStmt, resultSetListener, rsType, rsConcurrency);
return currentRs;
} else
}
else
return null;
} // end of else
}
Expand All @@ -564,8 +564,7 @@ ResultSet getCachedResultSet(boolean trimStrings) throws SQLException {
if (fixedStmt == null) {
throw new FBSQLException("No statement was executed.");
}
currentCachedResultSet = new FBResultSet(c, this, fixedStmt,
resultSetListener, trimStrings, rsType, rsConcurrency, true);
currentCachedResultSet = new FBResultSet(c, this, fixedStmt, trimStrings, resultSetListener);
return currentCachedResultSet;
}

Expand Down
35 changes: 4 additions & 31 deletions src/main/org/firebirdsql/jdbc/FBCachedFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,26 +176,14 @@ public boolean previous() throws SQLException {
}

public boolean absolute(int row) throws SQLException {
if (forwardOnly)
throw new FBDriverNotCapableException(
"Result set is TYPE_FORWARD_ONLY");

return absolute(row, false);
}

private boolean absolute(int row, boolean internal) throws SQLException {

if (forwardOnly && !internal)
if (forwardOnly && row > rowNum)
throw new FBDriverNotCapableException(
"Result set is TYPE_FORWARD_ONLY");

if (row < 0)
row = rowsArray.length + row + 1;

if (row == 0 && !internal)
throw new FBSQLException(
"You cannot position to the row 0 with absolute() method.");

if (isEmpty())
return false;

Expand All @@ -221,30 +209,15 @@ private boolean absolute(int row, boolean internal) throws SQLException {
}

public boolean first() throws SQLException {
if (forwardOnly)
throw new FBDriverNotCapableException(
"Result set is TYPE_FORWARD_ONLY");


return absolute(1, true);
return absolute(1);
}

public boolean last() throws SQLException {
if (forwardOnly)
throw new FBDriverNotCapableException(
"Result set is TYPE_FORWARD_ONLY");


return absolute(-1, true);
return absolute(-1);
}

public boolean relative(int row) throws SQLException {
if (forwardOnly)
throw new FBDriverNotCapableException(
"Result set is TYPE_FORWARD_ONLY");


return absolute(rowNum + row, true);
return absolute(rowNum + row);
}

public void beforeFirst() throws SQLException {
Expand Down
57 changes: 21 additions & 36 deletions src/main/org/firebirdsql/jdbc/FBResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,42 +82,27 @@ protected FBResultSet(AbstractConnection c,
AbstractStatement fbstatement,
isc_stmt_handle stmt,
FBObjectListener.ResultSetListener listener,
boolean trimStrings,
int rsType,
int rsConcurrency,
boolean cached)
int rsConcurrency)
throws SQLException {

this.c = c;
this.cursorName = fbstatement.getCursorName();

this.listener = listener;

this.rsType = rsType;
this.rsConcurrency = rsConcurrency;

this.trimStrings = trimStrings;

// check if we are running in paranoia mode
checkParanoiaMode(c);

this.xsqlvars = stmt.getOutSqlda().sqlvar;
this.maxRows = fbstatement.getMaxRows();
xsqlvars = stmt.getOutSqlda().sqlvar;
maxRows = fbstatement.getMaxRows();

boolean updatableCursor = fbstatement.isUpdatableCursor();

//prepareVars((!updatableCursor && rsType == ResultSet.TYPE_SCROLL_INSENSITIVE) || cached);
prepareVars(!updatableCursor && rsType == ResultSet.TYPE_SCROLL_INSENSITIVE);

if (cached) {
prepareVars(true);
if (!updatableCursor && rsType == ResultSet.TYPE_SCROLL_INSENSITIVE)
fbFetcher = new FBCachedFetcher(this.c, fbstatement, stmt, this);
} else
if (!updatableCursor && rsType == ResultSet.TYPE_SCROLL_INSENSITIVE) {
prepareVars(true);
fbFetcher = new FBCachedFetcher(this.c, fbstatement, stmt, this);
} else {
prepareVars(false);

else {
if (rsConcurrency == ResultSet.CONCUR_UPDATABLE) {
c.addWarning(new FBSQLWarning(
"Result set concurrency changed. " +
Expand Down Expand Up @@ -151,21 +136,21 @@ protected FBResultSet(AbstractConnection c,
* in {@link FBDatabaseMetaData} class).
* @throws SQLException if database access error occurs
*/
// protected FBResultSet(AbstractConnection c, AbstractStatement fbStatement,isc_stmt_handle stmt,
// boolean trimStrings, FBObjectListener.ResultSetListener listener)
// throws SQLException
// {
// this.c = c;
// this.trimStrings = trimStrings;
// this.listener = listener;
//
// checkParanoiaMode(c);
//
// maxRows = fbStatement.getMaxRows();
// xsqlvars = stmt.getOutSqlda().sqlvar;
// prepareVars(true);
// fbFetcher = new FBCachedFetcher(this.c, fbStatement, stmt, this);
// }
protected FBResultSet(AbstractConnection c, AbstractStatement fbStatement,isc_stmt_handle stmt,
boolean trimStrings, FBObjectListener.ResultSetListener listener)
throws SQLException
{
this.c = c;
this.trimStrings = trimStrings;
this.listener = listener;

checkParanoiaMode(c);

maxRows = fbStatement.getMaxRows();
xsqlvars = stmt.getOutSqlda().sqlvar;
prepareVars(true);
fbFetcher = new FBCachedFetcher(this.c, fbStatement, stmt, this);
}

protected FBResultSet(XSQLVAR[] xsqlvars, ArrayList rows) throws SQLException {
maxRows = 0;
Expand Down
96 changes: 0 additions & 96 deletions src/test/org/firebirdsql/jdbc/TestFBResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -509,100 +509,4 @@ public void testBugReport1() throws Exception {
stmt.close();
}
}

/**
* Test if result set type and concurrency is correct.
*
* @throws Exception if something went wrong.
*/
public void testBugReport2() throws Exception {
int recordCount = 10;

PreparedStatement ps =
connection.prepareStatement(INSERT_INTO_TABLE_STATEMENT);

try {
for(int i = 0; i < recordCount; i++) {
ps.setInt(1, i);
ps.setInt(2, i);
ps.executeUpdate();
}
} finally {
ps.close();
}

connection.setAutoCommit(false);

Statement stmt = connection.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);

try {
ResultSet rs = stmt.executeQuery("SELECT id, str FROM test_table");

assertTrue("Should have at least one row", rs.next());

assertTrue("ResultSet type should be TYPE_SCROLL_INSENSITIVE",
rs.getType() == ResultSet.TYPE_SCROLL_INSENSITIVE);

assertTrue("ResultSet concurrency should be CONCUR_READ_ONLY",
rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY);

rs.last();

assertTrue("ResultSet type should not change.",
rs.getType() == ResultSet.TYPE_SCROLL_INSENSITIVE);

} finally {
stmt.close();
}
}

public void testBugReport3() throws Exception {
int recordCount = 10;

PreparedStatement ps =
connection.prepareStatement(INSERT_INTO_TABLE_STATEMENT);

try {
for(int i = 0; i < recordCount; i++) {
ps.setInt(1, i);
ps.setInt(2, i);
ps.executeUpdate();
}
} finally {
ps.close();
}

connection.setAutoCommit(true);

Statement stmt = connection.createStatement(
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);

try {
ResultSet rs = stmt.executeQuery("SELECT id, str FROM test_table");

try {
rs.first();
fail("first() should not work in TYPE_FORWARD_ONLY result sets");
} catch(SQLException ex) {
// should fail, everything is fine.
}

while(rs.next()) {
// do nothing, just loop.
}

try {
rs.first();
fail("first() should not work in TYPE_FORWARD_ONLY result sets.");
} catch(SQLException ex) {
// everything is fine
}

} finally {
stmt.close();
}
}
}

0 comments on commit fa50d8e

Please sign in to comment.