You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by be...@apache.org on 2006/04/21 14:12:43 UTC
svn commit: r395866 [1/2] - in /db/derby/code/trunk/java:
build/org/apache/derbyBuild/ client/org/apache/derby/client/am/
client/org/apache/derby/client/net/ drda/org/apache/derby/impl/drda/
engine/org/apache/derby/impl/sql/catalog/ engine/org/apache/d...
Author: bernt
Date: Fri Apr 21 05:12:36 2006
New Revision: 395866
URL: http://svn.apache.org/viewcvs?rev=395866&view=rev
Log:
DERBY-775 Network client: Add support for scrollable, updatable, insensitive result sets. Submitted by Dag H. Wanvik
Modified:
db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java
db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java
db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java
db/derby/code/trunk/java/client/org/apache/derby/client/am/Cursor.java
db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java
db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/CodePoint.java
db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java
db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk16/updatableResultSet.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/resultset.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/scrollCursors2.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk14/updatableResultSet.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/updatableResultSet.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/scrollCursors2.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
Modified: db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java (original)
+++ db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java Fri Apr 21 05:12:36 2006
@@ -83,6 +83,7 @@
clientMessageIds.add(SQLState.NUMBER_OF_ROWS_TOO_LARGE_FOR_INT);
clientMessageIds.add(SQLState.NOGETCONN_ON_CLOSED_POOLED_CONNECTION);
clientMessageIds.add(SQLState.LOB_METHOD_ON_CLOSED_CONNECTION);
+ clientMessageIds.add(SQLState.QUERY_NOT_QUALIFIED_FOR_UPDATABLE_RESULTSET);
clientMessageIds.add(SQLState.LANG_INVALID_CALL_TO_EXECUTE_UPDATE);
clientMessageIds.add(SQLState.LANG_CANT_INVALIDATE_OPEN_RESULT_SET);
clientMessageIds.add(SQLState.YEAR_EXCEEDS_MAXIMUM);
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java Fri Apr 21 05:12:36 2006
@@ -139,7 +139,8 @@
* which implements java.sql.ResultSet
*/
ResultSet newNetResultSet(Agent netAgent,MaterialStatement netStatement,
- Cursor cursor,int sqlcsrhld,int qryattscr,int qryattsns,
+ Cursor cursor,
+ int qryprctyp, int sqlcsrhld, int qryattscr, int qryattsns,
int qryattset,long qryinsid,int actualResultSetType,
int actualResultSetConcurrency,int actualResultSetHoldability)
throws SqlException;
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java Fri Apr 21 05:12:36 2006
@@ -1138,18 +1138,6 @@
return resultSetType;
}
- // Per jdbc spec, when a result set concurrency is unsupported, we downgrade and
- // issue a warning rather than to throw an exception.
- private int downgradeResultSetConcurrency(int resultSetConcurrency, int resultSetType) {
- if (resultSetConcurrency == java.sql.ResultSet.CONCUR_UPDATABLE &&
- resultSetType == java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE) {
- accumulateWarning(new SqlWarning(agent_.logWriter_,
- new MessageId(SQLState.INSENSITIVE_UPDATABLE_NOT_SUPPORTED)));
- return java.sql.ResultSet.CONCUR_READ_ONLY;
- }
- return resultSetConcurrency;
- }
-
public java.util.Map getTypeMap() throws SQLException {
try
{
@@ -1461,7 +1449,6 @@
int resultSetHoldability) throws SqlException {
checkForClosedConnection();
resultSetType = downgradeResultSetType(resultSetType);
- resultSetConcurrency = downgradeResultSetConcurrency(resultSetConcurrency, resultSetType);
// In an XA global transaction do not allow the
// holdability to be set to hold cursors across
// commits, as the engine does not support it.
@@ -1530,7 +1517,6 @@
checkForClosedConnection();
checkAutoGeneratedKeysParameters(autoGeneratedKeys, columnNames);
resultSetType = downgradeResultSetType(resultSetType);
- resultSetConcurrency = downgradeResultSetConcurrency(resultSetConcurrency, resultSetType);
PreparedStatement ps = newPreparedStatement_(sql, resultSetType, resultSetConcurrency, resultSetHoldability, autoGeneratedKeys, columnNames);
ps.cursorAttributesToSendOnPrepare_ = ps.cacheCursorAttributesToSendOnPrepare();
ps.prepare();
@@ -1575,7 +1561,6 @@
int resultSetHoldability) throws SqlException {
checkForClosedConnection();
resultSetType = downgradeResultSetType(resultSetType);
- resultSetConcurrency = downgradeResultSetConcurrency(resultSetConcurrency, resultSetType);
CallableStatement cs = newCallableStatement_(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
cs.cursorAttributesToSendOnPrepare_ = cs.cacheCursorAttributesToSendOnPrepare();
cs.prepare();
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Cursor.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/Cursor.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Cursor.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Cursor.java Fri Apr 21 05:12:36 2006
@@ -86,6 +86,12 @@
protected java.util.ArrayList columnDataIsNullCache_ = new java.util.ArrayList();
public java.util.ArrayList isUpdateDeleteHoleCache_ = new java.util.ArrayList();
public boolean isUpdateDeleteHole_;
+
+ // State to keep track of when a row has been updated,
+ // cf. corresponding set and get accessors. Only implemented for
+ // scrollable updatable insensitive result sets for now.
+ private boolean isRowUpdated_;
+
final static public java.lang.Boolean ROW_IS_NULL = new Boolean(true);
final static public java.lang.Boolean ROW_IS_NOT_NULL = new Boolean(false);
@@ -111,6 +117,7 @@
public Cursor(Agent agent) {
agent_ = agent;
+ isRowUpdated_ = false;
dataBufferStream_ = new java.io.ByteArrayOutputStream();
}
@@ -157,6 +164,8 @@
// Moving out of the hole, set isUpdateDeleteHole to false
isUpdateDeleteHole_ = false;
+ isRowUpdated_ = false;
+
// Drive the CNTQRY outside of calculateColumnOffsetsForRow() if the dataBuffer_
// contains no data since it has no abilities to handle replies other than
// the QRYDTA, i.e. ENDQRYRM when the result set contains no more rows.
@@ -263,6 +272,38 @@
isUpdateDeleteHoleCache_.set(row, nullIndicator);
}
}
+
+ /**
+ * Keep track of updated status for this row.
+ *
+ * @param isRowUpdated true if row has been updated
+ *
+ * @see Cursor#getIsRowUpdated
+ */
+ public final void setIsRowUpdated(boolean isRowUpdated) {
+ isRowUpdated_ = isRowUpdated;
+ }
+
+ /**
+ * Get updated status for this row.
+ * Minion of ResultSet#rowUpdated.
+ *
+ * @see Cursor#setIsRowUpdated
+ */
+ public final boolean getIsRowUpdated() {
+ return isRowUpdated_;
+ }
+
+ /**
+ * Get deleted status for this row.
+ * Minion of ResultSet#rowDeleted.
+ *
+ * @see Cursor#setIsUpdataDeleteHole
+ */
+ public final boolean getIsUpdateDeleteHole() {
+ return isUpdateDeleteHole_;
+ }
+
//---------------------------cursor positioning-------------------------------
final int getPosition() {
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java Fri Apr 21 05:12:36 2006
@@ -140,7 +140,15 @@
public boolean isLast_ = false;
public boolean rowsetContainsLastRow_ = false;
public Sqlca[] rowsetSqlca_;
+
+ // Gets its initial value from the statement when the result set is created.
+ // It can be modified by setFetchSize and retrieved via getFetchSize.
+ protected int suggestedFetchSize_;
+
+ // Set by the net layer based on suggestedFetchSize_, protocol
+ // type, scrollability and presence of lobs.
public int fetchSize_;
+
public int fetchDirection_;
public long rowCount_ = -1;
@@ -214,7 +222,7 @@
resultSetConcurrency_ = resultSetConcurrency;
resultSetHoldability_ = resultSetHoldability;
fetchDirection_ = statement_.fetchDirection_;
- fetchSize_ = statement_.fetchSize_;
+ suggestedFetchSize_ = statement_.fetchSize_;
maxRows_ = statement_.maxRows_;
@@ -237,12 +245,11 @@
// CONCUR_READ_ONLY = 1007
// CONCUR_UPDATABLE = 1008
if (resultSetConcurrency_ < statement_.resultSetConcurrency_) {
- statement_.accumulateWarning(
+ accumulateWarning(
new SqlWarning(
agent_.logWriter_,
- new MessageId(SQLState.INVALID_RESULTSET_CONCURRENCY),
- new Integer(resultSetConcurrency_),
- new Integer(statement_.resultSetConcurrency_)));
+ new MessageId(
+ SQLState.QUERY_NOT_QUALIFIED_FOR_UPDATABLE_RESULTSET)));
}
@@ -2455,11 +2462,19 @@
// relative(0) is a null-operation, but the retruned result is
// dependent on wether the cursorposition is on a row or not.
+ // Scroll insensitive updatable should see own changes, so relative(0)
+ // has to refetch the row.
if (rows == 0) {
- if (isBeforeFirstX() || isAfterLastX()) {
- isValidCursorPosition_ = false;
+ if (resultSetConcurrency_ == ResultSet.CONCUR_UPDATABLE &&
+ resultSetType_ == ResultSet.TYPE_SCROLL_INSENSITIVE) {
+ // re-fetch currentRow
+ isValidCursorPosition_ = getAbsoluteRowset(absolutePosition_);
} else {
- isValidCursorPosition_ = true;
+ if (isBeforeFirstX() || isAfterLastX()) {
+ isValidCursorPosition_ = false;
+ } else {
+ isValidCursorPosition_ = true;
+ }
}
return isValidCursorPosition_;
}
@@ -2668,7 +2683,7 @@
agent_.logWriter_.traceExit(this, "getFetchSize", fetchSize_);
}
checkForClosedResultSet();
- return fetchSize_;
+ return suggestedFetchSize_;
}
catch ( SqlException se )
{
@@ -2711,9 +2726,10 @@
public boolean rowUpdated() throws SQLException {
try
{
- // we cannot tell whether the ResultSet has been updated, so always return false here.
- boolean rowUpdated = false;
checkForClosedResultSet();
+
+ boolean rowUpdated = cursor_.getIsRowUpdated();
+
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "rowUpdated", rowUpdated);
}
@@ -2744,10 +2760,12 @@
public boolean rowDeleted() throws SQLException {
try
{
- // rowDeleted is visible through a delete hole, (sqlcode +222).
- // Always return false and do not check the return code for now.
- boolean rowDeleted = false;
checkForClosedResultSet();
+
+ boolean rowDeleted = (resultSetType_ == ResultSet.TYPE_SCROLL_INSENSITIVE) ?
+ cursor_.getIsUpdateDeleteHole() :
+ false;
+
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "rowDeleted", rowDeleted);
}
@@ -2768,7 +2786,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateNull", column);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateNull");
if (!resultSetMetaData_.nullable_[column - 1]) {
throw new SqlException(agent_.logWriter_,
new MessageId(SQLState.LANG_NULL_INTO_NON_NULL),
@@ -2790,7 +2808,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateBoolean", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateBoolean");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2807,7 +2825,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateByte", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateByte");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2824,7 +2842,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateShort", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateShort");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2841,7 +2859,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateInt", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateInt");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2858,7 +2876,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateLong", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateLong");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2875,7 +2893,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateFloat", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateFloat");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2892,7 +2910,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateDouble", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateDouble");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2909,7 +2927,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateBigDecimal", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateBigDecimal");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2926,7 +2944,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateDate", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateDate");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2943,7 +2961,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateTime", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateTime");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2960,7 +2978,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateTimestamp", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateTimestamp");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2977,7 +2995,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateString", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateString");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -2994,7 +3012,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateBytes", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateBytes");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -3013,7 +3031,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateBinaryStream", column, x, length);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateBinaryStream");
updateColumn(column, agent_.crossConverters_.setObjectFromBinaryStream(resultSetMetaData_.types_[column - 1], x, length));
}
}
@@ -3032,7 +3050,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateAsciiStream", column, x, length);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateAsciiStream");
updateColumn(column, agent_.crossConverters_.setObjectFromCharacterStream(resultSetMetaData_.types_[column - 1], x, "US-ASCII", length));
}
}
@@ -3051,7 +3069,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateCharacterStream", column, x, length);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateCharacterStream");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x, length));
}
}
@@ -3068,7 +3086,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateObject", column, x, scale);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateObject");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -3085,7 +3103,7 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateObject", column, x);
}
- checkUpdatePreconditions(column);
+ checkUpdatePreconditions(column, "updateObject");
updateColumn(column, agent_.crossConverters_.setObject(resultSetMetaData_.types_[column - 1], x));
}
}
@@ -3389,7 +3407,8 @@
private void insertRowX() throws SqlException {
checkForClosedResultSet();
- if (isOnCurrentRow_ || resultSetConcurrency_ == java.sql.ResultSet.CONCUR_READ_ONLY) {
+ checkForUpdatableResultSet("insertRow");
+ if (isOnCurrentRow_) {
throw new SqlException(agent_.logWriter_,
new MessageId(SQLState.CURSOR_NOT_POSITIONED_ON_INSERT_ROW));
}
@@ -3441,10 +3460,13 @@
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "updateRow");
}
- //If updateXXX were issued on the row before updateRow, then
- //position the ResultSet to right before the next row after updateRow
- if (updateRowX())
+ // If updateXXX were issued on the row before updateRow and
+ // the result set if forward only, then position the ResultSet
+ // to right before the next row after updateRow.
+ if (updateRowX() && (getType() ==
+ ResultSet.TYPE_FORWARD_ONLY)) {
isValidCursorPosition_ = false;
+ }
}
}
catch ( SqlException se )
@@ -3456,7 +3478,10 @@
//if no updateXXX were issued before this updateRow, then return false
private boolean updateRowX() throws SqlException {
checkForClosedResultSet();
- if (isOnInsertRow_ || resultSetConcurrency_ == java.sql.ResultSet.CONCUR_READ_ONLY) {
+
+ checkForUpdatableResultSet("updateRow");
+
+ if (isOnInsertRow_) {
throw new SqlException(agent_.logWriter_,
new MessageId(SQLState.CURSOR_NOT_POSITIONED_ON_INSERT_ROW));
}
@@ -3529,7 +3554,9 @@
// alternative is to check for updateCount_ in "positionToCurrentRowAndUpdate".
// cancelRowUpdates if updateCount_ != 1, else set updateRowCalled_ to true.
try {
- if (isRowsetCursor_ || sensitivity_ == sensitivity_sensitive_dynamic__) {
+ if (isRowsetCursor_ ||
+ sensitivity_ == sensitivity_sensitive_dynamic__ ||
+ sensitivity_ == sensitivity_sensitive_static__) {
update();
} else {
positionToCurrentRowAndUpdate();
@@ -3543,6 +3570,12 @@
}
throw e;
}
+
+ // other result set types don't implement detectability
+ if (resultSetType_ == ResultSet.TYPE_SCROLL_INSENSITIVE) {
+ cursor_.setIsRowUpdated(true);
+ }
+
return true;
}
@@ -3568,11 +3601,13 @@
private void deleteRowX() throws SqlException {
checkForClosedResultSet();
+
+ checkForUpdatableResultSet("deleteRow");
// discard all previous updates
resetUpdatedColumns();
- if (isOnInsertRow_ || resultSetConcurrency_ == java.sql.ResultSet.CONCUR_READ_ONLY) {
+ if (isOnInsertRow_) {
throw new SqlException(agent_.logWriter_,
new MessageId(SQLState.CURSOR_NOT_POSITIONED_ON_INSERT_ROW));
}
@@ -3581,7 +3616,9 @@
getPreparedStatementForDelete();
}
- if (isRowsetCursor_ || sensitivity_ == sensitivity_sensitive_dynamic__) {
+ if (isRowsetCursor_ ||
+ sensitivity_ == sensitivity_sensitive_dynamic__ ||
+ sensitivity_ == sensitivity_sensitive_static__) {
delete();
} else {
positionToCurrentRowAndDelete();
@@ -3615,12 +3652,11 @@
private void refreshRowX() throws SqlException {
checkForClosedResultSet();
checkThatResultSetTypeIsScrollable();
- if (isBeforeFirstX() || isAfterLastX() || isOnInsertRow_ ||
- resultSetConcurrency_ == java.sql.ResultSet.CONCUR_READ_ONLY) {
+ checkForUpdatableResultSet("refreshRow");
+ if (isBeforeFirstX() || isAfterLastX() || isOnInsertRow_) {
throw new SqlException(agent_.logWriter_,
new MessageId(SQLState.CURSOR_CANNOT_INVOKE_ON_INSROW_OR_INVALIDROW_OR_READONLY));
}
-
// this method does nothing if ResultSet is TYPE_SCROLL_INSENSITIVE
if (resultSetType_ == java.sql.ResultSet.TYPE_SCROLL_SENSITIVE) {
@@ -3644,7 +3680,8 @@
agent_.logWriter_.traceEntry(this, "cancelRowUpdates");
}
checkForClosedResultSet();
- if (isOnInsertRow_ || resultSetConcurrency_ == java.sql.ResultSet.CONCUR_READ_ONLY) {
+ checkForUpdatableResultSet("cancelRowUpdates");
+ if (isOnInsertRow_) {
throw new SqlException(agent_.logWriter_,
new MessageId(SQLState.CURSOR_NOT_POSITIONED_ON_INSERT_ROW));
}
@@ -3675,7 +3712,7 @@
agent_.logWriter_.traceEntry(this, "moveToInsertRow");
}
checkForClosedResultSet();
- checkUpdatableCursor("moveToInsertRow()");
+ checkForUpdatableResultSet("moveToInsertRow");
resetUpdatedColumnsForInsert();
@@ -3698,7 +3735,7 @@
agent_.logWriter_.traceEntry(this, "moveToCurrentRow");
}
checkForClosedResultSet();
- checkUpdatableCursor("moveToCurrentRow()");
+ checkForUpdatableResultSet("moveToCurrentRow");
if (!isOnInsertRow_) {
// no affect
@@ -4158,10 +4195,12 @@
public void readUpdateRow() throws DisconnectException, SqlException {
preparedStatementForUpdate_.materialPreparedStatement_.readExecute_();
+ accumulateWarning(preparedStatementForUpdate_.getSqlWarnings());
}
public void readDeleteRow() throws DisconnectException, SqlException {
preparedStatementForDelete_.materialPreparedStatement_.readExecute_();
+ accumulateWarning(preparedStatementForDelete_.getSqlWarnings());
}
//------------------material layer event callback methods-----------------------
@@ -4528,14 +4567,14 @@
checkForValidCursorPosition();
}
- private final void checkUpdatePreconditions(int column) throws SqlException {
+ private final void checkUpdatePreconditions(int column,
+ String operation)
+ throws SqlException {
+
checkForClosedResultSet();
checkForValidColumnIndex(column);
- if (resultSetConcurrency_ != java.sql.ResultSet.CONCUR_UPDATABLE) {
- throw new SqlException(agent_.logWriter_,
- new MessageId(SQLState.UPDATABLE_RESULTSET_API_DISALLOWED),
- "updateXXX");
- }
+ checkForUpdatableResultSet(operation);
+
if (!isOnCurrentRow_ && !isOnInsertRow_) {
throw new SqlException(agent_.logWriter_,
new MessageId(SQLState.CURSOR_NOT_ON_CURRENT_OR_INSERT_ROW));
@@ -4560,14 +4599,6 @@
}
}
- private void checkUpdatableCursor(String methodName) throws SqlException {
- if (resultSetConcurrency_ == java.sql.ResultSet.CONCUR_READ_ONLY) {
- throw new SqlException(agent_.logWriter_,
- new MessageId(SQLState.UPDATABLE_RESULTSET_API_DISALLOWED),
- methodName);
- }
- }
-
protected final void checkForClosedResultSet() throws SqlException {
if (!openOnClient_) {
agent_.checkForDeferredExceptions();
@@ -4578,6 +4609,15 @@
}
}
+ private final void checkForUpdatableResultSet(String operation)
+ throws SqlException {
+ if (resultSetConcurrency_ == java.sql.ResultSet.CONCUR_READ_ONLY) {
+ throw new SqlException(agent_.logWriter_,
+ new MessageId(SQLState.UPDATABLE_RESULTSET_API_DISALLOWED),
+ operation);
+ }
+ }
+
private final void checkForValidCursorPosition() throws SqlException {
if (!isValidCursorPosition_) {
throw new SqlException(agent_.logWriter_,
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java Fri Apr 21 05:12:36 2006
@@ -46,7 +46,6 @@
public MaterialStatement materialStatement_ = null;
public Connection connection_;
- private SqlWarning warnings_ = null;
public Section section_;
public Agent agent_;
@@ -190,8 +189,10 @@
// This flag makes sure that only one copy of this statement
// will be in connection_.commitListeners_.
+ private SqlWarning warnings_ = null;
+
- //---------------------constructors/finalizer---------------------------------
+ //---------------------constructors/finalizer/accessors--------------------
private Statement() throws SqlException {
initStatement();
@@ -382,6 +383,13 @@
super.finalize();
}
+ /*
+ * Accessor to state variable warnings_
+ */
+ protected SqlWarning getSqlWarnings() {
+ return warnings_;
+ }
+
// ---------------------------jdbc 1------------------------------------------
public java.sql.ResultSet executeQuery(String sql) throws SQLException {
@@ -1371,7 +1379,8 @@
if (resultSet_.fetchSize_ == 0 &&
(resultSet_.resultSetType_ == java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE ||
resultSet_.resultSetType_ == java.sql.ResultSet.TYPE_SCROLL_SENSITIVE)) {
- resultSet_.fetchSize_ = org.apache.derby.client.am.Configuration.defaultFetchSize;
+ resultSet_.setFetchSize_(org.apache.derby.client.am.
+ Configuration.defaultFetchSize);
}
}
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java Fri Apr 21 05:12:36 2006
@@ -154,11 +154,13 @@
*/
public org.apache.derby.client.am.ResultSet newNetResultSet(Agent netAgent,
org.apache.derby.client.am.MaterialStatement netStatement,
- Cursor cursor,int sqlcsrhld,int qryattscr,int qryattsns,
+ Cursor cursor,
+ int qryprctyp,int sqlcsrhld,int qryattscr,int qryattsns,
int qryattset,long qryinsid,int actualResultSetType,
int actualResultSetConcurrency,
int actualResultSetHoldability) throws SqlException {
- return new NetResultSet((NetAgent)netAgent,(NetStatement)netStatement,cursor,sqlcsrhld,qryattscr,
+ return new NetResultSet((NetAgent)netAgent,
+ (NetStatement)netStatement,cursor,qryprctyp,sqlcsrhld,qryattscr,
qryattsns,qryattset,qryinsid,actualResultSetType,
actualResultSetConcurrency,actualResultSetHoldability);
}
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java Fri Apr 21 05:12:36 2006
@@ -163,12 +163,13 @@
*/
public org.apache.derby.client.am.ResultSet newNetResultSet(Agent netAgent,
org.apache.derby.client.am.MaterialStatement netStatement,
- Cursor cursor,int sqlcsrhld,
+ Cursor cursor,int qryprctyp,int sqlcsrhld,
int qryattscr,int qryattsns,int qryattset,long qryinsid,
int actualResultSetType,int actualResultSetConcurrency,
int actualResultSetHoldability) throws SqlException {
return new NetResultSet40((NetAgent)netAgent,(NetStatement)netStatement,
- cursor,sqlcsrhld,qryattscr,qryattsns,qryattset,qryinsid,
+ cursor,
+ qryprctyp, sqlcsrhld, qryattscr, qryattsns, qryattset, qryinsid,
actualResultSetType,actualResultSetConcurrency,
actualResultSetHoldability);
}
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java Fri Apr 21 05:12:36 2006
@@ -343,6 +343,9 @@
// Query Insensitive to Changes
static final int QRYINS = 1;
+ // Sensitive static
+ static final int QRYSNSSTC = 0x2;
+
// Query Attributes is Unknown or Undefined
static final int QRYUNK = 0;
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java Fri Apr 21 05:12:36 2006
@@ -29,6 +29,8 @@
import org.apache.derby.client.am.SqlWarning;
import org.apache.derby.client.am.Types;
import org.apache.derby.client.am.SqlCode;
+import org.apache.derby.shared.common.reference.SQLState;
+import org.apache.derby.shared.common.sanity.SanityManager;
public class NetCursor extends org.apache.derby.client.am.Cursor {
@@ -132,6 +134,7 @@
int[] columnDataPosition = null;
int[] columnDataComputedLength = null;
boolean[] columnDataIsNull = null;
+ boolean receivedDeleteHoleWarning = false;
if ((position_ == lastValidBytePosition_) &&
(netResultSet_ != null) && (netResultSet_.scrollable_)) {
@@ -140,6 +143,23 @@
NetSqlca netSqlca = this.parseSQLCARD(qrydscTypdef_);
+ if (netResultSet_ != null && netResultSet_.scrollable_) {
+ if (netSqlca != null &&
+ netSqlca.getSqlState().equals(SQLState.ROW_DELETED)) {
+ receivedDeleteHoleWarning = true;
+ netSqlca = null;
+ } else {
+ setIsUpdataDeleteHole(rowIndex, false);
+ }
+ if (netSqlca != null &&
+ netSqlca.getSqlState().equals(SQLState.ROW_UPDATED)) {
+ setIsRowUpdated(true);
+ netSqlca = null;
+ } else {
+ setIsRowUpdated(false);
+ }
+ }
+
if (netSqlca != null) {
int sqlcode = netSqlca.getSqlCode();
if (sqlcode < 0) {
@@ -185,6 +205,9 @@
// If data flows....
if (daNullIndicator == 0x0) {
+ if (SanityManager.DEBUG && receivedDeleteHoleWarning) {
+ SanityManager.THROWASSERT("Delete hole warning received: nulldata expected");
+ }
incrementRowsReadEvent();
// netResultSet_ is null if this method is invoked from Lob.position()
@@ -312,12 +335,18 @@
}
}
}
- }
-
- // Else if this row is null, only add to the isRowNullCache_ if the cursor is scrollable.
- else {
+ } else {
if (netResultSet_ != null && netResultSet_.scrollable_) {
- setIsUpdataDeleteHole(rowIndex, true);
+ if (receivedDeleteHoleWarning) {
+ setIsUpdataDeleteHole(rowIndex, true);
+ } else {
+ if (SanityManager.DEBUG) {
+ // Invariant: for SUR, we introduced the warning
+ // in addition to null data.
+ SanityManager
+ .THROWASSERT("Delete hole warning expected");
+ }
+ }
}
}
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet.java Fri Apr 21 05:12:36 2006
@@ -38,6 +38,10 @@
// Alias for (NetAgent) super.agent
final private NetAgent netAgent_;
+ // Indicates whether the fixed row protocol is being used. If so,
+ // the fetch size will always be 1.
+ private boolean isFixedRowProtocol = false;
+
//-----------------------------state------------------------------------------
// This is used to avoid sending multiple outovr over subsequent next()'s
@@ -50,10 +54,13 @@
NetResultSet(NetAgent netAgent,
NetStatement netStatement,
Cursor cursor,
- //int qryprctyp, //protocolType, CodePoint.FIXROWPRC | CodePoint.LMTBLKPRC
+ int qryprctyp, //protocolType, CodePoint.FIXROWPRC |
+ // CodePoint.LMTBLKPRC
int sqlcsrhld, // holdOption, 0xF0 for false (default) | 0xF1 for true.
int qryattscr, // scrollOption, 0xF0 for false (default) | 0xF1 for true.
- int qryattsns, // sensitivity, CodePoint.QRYUNK | CodePoint.QRYINS
+ int qryattsns, // sensitivity, CodePoint.QRYUNK |
+ // CodePoint.QRYINS |
+ // CodePoint.QRYSNSSTC
int qryattset, // rowsetCursor, 0xF0 for false (default) | 0xF1 for true.
long qryinsid, // instanceIdentifier, 0 (if not returned, check default) or number
int actualResultSetType,
@@ -84,6 +91,15 @@
scrollable_ = true;
}
+ // The number of rows returned by the server will always be 1 when the
+ // Fixed Row Protocol is being used.
+ if (qryprctyp == CodePoint.FIXROWPRC) {
+ isFixedRowProtocol = true;
+ fetchSize_ = 1;
+ } else {
+ fetchSize_ = suggestedFetchSize_;
+ }
+
switch (qryattsns) {
case CodePoint.QRYUNK:
sensitivity_ = sensitivity_unknown__;
@@ -91,6 +107,9 @@
case CodePoint.QRYINS:
sensitivity_ = sensitivity_insensitive__;
break;
+ case CodePoint.QRYSNSSTC:
+ sensitivity_ = sensitivity_sensitive_static__;
+ break;
default: // shouldn't happen
break;
}
@@ -125,7 +144,8 @@
// are returned to the user. the specific error is not returned until the next fetch.
while (rowsReceivedInCurrentRowset_ != fetchSize_ &&
!netCursor_.allRowsReceivedFromServer() && !isRowsetCursor_ &&
- sensitivity_ != sensitivity_sensitive_dynamic__) {
+ sensitivity_ != sensitivity_sensitive_dynamic__ &&
+ sensitivity_ != sensitivity_sensitive_static__) {
flowFetchToCompleteRowset();
while (netCursor_.calculateColumnOffsetsForRow_(row, true)) {
rowsReceivedInCurrentRowset_++;
@@ -136,7 +156,11 @@
}
public void setFetchSize_(int rows) {
- fetchSize_ = (rows == 0) ? 64 : rows;
+ // Do not change the fetchSize for Fixed Row Protocol
+ suggestedFetchSize_ = (rows == 0) ? 64 : rows;
+ if (!isFixedRowProtocol) {
+ fetchSize_ = suggestedFetchSize_;
+ }
}
//-----------------------------helper methods---------------------------------
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java Fri Apr 21 05:12:36 2006
@@ -39,17 +39,22 @@
NetResultSet40(NetAgent netAgent,
NetStatement netStatement,
Cursor cursor,
- //int qryprctyp, //protocolType, CodePoint.FIXROWPRC | CodePoint.LMTBLKPRC
+ int qryprctyp, //protocolType, CodePoint.FIXROWPRC |
+ // CodePoint.LMTBLKPRC
int sqlcsrhld, // holdOption, 0xF0 for false (default) | 0xF1 for true.
int qryattscr, // scrollOption, 0xF0 for false (default) | 0xF1 for true.
- int qryattsns, // sensitivity, CodePoint.QRYUNK | CodePoint.QRYINS
+ int qryattsns, // sensitivity, CodePoint.QRYUNK |
+ // CodePoint.QRYINS |
+ // CodePoint.QRYSNSSTC
int qryattset, // rowsetCursor, 0xF0 for false (default) | 0xF1 for true.
long qryinsid, // instanceIdentifier, 0 (if not returned, check default) or number
int actualResultSetType,
int actualResultSetConcurrency,
int actualResultSetHoldability) //throws DisconnectException
{
- super(netAgent,netStatement,cursor,sqlcsrhld,qryattscr,qryattsns,qryattset,qryinsid,actualResultSetType,actualResultSetConcurrency,actualResultSetHoldability);
+ super(netAgent, netStatement, cursor, qryprctyp, sqlcsrhld, qryattscr,
+ qryattsns, qryattset, qryinsid, actualResultSetType,
+ actualResultSetConcurrency, actualResultSetHoldability);
}
public RowId getRowId(int columnIndex) throws SQLException {
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java Fri Apr 21 05:12:36 2006
@@ -846,10 +846,13 @@
(netAgent_,
(NetStatement) statement.materialStatement_,
statement.cachedCursor_,
- //qryprctyp, //protocolType, CodePoint.FIXROWPRC | CodePoint.LMTBLKPRC
+ qryprctyp, //protocolType, CodePoint.FIXROWPRC |
+ // CodePoint.LMTBLKPRC
sqlcsrhld, //holdOption, 0xF0 for false (default) | 0xF1 for true.
qryattscr, //scrollOption, 0xF0 for false (default) | 0xF1 for true.
- qryattsns, //sensitivity, CodePoint.QRYUNK | CodePoint.QRYINS
+ qryattsns, //sensitivity, CodePoint.QRYUNK |
+ // CodePoint.QRYINS |
+ // CodePoint.QRYSNSSTC
qryattset,
qryinsid, //instanceIdentifier, 0 (if not returned, check default) or number
calculateResultSetType(qryattscr, qryattsns, statement.resultSetType_),
@@ -864,7 +867,8 @@
(netAgent_,
(NetStatement) statement.materialStatement_,
new NetCursor(netAgent_, qryprctyp),
- //qryprctyp, //protocolType, CodePoint.FIXROWPRC | CodePoint.LMTBLKPRC
+ qryprctyp, //protocolType, CodePoint.FIXROWPRC |
+ // CodePoint.LMTBLKPRC
sqlcsrhld, //holdOption, 0xF0 for false (default) | 0xF1 for true.
qryattscr, //scrollOption, 0xF0 for false (default) | 0xF1 for true.
qryattsns, //sensitivity, CodePoint.QRYUNK | CodePoint.QRYINS
@@ -1694,6 +1698,7 @@
int qryattsns = readFastUnsignedByte();
switch (qryattsns) {
case CodePoint.QRYUNK:
+ case CodePoint.QRYSNSSTC:
case CodePoint.QRYINS:
break;
default:
Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/CodePoint.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/CodePoint.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/CodePoint.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/CodePoint.java Fri Apr 21 05:12:36 2006
@@ -305,6 +305,9 @@
// Insensitive SCROLL
static final int QRYINS = 0x1;
+ // Sensitive static
+ static final int QRYSNSSTC = 0x2;
+
// Number of fetch or Insert Rows
static final int NBRROW = 0x213A;
Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Fri Apr 21 05:12:36 2006
@@ -2433,25 +2433,36 @@
if (stmt.isScrollable())
{
writer.writeScalar1Byte(CodePoint.QRYATTSCR, CodePoint.TRUE);
- //Cloudscape only supports insensitive scroll cursors
- writer.writeScalar1Byte(CodePoint.QRYATTSNS, CodePoint.QRYINS);
- //Cloudscape only supports read only scrollable cursors
- writer.writeScalar1Byte(CodePoint.QRYATTUPD, CodePoint.QRYRDO);
+ if ((stmt.getConcurType() == ResultSet.CONCUR_UPDATABLE) &&
+ (stmt.getResultSet().getType() ==
+ ResultSet.TYPE_SCROLL_INSENSITIVE)) {
+ writer.writeScalar1Byte(CodePoint.QRYATTSNS,
+ CodePoint.QRYSNSSTC);
+ } else {
+ writer.writeScalar1Byte(CodePoint.QRYATTSNS,
+ CodePoint.QRYINS);
+ }
}
- else
- {
- if (stmt.getConcurType() == ResultSet.CONCUR_UPDATABLE) {
- if (stmt.getResultSet() != null) { //resultset concurrency can be less than statement concurreny if the underlying language resultset is not updatable
- if (stmt.getResultSet().getConcurrency() == ResultSet.CONCUR_UPDATABLE)
- writer.writeScalar1Byte(CodePoint.QRYATTUPD, CodePoint.QRYUPD);
- else
- writer.writeScalar1Byte(CodePoint.QRYATTUPD, CodePoint.QRYRDO);
- } else
- writer.writeScalar1Byte(CodePoint.QRYATTUPD, CodePoint.QRYUPD);
- } else
- writer.writeScalar1Byte(CodePoint.QRYATTUPD, CodePoint.QRYRDO);
+ if (stmt.getConcurType() == ResultSet.CONCUR_UPDATABLE) {
+ if (stmt.getResultSet() != null) {
+ // Resultset concurrency can be less than statement
+ // concurreny if the underlying language resultset
+ // is not updatable.
+ if (stmt.getResultSet().getConcurrency() ==
+ ResultSet.CONCUR_UPDATABLE) {
+ writer.writeScalar1Byte(CodePoint.QRYATTUPD,
+ CodePoint.QRYUPD);
+ } else {
+ writer.writeScalar1Byte(CodePoint.QRYATTUPD,
+ CodePoint.QRYRDO);
+ }
+ } else {
+ writer.writeScalar1Byte(CodePoint.QRYATTUPD,
+ CodePoint.QRYUPD);
+ }
+ } else {
+ writer.writeScalar1Byte(CodePoint.QRYATTUPD, CodePoint.QRYRDO);
}
-
}
writer.endDdmAndDss ();
}
@@ -3336,13 +3347,11 @@
//let Cloudscape handle any errors in the types it doesn't support
//just set the attributes
- boolean insensitive = false;
boolean validAttribute = false;
if (attrs.indexOf("INSENSITIVE SCROLL") != -1 || attrs.indexOf("SCROLL INSENSITIVE") != -1) //CLI
{
stmt.scrollType = ResultSet.TYPE_SCROLL_INSENSITIVE;
stmt.concurType = ResultSet.CONCUR_READ_ONLY;
- insensitive = true;
validAttribute = true;
}
if ((attrs.indexOf("SENSITIVE DYNAMIC SCROLL") != -1) || (attrs.indexOf("SENSITIVE STATIC SCROLL") != -1))
@@ -3354,7 +3363,6 @@
if ((attrs.indexOf("FOR UPDATE") != -1))
{
validAttribute = true;
- if (!insensitive)
stmt.concurType = ResultSet.CONCUR_UPDATABLE;
}
@@ -6200,6 +6208,30 @@
// Send ResultSet warnings if there are any
SQLWarning sqlw = (rs != null)? rs.getWarnings(): null;
+
+ // for updatable, insensitive result sets we signal the
+ // row updated condition to the client via a warning which
+ // is pushed on top of any other warnings on the result
+ // set, to be popped by client onto its rowUpdated state,
+ // i.e. this warning should not reach API level.
+ if (rs != null && rs.rowUpdated()) {
+ SQLWarning w = new SQLWarning(null, SQLState.ROW_UPDATED);
+ if (sqlw != null) {
+ w.setNextWarning(sqlw);
+ }
+ sqlw = w;
+ }
+ // Delete holes are manifest as a row consisting of a non-null
+ // SQLCARD and a null data group. The SQLCARD has a warning
+ // SQLSTATE of 02502
+ if (rs != null && rs.rowDeleted()) {
+ SQLWarning w = new SQLWarning(null, SQLState.ROW_DELETED);
+ if (sqlw != null) {
+ w.setNextWarning(sqlw);
+ }
+ sqlw = w;
+ }
+
if (sqlw == null)
writeSQLCAGRP(nullSQLState, 0, -1, -1);
else
@@ -6207,7 +6239,9 @@
// if we were asked not to return data, mark QRYDTA null; do not
// return yet, need to make rowCount right
- boolean noRetrieveRS = (rs != null && !stmt.getQryrtndta());
+ // if the row has been deleted return QRYDTA null (delete hole)
+ boolean noRetrieveRS = (rs != null &&
+ (!stmt.getQryrtndta() || rs.rowDeleted()));
if (noRetrieveRS)
writer.writeByte(0xFF); //QRYDTA null indicator: IS NULL
else
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties Fri Apr 21 05:12:36 2006
@@ -332,15 +332,15 @@
M->dataDefinitionCausesTransactionCommit(), \
M->dataDefinitionIgnoredInTransactions(), \
(cast (RTRIM(CAST(java.sql.ResultSet::TYPE_FORWARD_ONLY as CHAR(10))) AS VARCHAR(10)) || (',') || (cast (RTRIM(CAST(java.sql.ResultSet::TYPE_SCROLL_INSENSITIVE AS CHAR(10))) as VARCHAR(10)))), \
- '1003,1007,1008;1004,1007;1005', \
- '',\
- '',\
+ '1003,1007,1008;1004,1007,1008;1005', \
+ '1004',\
+ '1004',\
'',\
'1003',\
'1003',\
'1003',\
- '',\
- '',\
+ '1004',\
+ '1004',\
'',\
M->supportsBatchUpdates()\
from (values(getCurrentConnection()->getMetaData())) as DBMetaData(M)
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java Fri Apr 21 05:12:36 2006
@@ -917,13 +917,14 @@
try {
scanController.fetchLocation(rl);
} catch (StandardException se) {
- if (se.getMessageId().equals(SQLState.AM_SCAN_NOT_POSITIONED)) {
-
+ if (se.getMessageId().
+ equals(SQLState.HEAP_SCAN_NOT_POSITIONED)) {
//Have a easier to understand error message than what
//we get from store
throw StandardException.
newException(SQLState.NO_CURRENT_ROW);
}
+ throw se;
}
} else {
rl = null;
Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java (original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java Fri Apr 21 05:12:36 2006
@@ -1508,6 +1508,15 @@
String STORED_PROC_LOAD_MODULE_NOT_FOUND = "XJ210.S";
String BATCH_CHAIN_BREAKING_EXCEPTION = "XJ211.S";
+ // Used by server for scrollable updatable insensitive result sets
+ // to transmit updated state to client. Internal, not seen by user.
+ // Has no message in messages.properties as it is never printed.
+ String ROW_UPDATED = "rwupd";
+ // Used by server to signal delete holes to the client. Internal, not
+ // seen by user. Has no message in messages.properties as it is never
+ // printed.
+ String ROW_DELETED = "02502";
+
String INTERNAL_ERROR = "XJ999.S";
String CONN_GENERIC = "X0RQB.S";
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out Fri Apr 21 05:12:36 2006
@@ -184,8 +184,8 @@
ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY)? false
ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY)? false
Scroll insensitive ResultSet see updates and deletes, but not inserts
-ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
-ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
+ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
+ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
Derby does not yet implement scroll sensitive resultsets and hence following metadata calls return false
ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
@@ -196,8 +196,8 @@
updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
deletesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
-updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
-deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
+updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
+deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
insertsAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
updatesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)? false
deletesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)? false
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out Fri Apr 21 05:12:36 2006
@@ -214,8 +214,8 @@
ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY)? false
ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY)? false
Scroll insensitive ResultSet see updates and deletes, but not inserts
-ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
-ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
+ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
+ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
Derby does not yet implement scroll sensitive resultsets and hence following metadata calls return false
ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
@@ -226,8 +226,8 @@
updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
deletesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
-updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
-deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
+updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
+deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
insertsAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
updatesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)? false
deletesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)? false
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out Fri Apr 21 05:12:36 2006
@@ -271,8 +271,8 @@
ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY)? false
ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY)? false
Scroll insensitive ResultSet see updates and deletes, but not inserts
-ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
-ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
+ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
+ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
Derby does not yet implement scroll sensitive resultsets and hence following metadata calls return false
ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
@@ -283,8 +283,8 @@
updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
deletesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
-updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
-deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
+updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
+deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
insertsAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
updatesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)? false
deletesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)? false
@@ -292,7 +292,7 @@
SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_READ_ONLY: true
SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_UPDATABLE: true
SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_READ_ONLY: true
-SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE: false
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE: true
SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_READ_ONLY: false
SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE: false
getConnection(): same connection
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out?rev=395866&r1=395865&r2=395866&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out Fri Apr 21 05:12:36 2006
@@ -1,62 +1,47 @@
Start testing delete and update using JDBC2.0 updateable resultset apis
Negative Testl - request for scroll insensitive updatable resultset will give a read only scroll insensitive resultset
-WARNING 01J11: Insensitive updatable result sets are not supported by server; remapping to insensitive read-only cursor
-requested TYPE_SCROLL_INSENSITIVE, CONCUR_UPDATABLE but that is not supported
-Make sure that we got TYPE_SCROLL_INSENSITIVE? true
-Make sure that we got CONCUR_READ_ONLY? true
-ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
-othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
-deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
-JDBC 2.0 updatable resultset api will fail on this resultset because this is not an updatable resultset
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
-Negative Test2 - request for scroll sensitive updatable resultset will give a read only scroll insensitive resultset
+This test has been removed because scrollable insensitive updatable result sets have been implemented.
+Negative Test2 - request for scroll sensitive updatable resultset will give an updatable scroll insensitive resultset
WARNING 01J10: Scroll sensitive result sets are not supported by server; remapping to forward-only cursor
requested TYPE_SCROLL_SENSITIVE, CONCUR_UPDATABLE but that is not supported
Jira issue Derby-154 : When client connects to Network Server using JCC, it incorrectly shows support for scroll sensitive updatable resultsets
Make sure that we got TYPE_SCROLL_INSENSITIVE? true
-Make sure that we got CONCUR_READ_ONLY? true
-JDBC 2.0 updatable resultset api will fail on this resultset because this is not an updatable resultset
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+Make sure that we got CONCUR_UPDATABLE? true
+Rest of the test removed because scrollable insensitive updatable result sets have been implemented.
Negative Test3 - request a read only resultset and attempt deleteRow and updateRow on it
Make sure that we got CONCUR_READ_ONLY? true
Now attempting to send a deleteRow on a read only resultset.
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+SQL State : XJ083
+Got expected exception 'deleteRow' not allowed because the ResultSet is not an updatable ResultSet.
Now attempting to send an updateRow on a read only resultset.
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+SQL State : XJ083
+Got expected exception 'updateRow' not allowed because the ResultSet is not an updatable ResultSet.
Negative Test4 - request a read only resultset and send a sql with FOR UPDATE clause and attempt deleteRow/updateRow on it
Make sure that we got CONCUR_READ_ONLY? true
Now attempting to send a deleteRow on a read only resultset with FOR UPDATE clause in the SELECT sql.
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+SQL State : XJ083
+Got expected exception 'deleteRow' not allowed because the ResultSet is not an updatable ResultSet.
Now attempting to send a updateRow on a read only resultset with FOR UPDATE clause in the SELECT sql.
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+SQL State : XJ083
+Got expected exception 'updateRow' not allowed because the ResultSet is not an updatable ResultSet.
Negative Test5 - request resultset with no FOR UPDATE clause and CONCUR_READ_ONLY
Make sure that we got CONCUR_READ_ONLY? true
Now attempting to send a delete on a sql with no FOR UPDATE clause and CONCUR_READ_ONLY.
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+SQL State : XJ083
+Got expected exception 'deleteRow' not allowed because the ResultSet is not an updatable ResultSet.
Now attempting to send a updateRow on a sql with no FOR UPDATE clause and CONCUR_READ_ONLY.
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+SQL State : XJ083
+Got expected exception 'updateRow' not allowed because the ResultSet is not an updatable ResultSet.
Negative Test6 - request updatable resultset for sql with FOR READ ONLY clause
Make sure that we got CONCUR_READ_ONLY? true
Jira issue Derby-159 : Warnings raised by Derby are not getting passed to the Client in Network Server Mode
-Will see the warnings in embedded mode only
+WARNING 01J06: ResultSet not updatable. Query does not qualify to generate an updatable ResultSet.
Now attempting to send a delete on a sql with FOR READ ONLY clause.
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+SQL State : XJ083
+Got expected exception 'deleteRow' not allowed because the ResultSet is not an updatable ResultSet.
Now attempting to send a updateRow on a sql with FOR READ ONLY clause.
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+SQL State : XJ083
+Got expected exception 'updateRow' not allowed because the ResultSet is not an updatable ResultSet.
Negative Test7 - attempt to deleteRow & updateRow on updatable resultset when the resultset is not positioned on a row
Make sure that we got CONCUR_UPDATABLE? true
Now attempt a deleteRow without first doing next on the resultset.
@@ -520,71 +505,71 @@
SQL State : XJ121
Got expected exception Invalid operation at current cursor position.
Positive Test18 - Test cancelRowUpdates method as the first updatable ResultSet api on a read-only resultset
-SQL State : XJ086
-Got expected exception This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+SQL State : XJ083
+Got expected exception 'cancelRowUpdates' not allowed because the ResultSet is not an updatable ResultSet.
Positive Test19 - Test updateRow method as the first updatable ResultSet api on a read-only resultset
- Got expected exception : This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+ Got expected exception : 'updateRow' not allowed because the ResultSet is not an updatable ResultSet.
Positive Test20 - Test updateXXX methods as the first updatable ResultSet api on a read-only resultset
Test updateShort on a readonly resultset
Using column position as first parameter to updateShort
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateShort' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateShort
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateShort' not allowed because the ResultSet is not an updatable ResultSet.
Test updateInt on a readonly resultset
Using column position as first parameter to updateInt
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateInt' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateInt
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateInt' not allowed because the ResultSet is not an updatable ResultSet.
Test updateLong on a readonly resultset
Using column position as first parameter to updateLong
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateLong' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateLong
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateLong' not allowed because the ResultSet is not an updatable ResultSet.
Test updateBigDecimal on a readonly resultset
Using column position as first parameter to updateBigDecimal
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateBigDecimal' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateBigDecimal
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateBigDecimal' not allowed because the ResultSet is not an updatable ResultSet.
Test updateFloat on a readonly resultset
Using column position as first parameter to updateFloat
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateFloat' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateFloat
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateFloat' not allowed because the ResultSet is not an updatable ResultSet.
Test updateDouble on a readonly resultset
Using column position as first parameter to updateDouble
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateDouble' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateDouble
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateDouble' not allowed because the ResultSet is not an updatable ResultSet.
Test updateString on a readonly resultset
Using column position as first parameter to updateString
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateString' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateString
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateString' not allowed because the ResultSet is not an updatable ResultSet.
Test updateAsciiStream on a readonly resultset
Using column position as first parameter to updateAsciiStream
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateAsciiStream' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateAsciiStream
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateAsciiStream' not allowed because the ResultSet is not an updatable ResultSet.
Test updateCharacterStream on a readonly resultset
Using column position as first parameter to updateCharacterStream
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateCharacterStream' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateCharacterStream
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateCharacterStream' not allowed because the ResultSet is not an updatable ResultSet.
Test updateByte on a readonly resultset
Using column position as first parameter to updateByte
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateByte' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateByte
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateByte' not allowed because the ResultSet is not an updatable ResultSet.
Test updateBytes on a readonly resultset
Using column position as first parameter to updateBytes
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateBytes' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateBytes
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateBytes' not allowed because the ResultSet is not an updatable ResultSet.
Test updateBinaryStream on a readonly resultset
Using column position as first parameter to updateBinaryStream
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateBinaryStream' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateBinaryStream
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateBinaryStream' not allowed because the ResultSet is not an updatable ResultSet.
Test updateClob on a readonly resultset
Using column position as first parameter to updateClob
Got expected exception : JDBC 3 method called - not yet supported
@@ -592,19 +577,19 @@
Got expected exception : JDBC 3 method called - not yet supported
Test updateDate on a readonly resultset
Using column position as first parameter to updateDate
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateDate' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateDate
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateDate' not allowed because the ResultSet is not an updatable ResultSet.
Test updateTime on a readonly resultset
Using column position as first parameter to updateTime
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateTime' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateTime
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateTime' not allowed because the ResultSet is not an updatable ResultSet.
Test updateTimestamp on a readonly resultset
Using column position as first parameter to updateTimestamp
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateTimestamp' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateTimestamp
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateTimestamp' not allowed because the ResultSet is not an updatable ResultSet.
Test updateBlob on a readonly resultset
Using column position as first parameter to updateBlob
Got expected exception : JDBC 3 method called - not yet supported
@@ -612,14 +597,14 @@
Got expected exception : JDBC 3 method called - not yet supported
Test updateBoolean on a readonly resultset
Using column position as first parameter to updateBoolean
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateBoolean' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateBoolean
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateBoolean' not allowed because the ResultSet is not an updatable ResultSet.
Test updateNull on a readonly resultset
Using column position as first parameter to updateNull
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateNull' not allowed because the ResultSet is not an updatable ResultSet.
Using column name as first parameter to updateNull
- Got expected exception : 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+ Got expected exception : 'updateNull' not allowed because the ResultSet is not an updatable ResultSet.
Test updateArray on a readonly resultset
Using column position as first parameter to updateArray
Got expected exception : JDBC 3 method called - not yet supported
@@ -3212,16 +3197,16 @@
Negative test 47 - insertRow and read-only RS
Negative test 47.a - try moveToInsertRow on read-only RS
SQL State: XJ083
-Got expected exception: 'moveToInsertRow()' not allowed because the ResultSet is not an updatable ResultSet.
+Got expected exception: 'moveToInsertRow' not allowed because the ResultSet is not an updatable ResultSet.
Negative test 47.b - try updateXXX on read-only RS
SQL State: XJ083
-Got expected exception: 'updateXXX' not allowed because the ResultSet is not an updatable ResultSet.
+Got expected exception: 'updateInt' not allowed because the ResultSet is not an updatable ResultSet.
Negative test 47.c - try insertRow on read-only RS
-SQL State: XJ086
-Got expected exception: This method cannot be invoked while the cursor is not on the insert row or if the concurrency of this ResultSet object is CONCUR_READ_ONLY.
+SQL State: XJ083
+Got expected exception: 'insertRow' not allowed because the ResultSet is not an updatable ResultSet.
Negative test 47.d - try moveToCurrentRow on read-only RS
SQL State: XJ083
-Got expected exception: 'moveToCurrentRow()' not allowed because the ResultSet is not an updatable ResultSet.
+Got expected exception: 'moveToCurrentRow' not allowed because the ResultSet is not an updatable ResultSet.
Positive test 48 - Test all updateXXX methods on all the supported sql datatypes
Next datatype to test is SMALLINT
Testing updateShort on SQL type SMALLINT