I guess, it will help to actually attach the patch.
thanks,
Mamta
On Apr 5, 2005 1:40 PM, Mamta Satoor <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have sent 2 patches for Derby engine code in the past(and they are
> already commited) in preparation for making updatable resultset
> functionality available in Network Server mode. Here is another patch
> to make progress towards that goal.
>
> The problem is that Derby does not return correct values for
> ResultSetMetaData.getSchemaName and ResultSetMetaData.isWritable. And
> these 2 methods are crucial to have updatable resultset functionality
> under Network Server mode.
>
> Following is the description of the issue from Jira
> "Derby Net Client and JCC driver rely on getSchemanName method to
> construct the correct "update where current of sql" for an updatRow.
> For eg, if the user is in say schema s1 and the updatable resultset is
> issued on a table from schema s2 with the sql "select c11 from s2.t1
> for update". Currenly, getSchemaName returns null and hence, the
> client code constructs a sql like "update t1 ... where current of
> ...". ie the update is being issued against table t1 in schema s1.
> getSchemaName should return s2, so the driver can correctly genereat
> sql as "update s2.t1 ... where current of ...".
>
> In addition, the client code lets a user issue an updateXXX on a
> column only if the column is writable and it determines that by
> looking at the return value of isWritable(). Derby engine currently
> always returns false for this method and because of that, updateXXX
> fails in Network Server mode. Derby should return true for the columns
> which can be updated in the given resultset. For eg for "select c11,
> c12 from t1 for update of c11", isWritable should return true for c11
> and false for c12. "
>
> Most of the changes in this patch are to add methods and variables
> related to schema name and writable status to columns so they are
> available correctly to EmbedResultSetMetaData.java. These changes went
> into ResultColumn.java, VirtualColumnNode.java, BaseColumnNode.java,
> ColumnReference.java, ValueNode.java, GenericColumnDescriptor.java,
> ColumnDescriptor.java, ResultColumnDescriptor.java
>
> CursorNode.java currently marks the columns updatable in FromTable
> object only. The columns need to be marked correctly in
> ResultSetColumnList associated with the cursor also. That is what the
> change in CursorNode.java does.
>
> ResultColumnList.java currently doesn't handle marking columns
> updatable for the column list associated with a cursor node. Added
> markColumnsInSelectListUpdatableByCursor method to handle that.
>
> Change in EmbedResultSet.java is to catch updateXXX on read-only
> columns of the resultset. Have added test for this.
>
> Change in EmbedResultSetMetaData.java is have isWritable method return
> the column's updatableByCursor state. And to call the correct schema
> name method on the column in getSchemaName method.
>
> svn stat
> M java\engine\org\apache\derby\impl\sql\compile\ResultColumn.java
> M java\engine\org\apache\derby\impl\sql\compile\VirtualColumnNode.java
> M java\engine\org\apache\derby\impl\sql\compile\CursorNode.java
> M java\engine\org\apache\derby\impl\sql\compile\BaseColumnNode.java
> M java\engine\org\apache\derby\impl\sql\compile\ColumnReference.java
> M java\engine\org\apache\derby\impl\sql\compile\ValueNode.java
> M java\engine\org\apache\derby\impl\sql\compile\ResultColumnList.java
> M java\engine\org\apache\derby\impl\sql\GenericColumnDescriptor.java
> M java\engine\org\apache\derby\impl\jdbc\EmbedResultSet.java
> M java\engine\org\apache\derby\impl\jdbc\EmbedResultSetMetaData.java
> M java\engine\org\apache\derby\iapi\sql\dictionary\ColumnDescriptor.java
> M java\engine\org\apache\derby\iapi\sql\ResultColumnDescriptor.java
> M
> java\testing\org\apache\derbyTesting\functionTests\tests\lang\updatableResultSet.java
> M
> java\testing\org\apache\derbyTesting\functionTests\master\DerbyNet\updatableResultSet.out
> M
> java\testing\org\apache\derbyTesting\functionTests\master\DerbyNet\resultset.out
> M
> java\testing\org\apache\derbyTesting\functionTests\master\DerbyNetClient\updatableResultSet.out
> M
> java\testing\org\apache\derbyTesting\functionTests\master\DerbyNetClient\resultset.out
> M
> java\testing\org\apache\derbyTesting\functionTests\master\updatableResultSet.out
> M
> java\testing\org\apache\derbyTesting\functionTests\master\jdk14\updatableResultSet.out
> M java\testing\org\apache\derbyTesting\functionTests\master\resultset.out
>
> If no objection from anyone, can a commiter commit this patch?
>
> thanks,
> Mamta
>
Index: java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
(revision 160207)
+++ java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
(working copy)
@@ -85,6 +85,10 @@
String exposedName;
String tableName;
String sourceTableName;
+ //schema name for result column. Used by JCC to determine the
schemaname.tablename that's the target for update...where current of cursorname
sql.
+ //Without the schema name, for "select * from s1.t1 for update", JCC
generates "update t1 ... where current of cursorname"
+ //That is incorrect because update is trying to go against table t1 in
the current schema rather than table t1 in schema s1.
+ String sourceSchemaName;
ValueNode expression;
ColumnDescriptor columnDescriptor;
boolean isGenerated;
@@ -215,7 +219,7 @@
return exposedName;
}
- public String getSchemaName()
+ public String getSchemaName() throws StandardException
{
if ((columnDescriptor!=null) &&
(columnDescriptor.getTableDescriptor() != null))
@@ -256,6 +260,14 @@
}
/**
+ * @see ResultColumnDescriptor#getSourceSchemaName
+ */
+ public String getSourceSchemaName()
+ {
+ return sourceSchemaName;
+ }
+
+ /**
* Clear the table name for the underlying ColumnReference.
* See UpdateNode for full explaination.
*/
@@ -274,14 +286,14 @@
public DataTypeDescriptor getExpressionType()
{
- return (expression == null) ?
+ return (expression == null) ?
dataTypeServices :
expression.getTypeServices();
}
public int getColumnPosition()
{
- if (columnDescriptor!=null)
+ if (columnDescriptor!=null)
return columnDescriptor.getPosition();
else
return virtualColumnId;
@@ -785,6 +797,7 @@
ColumnReference cr = (ColumnReference) expression;
tableName = cr.getTableName();
sourceTableName = cr.getSourceTableName();
+ sourceSchemaName = cr.getSourceSchemaName();
}
}
@@ -1335,11 +1348,11 @@
}
/**
- * Tell whether this column is updatable bay a positioned update.
+ * Tell whether this column is updatable by a positioned update.
*
* @return true means this column is updatable
*/
- boolean updatableByCursor()
+ public boolean updatableByCursor()
{
return updatableByCursor;
}
Index: java/engine/org/apache/derby/impl/sql/compile/VirtualColumnNode.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/compile/VirtualColumnNode.java
(revision 160207)
+++ java/engine/org/apache/derby/impl/sql/compile/VirtualColumnNode.java
(working copy)
@@ -123,6 +123,40 @@
}
/**
+ * Get the name of the table the ResultColumn is in, if any.
+ *
+ * @return A String containing the name of the table the Column
+ * is in. If the column is not in a table (i.e. is a
+ * derived column), it returns NULL.
+ */
+ public String getTableName()
+ {
+ return ( ( sourceColumn != null) ? sourceColumn.getTableName()
: null );
+ }
+
+ /**
+ * Get the name of the schema the ResultColumn's table is in, if any.
+ *
+ * @return A String containing the name of the schema for the
Column's table.
+ * If the column is not in a schema (i.e. is a derived
column), it returns NULL.
+ */
+ public String getSchemaName() throws StandardException
+ {
+ return ( ( sourceColumn != null) ? sourceColumn.getSchemaName()
: null );
+ }
+
+ /**
+ * Return whether or not the ResultColumn is wirtable by a positioned
update.
+ *
+ * @return TRUE, if the column is a base column of a table and is a
+ * writable by a positioned update.
+ */
+ public boolean updatableByCursor()
+ {
+ return ( ( sourceColumn != null) ?
sourceColumn.updatableByCursor() : false );
+ }
+
+ /**
* Return the ResultColumn that is the source of this VirtualColumnNode.
*
* @return ResultSetNode
Index: java/engine/org/apache/derby/impl/sql/compile/CursorNode.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/compile/CursorNode.java
(revision 160207)
+++ java/engine/org/apache/derby/impl/sql/compile/CursorNode.java
(working copy)
@@ -295,7 +295,7 @@
if (updateMode == READ_ONLY)
updatableColumns = null; // don't need them any
more
}
-
+
// bind the update columns
if (updateMode == UPDATE)
{
@@ -308,6 +308,9 @@
if (updateTable instanceof FromTable)
{
((FromTable)
updateTable).markUpdatableByCursor(updatableColumns);
+ //make sure that alongwith the FromTable, we keep other ResultSetLists
in correct state too.
+ //JCC needs the correct ResultSetMetaData.isWritable value in order to
allow updateXXX on updatable resultsets
+
resultSet.getResultColumns().markColumnsInSelectListUpdatableByCursor(updatableColumns);
}
}
Index: java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java
(revision 160207)
+++ java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java
(working copy)
@@ -122,6 +122,16 @@
}
/**
+ * Get the schema name for this column's table
+ *
+ * @return The schema name for this column's table
+ */
+ public String getSchemaName() throws StandardException
+ {
+ return ( ( tableName != null) ? tableName.getSchemaName() :
null );
+ }
+
+ /**
* Do the code generation for this node. Should never be called.
*
* @param acb The ExpressionClassBuilder for the class being built
Index: java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
(revision 160207)
+++ java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
(working copy)
@@ -502,17 +502,40 @@
/**
* Get the name of the table this column comes from.
*
- * @return The name of the table that this column comes from.
+ * @return The name of the table that this column comes from.
* Null if not a ColumnReference.
*/
public String getSourceTableName()
{
- return ( ( tableName != null) ? tableName.getTableName() :
+ return ( ( tableName != null) ? tableName.getTableName() :
((source != null) ?
source.getTableName() : null));
}
/**
+ * Get the name of the schema for the Column's table, if any.
+ *
+ * @return A String containing the name of the schema of the
Column's table.
+ * If the column is not in a schema (i.e. is a derived
column), it returns NULL.
+ */
+ public String getSourceSchemaName() throws StandardException
+ {
+ return ( ( tableName != null) ? tableName.getSchemaName() :
+ ((source != null) ?
source.getSchemaName() : null));
+ }
+
+ /**
+ * Is the column wirtable by the cursor or not. (ie, is it in the list
of FOR UPDATE columns list)
+ *
+ * @return TRUE, if the column is a base column of a table and is a
+ * writable by cursor.
+ */
+ public boolean updatableByCursor()
+ {
+ return ((source != null) ? source.updatableByCursor() : false);
+ }
+
+ /**
Return the table name as the node it is.
@return the column's table name.
*/
Index: java/engine/org/apache/derby/impl/sql/compile/ValueNode.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/compile/ValueNode.java
(revision 160207)
+++ java/engine/org/apache/derby/impl/sql/compile/ValueNode.java
(working copy)
@@ -670,13 +670,13 @@
*
* @return the default schema name for an expression -- null
*/
- public String getSchemaName()
+ public String getSchemaName() throws StandardException
{
return null;
}
/**
- * @return the default schema name for an expression -- null
+ * @return the default table name for an expression -- null
*/
public String getTableName()
{
@@ -684,6 +684,14 @@
}
/**
+ * @return the default updatability for an expression - false
+ */
+ public boolean updatableByCursor()
+ {
+ return false;
+ }
+
+ /**
* This is null so that the caller will substitute in the resultset
generated
* name as needed.
*
Index: java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
(revision 160207)
+++ java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
(working copy)
@@ -262,6 +262,26 @@
return null;
}
+ //It's possible that there is a correlation name being used for the
column name. Because of that, when looking for the
+ //column name match in a SELECT statement's result column list, we
should look at the result column's expression which keeps
+ //the base column name. For eg, in the sql below, when looking for c11,
we will find it in the expression
+ //eg select 1, c11 as a1, c12 from s2.t1 for update of c11
+ ResultColumn getResultColumnThroughExpression(String columnName)
+ {
+ int size = size();
+ for (int index = 0; index < size; index++)
+ {
+ ResultColumn resultColumn = (ResultColumn)
elementAt(index);
+ if (columnName.equals(
resultColumn.expression.getColumnName()) )
+ {
+ /* Mark ResultColumn as referenced and return
it */
+ resultColumn.setReferenced();
+ return resultColumn;
+ }
+ }
+ return null;
+ }
+
/**
* Get a ResultColumn that matches the specified columnName and
* mark the ResultColumn as being referenced.
@@ -2438,7 +2458,7 @@
}
/**
- * Mark all the columns in this list as updatable by a positioned update
+ * Mark all the (base) columns in this list as updatable by a
positioned update
* statement. This is necessary
* for positioned update statements, because we expand the column list
* to include all the columns in the base table, and we need to be able
@@ -2454,7 +2474,9 @@
for (int index = 0; index < size; index++)
{
- ((ResultColumn)
elementAt(index)).markUpdatableByCursor();
+ //determine if the column is a base column and not a
derived column
+ if (((ResultColumn)
elementAt(index)).getSourceTableName() != null)
+ ((ResultColumn)
elementAt(index)).markUpdatableByCursor();
}
}
@@ -2631,17 +2653,28 @@
}
/**
- * Mark as updatable all the columns in this result column list
- * that match the columns in the given update column list
+ * Mark all the columns in the select sql that this result column list
represents
+ * as updatable if they match the columns in the given update column
list.
*
* @param updateColumns A Vector representing the columns
* to be updated.
*/
- void markUpdatableByCursor(Vector updateColumns)
+ void markColumnsInSelectListUpdatableByCursor(Vector updateColumns)
{
+ commonCodeForUpdatableByCursor(updateColumns, true);
+ }
+
+ //dealingWithSelectResultColumnList true means we are dealing with
ResultColumnList for a select sql.
+ //When dealing with ResultColumnList for select sql, it is possible
that not all the updatable columns are
+ //projected in the select column list and hence it is possible that we
may not find the column to be updated
+ //in the ResultColumnList and that is why special handling is required
when dealingWithSelectResultColumnList is true.
+ //eg select c11, c13 from t1 for update of c11, c12
+ //In the eg above, we will find updatable column c11 in the select
column list but we will not find updatable column c12 in the select column list
+ private void commonCodeForUpdatableByCursor(Vector updateColumns,
boolean dealingWithSelectResultColumnList)
+ {
/*
- ** If there is no update column list, or the list is empty,
- ** it means all the columns are updatable.
+ ** If there is no update column list, or the list is empty,
then it means that
+ ** all the columns which have a base table associated with them
are updatable.
*/
if ( (updateColumns == null) || (updateColumns.size() == 0) )
{
@@ -2655,26 +2688,36 @@
for (int index = 0; index < ucSize; index++)
{
- columnName = (String)
updateColumns.elementAt(index);
+ columnName = (String)
updateColumns.elementAt(index);
resultColumn = getResultColumn(columnName);
-
if (SanityManager.DEBUG)
{
- if (resultColumn == null)
+ if (resultColumn == null &&
!dealingWithSelectResultColumnList)
{
- SanityManager.THROWASSERT(
- "No result column found
with name " +
- columnName);
+ SanityManager.THROWASSERT("No
result column found with name " + columnName);
}
}
-
+ if (resultColumn == null &&
dealingWithSelectResultColumnList)
+ continue; //this means the column
specified in FOR UPDATE clause is not part of the select list
resultColumn.markUpdatableByCursor();
}
}
}
/**
+ * Mark as updatable all the columns in this result column list
+ * that match the columns in the given update column list
+ *
+ * @param updateColumns A Vector representing the columns
+ * to be updated.
+ */
+ void markUpdatableByCursor(Vector updateColumns)
+ {
+ commonCodeForUpdatableByCursor(updateColumns, false);
+ }
+
+ /**
* Returns true if the given column position is for a column that will
* be or could be updated by the positioned update of a cursor.
*
Index: java/engine/org/apache/derby/impl/sql/GenericColumnDescriptor.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/GenericColumnDescriptor.java
(revision 160207)
+++ java/engine/org/apache/derby/impl/sql/GenericColumnDescriptor.java
(working copy)
@@ -66,6 +66,7 @@
private int columnPos;
private DataTypeDescriptor type;
private boolean isAutoincrement;
+ private boolean updatableByCursor;
/**
* Niladic constructor for Formatable
@@ -92,10 +93,11 @@
{
name = rcd.getName();
tableName = rcd.getSourceTableName();
- schemaName = rcd.getSchemaName();
+ schemaName = rcd.getSourceSchemaName();
columnPos = rcd.getColumnPosition();
type = rcd.getType();
isAutoincrement = rcd.isAutoincrement();
+ updatableByCursor = rcd.updatableByCursor();
}
/**
@@ -127,7 +129,7 @@
* is in. If the column is not in a schema (i.e. is a
* derived column), it returns NULL.
*/
- public String getSchemaName()
+ public String getSourceSchemaName()
{
return schemaName;
}
@@ -161,6 +163,11 @@
return isAutoincrement;
}
+ public boolean updatableByCursor()
+ {
+ return updatableByCursor;
+ }
+
//////////////////////////////////////////////
//
// FORMATABLE
@@ -182,6 +189,7 @@
fh.putInt("columnPos", columnPos);
fh.put("type", type);
fh.putBoolean("isAutoincrement", isAutoincrement);
+ fh.putBoolean("updatableByCursor", updatableByCursor);
out.writeObject(fh);
return;
}
@@ -205,6 +213,7 @@
columnPos = fh.getInt("columnPos");
type = (DataTypeDescriptor)fh.get("type");
isAutoincrement = fh.getBoolean("isAutoincrement");
+ updatableByCursor = fh.getBoolean("updatableByCursor");
}
/**
Index: java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (revision
160207)
+++ java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (working copy)
@@ -2048,6 +2048,11 @@
//2)Make sure the column corresponds to a column in the base table and
it is not a derived column
if (rd.getColumnDescriptor(columnIndex).getSourceTableName() == null)
throw Util.generateCsSQLException(SQLState.COLUMN_NOT_FROM_BASE_TABLE,
methodName);
+
+ //3)If column not updatable then throw an exception
+ if (!getMetaData().isWritable(columnIndex))
+ throw
Util.generateCsSQLException(SQLState.LANG_COLUMN_NOT_UPDATABLE_IN_CURSOR,
+
theResults.getResultDescription().getColumnDescriptor(columnIndex).getName(),
getCursorName());
}
//do following few checks before accepting updatable resultset api
@@ -3153,6 +3158,8 @@
boolean foundOneColumnAlready = false;
StringBuffer updateWhereCurrentOfSQL = new StringBuffer("UPDATE ");
CursorActivation activation =
getEmbedConnection().getLanguageConnection().lookupCursorActivation(getCursorName());
+
+
ExecCursorTableReference targetTable =
activation.getPreparedStatement().getTargetTable();
updateWhereCurrentOfSQL.append(getFullBaseTableName(targetTable));//got the
underlying (schema.)table name
updateWhereCurrentOfSQL.append(" SET ");
Index: java/engine/org/apache/derby/impl/jdbc/EmbedResultSetMetaData.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/EmbedResultSetMetaData.java
(revision 160207)
+++ java/engine/org/apache/derby/impl/jdbc/EmbedResultSetMetaData.java
(working copy)
@@ -204,7 +204,7 @@
public String getSchemaName(int column) throws SQLException {
ResultColumnDescriptor cd = columnInfo[column - 1];
- String s = cd.getSchemaName();
+ String s = cd.getSourceSchemaName();
// database returns null when no schema name to differentiate
from empty name
return (s==null? "" : s);
}
@@ -308,9 +308,7 @@
*/
public boolean isWritable(int column) throws SQLException {
validColumnNumber(column);
-
- // we just don't know if it is a base table column or not
- return false;
+ return columnInfo[column - 1].updatableByCursor();
}
/**
Index: java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java
===================================================================
--- java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java
(revision 160207)
+++ java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java
(working copy)
@@ -326,6 +326,10 @@
{
return (autoincInc != 0);
}
+ public boolean updatableByCursor()
+ {
+ return false;
+ }
/**
* Get the start value of an autoincrement column
Index: java/engine/org/apache/derby/iapi/sql/ResultColumnDescriptor.java
===================================================================
--- java/engine/org/apache/derby/iapi/sql/ResultColumnDescriptor.java
(revision 160207)
+++ java/engine/org/apache/derby/iapi/sql/ResultColumnDescriptor.java
(working copy)
@@ -47,24 +47,32 @@
String getName();
/**
- * Get the name of the schema the Column is in, if any.
+ * Get the name of the schema the Column's table is in, if any.
*
- * @return A String containing the name of the schema the Column
- * is in. If the column is not in a schema (i.e. is a
+ * @return A String containing the name of the schema to which
Column's
+ * table belongs. If the column is not from a table (i.e.
is a
* derived column), it returns NULL.
*/
- String getSchemaName();
+ String getSourceSchemaName();
/**
* Get the name of the table the Column is in, if any.
*
- * @return A String containing the name of the table the Column
+ * @return A String containing the name of the table of the Column
* is in. If the column is not in a table (i.e. is a
* derived column), it returns NULL.
*/
String getSourceTableName();
/**
+ * Return true if the column is wirtable by a positioned update.
+ *
+ * @return TRUE, if the column is a base column of a table and is a
+ * writable by a positioned update.
+ */
+ boolean updatableByCursor();
+
+ /**
* Get the position of the Column.
* NOTE - position is 1-based.
*
Index:
java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
===================================================================
---
java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
(revision 160207)
+++
java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
(working copy)
@@ -33,8 +33,8 @@
import org.apache.derby.tools.ij;
import org.apache.derby.tools.JDBCDisplayUtil;
+import org.apache.derby.iapi.services.info.JVMInfo;
import org.apache.derbyTesting.functionTests.util.TestUtil;
-import org.apache.derby.iapi.services.info.JVMInfo;
import java.math.BigDecimal;
import java.sql.Array;
@@ -154,7 +154,7 @@
//I have constructed following table based on if combination of
datatype and updateXXX method would work or not.
- public static final String[][] updateXXXRulesTable = {
+ public static final String[][] updateXXXRulesTableForEmbedded = {
// Types. u u u u u u u u u u u u u u u u u u
u u u
// p p p p p p p p p p p p p p p p p
p p p p
@@ -194,8 +194,51 @@
/* 15 TIMESTAMP */ { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "PASS",
"PASS", "PASS", "ERROR", "ERROR", "PASS", "ERROR", "ERROR" },
/* 16 BLOB */ { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR",
"ERROR", "ERROR", "PASS", "ERROR", "PASS", "ERROR", "ERROR" },
- };
+ };
+ //I have constructed following table for network server based on if
combination of datatype and updateXXX method would work or not.
+ public static final String[][] updateXXXRulesTableForNetworkServer = {
+
+ // Types. u u u u u u u u u u u u u u u u u u
u u u
+ // p p p p p p p p p p p p p p p p p
p p p p
+ // d d d d d d d d d d d d d d d d d
d d d d
+ // a a a a a a a a a a a a a a a a a a
a a a
+ // t t t t t t t t t t t t t t t t t t
t t t
+ // e e e e e e e e e e e e e e e e e e
e e e
+ // S I L B F D S A C B B B C D T T B B
N A R
+ // h n o i l o t s h y y i l a i i l
o u r e
+ // o t n g o u r c a t t n o t m m o
o l r f
+ // r g D a b i i r e e a b e e e b
l l a
+ // t e t l n i c s r s
e y
+ // c e g S t y t
a
+ // i t e S a
n
+ // m r r t m
+ // a e S r p
+ // l a t e
+ // m r a
+ // e m
+ // a
+ // m
+/* 0 SMALLINT */ { "PASS", "PASS", "PASS", "PASS", "PASS", "PASS",
"ERROR", "ERROR", "ERROR", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR" },
+/* 1 INTEGER */ { "PASS", "PASS", "PASS", "PASS", "PASS", "PASS",
"ERROR", "ERROR", "ERROR", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR" },
+/* 2 BIGINT */ { "PASS", "PASS", "PASS", "PASS", "PASS", "PASS",
"ERROR", "ERROR", "ERROR", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR" },
+/* 3 DECIMAL */ { "PASS", "PASS", "PASS", "PASS", "PASS", "PASS",
"ERROR", "ERROR", "ERROR", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR" },
+/* 4 REAL */ { "PASS", "PASS", "PASS", "PASS", "PASS", "PASS",
"PASS", "ERROR", "ERROR", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR" },
+/* 5 DOUBLE */ { "PASS", "PASS", "PASS", "PASS", "PASS", "PASS",
"PASS", "ERROR", "ERROR", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR" },
+/* 6 CHAR */ { "PASS", "PASS", "PASS", "PASS", "PASS", "PASS",
"PASS", "PASS", "PASS", "PASS", "ERROR", "ERROR", "ERROR", "PASS", "PASS",
"PASS", "ERROR", "PASS", "PASS", "ERROR", "ERROR" },
+/* 7 VARCHAR */ { "PASS", "PASS", "PASS", "PASS", "PASS", "PASS",
"PASS", "PASS", "PASS", "PASS", "ERROR", "ERROR", "ERROR", "PASS", "PASS",
"PASS", "ERROR", "PASS", "PASS", "ERROR", "ERROR" },
+/* 8 LONGVARCHAR */ { "PASS", "PASS", "PASS", "PASS", "PASS", "PASS",
"PASS", "PASS", "PASS", "PASS", "ERROR", "ERROR", "ERROR", "PASS", "PASS",
"PASS", "ERROR", "PASS", "PASS", "ERROR", "ERROR" },
+/* 9 CHAR FOR BIT */ { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR",
"ERROR", "ERROR", "ERROR", "ERROR", "PASS", "ERROR", "ERROR" },
+/* 10 VARCH. BIT */ { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR",
"ERROR", "ERROR", "ERROR", "ERROR", "PASS", "ERROR", "ERROR" },
+/* 11 LONGVAR. BIT */ { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR",
"ERROR", "ERROR", "ERROR", "ERROR", "PASS", "ERROR", "ERROR" },
+/* 12 CLOB */ { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "PASS", "PASS", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "ERROR", "ERROR", "PASS", "ERROR", "ERROR" },
+/* 13 DATE */ { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "PASS",
"ERROR", "PASS", "ERROR", "ERROR", "PASS", "ERROR", "ERROR" },
+/* 14 TIME */ { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"PASS", "PASS", "ERROR", "ERROR", "PASS", "ERROR", "ERROR" },
+/* 15 TIMESTAMP */ { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "PASS", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "PASS",
"ERROR", "PASS", "ERROR", "ERROR", "PASS", "ERROR", "ERROR" },
+/* 16 BLOB */ { "ERROR", "ERROR", "ERROR", "ERROR", "ERROR",
"ERROR", "ERROR", "ERROR", "ERROR", "ERROR", "PASS", "PASS", "ERROR", "ERROR",
"ERROR", "ERROR", "ERROR", "ERROR", "PASS", "ERROR", "ERROR" },
+
+ };
+
public static void main(String[] args) {
System.out.println("Start testing delete and update using
JDBC2.0 updateable resultset apis");
@@ -218,13 +261,13 @@
}
conn.clearWarnings();
System.out.println("requested TYPE_SCROLL_INSENSITIVE,
CONCUR_UPDATABLE but that is not supported");
- System.out.println("Make sure that we got
TYPE_SCROLL_INSENSITIVE? " + (stmt.getResultSetType() ==
ResultSet.TYPE_SCROLL_INSENSITIVE));
- System.out.println("Make sure that we got
CONCUR_READ_ONLY? " + (stmt.getResultSetConcurrency() ==
ResultSet.CONCUR_READ_ONLY));
- dbmt = conn.getMetaData();
-
System.out.println("ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? "
+ dbmt.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));
-
System.out.println("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)?
" + dbmt.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));
-
System.out.println("deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? " +
dbmt.deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE));
- System.out.println("JDBC 2.0 updatable resultset api
will fail on this resultset because this is not an updatable resultset");
+ System.out.println("Make sure that we got
TYPE_SCROLL_INSENSITIVE? " + (stmt.getResultSetType() ==
ResultSet.TYPE_SCROLL_INSENSITIVE));
+ System.out.println("Make sure that we got
CONCUR_READ_ONLY? " + (stmt.getResultSetConcurrency() ==
ResultSet.CONCUR_READ_ONLY));
+ dbmt = conn.getMetaData();
+
System.out.println("ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? "
+ dbmt.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));
+
System.out.println("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)?
" + dbmt.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));
+
System.out.println("deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? " +
dbmt.deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE));
+ System.out.println("JDBC 2.0 updatable resultset api
will fail on this resultset because this is not an updatable resultset");
rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
rs.next();
try {
@@ -256,10 +299,10 @@
}
conn.clearWarnings();
System.out.println("requested TYPE_SCROLL_SENSITIVE, CONCUR_UPDATABLE
but that is not supported");
- System.out.println("Jira issue Derby-154 : When client
connects to Network Server using JCC, it incorrectly shows support for scroll
sensitive updatable resultsets");
- System.out.println("Make sure that we got TYPE_SCROLL_INSENSITIVE? " +
(stmt.getResultSetType() == ResultSet.TYPE_SCROLL_INSENSITIVE));
- System.out.println("Make sure that we got CONCUR_READ_ONLY? " +
(stmt.getResultSetConcurrency() == ResultSet.CONCUR_READ_ONLY));
- System.out.println("JDBC 2.0 updatable resultset api
will fail on this resultset because this is not an updatable resultset");
+ System.out.println("Jira issue Derby-154 : When client
connects to Network Server using JCC, it incorrectly shows support for scroll
sensitive updatable resultsets");
+ System.out.println("Make sure that we got TYPE_SCROLL_INSENSITIVE? " +
(stmt.getResultSetType() == ResultSet.TYPE_SCROLL_INSENSITIVE));
+ System.out.println("Make sure that we got CONCUR_READ_ONLY? " +
(stmt.getResultSetConcurrency() == ResultSet.CONCUR_READ_ONLY));
+ System.out.println("JDBC 2.0 updatable resultset api
will fail on this resultset because this is not an updatable resultset");
rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
rs.next();
try {
@@ -310,78 +353,80 @@
System.out.println("Negative Test4 - request a read
only resultset and send a sql with FOR UPDATE clause and attempt
deleteRow/updateRow on it");
stmt = conn.createStatement();//the default is a read
only forward only resultset
- rs = stmt.executeQuery("select * from t1 FOR UPDATE");
- System.out.println("Make sure that we got
CONCUR_READ_ONLY? " + (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY));
- rs.next();
- System.out.println("Now attempting to send a deleteRow on a read only
resultset with FOR UPDATE clause in the SELECT sql.");
- try {
- rs.deleteRow();
- System.out.println("FAIL!!! deleteRow should
have failed because this is a read only resultset");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ rs = stmt.executeQuery("select * from t1 FOR UPDATE");
+ System.out.println("Make sure that we got
CONCUR_READ_ONLY? " + (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY));
+ rs.next();
+ System.out.println("Now attempting to send a deleteRow on a read only
resultset with FOR UPDATE clause in the SELECT sql.");
+ try {
+ rs.deleteRow();
+ System.out.println("FAIL!!! deleteRow should
have failed because this is a read only resultset");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
+ }
System.out.println("Now attempting to send a updateRow
on a read only resultset with FOR UPDATE clause in the SELECT sql.");
- try {
- rs.updateRow();
- System.out.println("FAIL!!! updateRow should
have failed because this is a read only resultset");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ try {
+ rs.updateRow();
+ System.out.println("FAIL!!! updateRow should
have failed because this is a read only resultset");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- //have to close the resultset because by default,
resultsets are held open over commit
- rs.close();
+ }
+ //have to close the resultset because by default,
resultsets are held open over commit
+ rs.close();
System.out.println("Negative Test5 - request updatable
resultset for sql with no FOR UPDATE clause");
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("select * from t1");//notice
that we forgot to give mandatory FOR UPDATE clause for updatable resultset
- System.out.println("Make sure that we got
CONCUR_READ_ONLY? " + (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY));
- System.out.println("Jira issue Derby-159 : Warnings
raised by Derby are not getting passed to the Client in Network Server Mode");
- System.out.println("Will see the warnings in embedded
mode only");
- warnings = rs.getWarnings();
- while (warnings != null)
- {
- System.out.println("Expected warnings on
resultset = " + warnings);
- warnings = warnings.getNextWarning();
- }
- rs.clearWarnings();
+ rs = stmt.executeQuery("select * from t1");//notice
that we forgot to give mandatory FOR UPDATE clause for updatable resultset
+ System.out.println("Make sure that we got
CONCUR_READ_ONLY? " + (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY));
+ System.out.println("Jira issue Derby-159 : Warnings
raised by Derby are not getting passed to the Client in Network Server Mode");
+ System.out.println("Will see the warnings in embedded
mode only");
+ warnings = rs.getWarnings();
+ while (warnings != null)
+ {
+ System.out.println("Expected warnings on
resultset = " + warnings);
+ warnings = warnings.getNextWarning();
+ }
+ rs.clearWarnings();
rs.next();
- System.out.println("Now attempting to send a delete on a sql with no FOR
UPDATE clause.");
- try {
- rs.deleteRow();
- System.out.println("FAIL!!! deleteRow should
have failed on sql with no FOR UPDATE clause");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ System.out.println("Now attempting to send a delete on a sql with no FOR
UPDATE clause.");
+ try {
+ rs.deleteRow();
+ System.out.println("FAIL!!! deleteRow should
have failed on sql with no FOR UPDATE clause");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- //have to close the resultset because by default,
resultsets are held open over commit
- rs.close();
-
System.out.println("Now attempting to send a updateRow on a sql with no
FOR UPDATE clause.");
- try {
- rs.updateRow();
- System.out.println("FAIL!!! updateRow should
have failed on sql with no FOR UPDATE clause");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ }
+ System.out.println("Now attempting to send a updateRow on a sql with no
FOR UPDATE clause.");
+ try {
+ rs.updateRow();
+ System.out.println("FAIL!!! updateRow should
have failed on sql with no FOR UPDATE clause");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
+ }
+
//have to close the resultset because by default,
resultsets are held open over commit
+ rs.close();
System.out.println("Negative Test6 - request updatable
resultset for sql with FOR READ ONLY clause");
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("select * from t1 FOR READ
ONLY");
- System.out.println("Make sure that we got
CONCUR_READ_ONLY? " + (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY));
- warnings = rs.getWarnings();
- while (warnings != null)
- {
- System.out.println("Expected warnings on
resultset = " + warnings);
- warnings = warnings.getNextWarning();
- }
- rs.clearWarnings();
- rs.next();
- System.out.println("Now attempting to send a delete on a sql with FOR
READ ONLY clause.");
+ System.out.println("Make sure that we got
CONCUR_READ_ONLY? " + (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY));
+ System.out.println("Jira issue Derby-159 : Warnings
raised by Derby are not getting passed to the Client in Network Server Mode");
+ System.out.println("Will see the warnings in embedded
mode only");
+ warnings = rs.getWarnings();
+ while (warnings != null)
+ {
+ System.out.println("Expected warnings on
resultset = " + warnings);
+ warnings = warnings.getNextWarning();
+ }
+ rs.clearWarnings();
+ rs.next();
+ System.out.println("Now attempting to send a delete on a sql with FOR
READ ONLY clause.");
try {
rs.deleteRow();
System.out.println("FAIL!!! deleteRow should
have failed on sql with FOR READ ONLY clause");
@@ -390,7 +435,7 @@
System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
}
- System.out.println("Now attempting to send a updateRow
on a sql with FOR READ ONLY clause.");
+ System.out.println("Now attempting to send a updateRow
on a sql with FOR READ ONLY clause.");
try {
rs.updateRow();
System.out.println("FAIL!!! updateRow should
have failed on sql with FOR READ ONLY clause");
@@ -399,15 +444,14 @@
System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
}
- //have to close the resultset because by default,
resultsets are held open over commit
+ //have to close the resultset because by default,
resultsets are held open over commit
rs.close();
- if (TestUtil.isEmbeddedFramework()) {
System.out.println("Negative Test7 - attempt to
deleteRow & updateRow on updatable resultset when the resultset is not
positioned on a row");
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT 1, 2 FROM t1 FOR UPDATE");
+ rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
System.out.println("Make sure that we got
CONCUR_UPDATABLE? " + (rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE));
- System.out.println("Now attempt a deleteRow without first doing next on
the resultset.");
+ System.out.println("Now attempt a deleteRow without first doing next on
the resultset.");
try {
rs.deleteRow();
System.out.println("FAIL!!! deleteRow should
have failed because resultset is not on a row");
@@ -416,16 +460,21 @@
System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
}
- System.out.println("Now attempt a updateRow without first doing next on
the resultset.");
+ System.out.println("Now attempt a updateRow without first doing next on
the resultset.");
+ System.out.println("In embedded mode, updateRow will
check if it is on a row or not even though no changes have been made to the row
using updateXXX");
+ System.out.println("In Network Server mode, if no
updateXXX were issued before updateRow, then updateRow is a no-op and doesn't
check if it is on a row or not");
try {
rs.updateRow();
- System.out.println("FAIL!!! updateRow should
have failed because resultset is not on a row");
+ if (TestUtil.isEmbeddedFramework())
+ System.out.println("FAIL!!! In embedded
mode, this updateRow should have failed because resultset is not on a row");
+ else
+ System.out.println("PASS!!! In Network
Server mode, this updateRow is a no-op because no updateXXX were issued before
the updateRow");
}
catch (SQLException e) {
System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
}
- while (rs.next());//read all the rows from the
resultset and position after the last row
+ while (rs.next());//read all the rows from the
resultset and position after the last row
System.out.println("ResultSet is positioned after the last row. attempt
to deleteRow at this point should fail!");
try {
rs.deleteRow();
@@ -448,7 +497,7 @@
System.out.println("Negative Test8 - attempt deleteRow
& updateRow on updatable resultset after closing the resultset");
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT 1, 2 FROM t1 FOR UPDATE");
+ rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
System.out.println("Make sure that we got
CONCUR_UPDATABLE? " + (rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE));
rs.next();
rs.close();
@@ -503,10 +552,11 @@
System.out.println("Negative Test12 - With autocommit
on, attempt to drop a table when there is an open updatable resultset on it");
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT 1, 2 FROM t1 FOR UPDATE");
+ rs = stmt.executeQuery("SELECT c1 FROM t1 FOR UPDATE");
rs.next();
+ rs.updateInt(1,123);
System.out.println("Opened an updatable resultset. Now
trying to drop that table through another Statement");
- stmt1 = conn.createStatement();
+ stmt1 = conn.createStatement();
try {
stmt1.executeUpdate("drop table t1");
System.out.println("FAIL!!! drop table should
have failed because the updatable resultset is still open");
@@ -516,26 +566,26 @@
System.out.println("Got expected exception " +
e.getMessage());
}
System.out.println("Since autocommit is on, the drop
table exception resulted in a runtime rollback causing updatable resultset
object to close");
- try {
- rs.updateRow();
- System.out.println("FAIL!!! resultset should
have been closed at this point and updateRow should have failed");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ try {
+ rs.updateRow();
+ System.out.println("FAIL!!! resultset should
have been closed at this point and updateRow should have failed");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- try {
- rs.deleteRow();
- System.out.println("FAIL!!! resultset should
have been closed at this point and deleteRow should have failed");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ }
+ try {
+ rs.deleteRow();
+ System.out.println("FAIL!!! resultset should
have been closed at this point and deleteRow should have failed");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
-
+ }
+
System.out.println("Negative Test13 - foreign key
constraint failure will cause deleteRow to fail");
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT 1, 2 FROM tableWithPrimaryKey FOR
UPDATE");
+ rs = stmt.executeQuery("SELECT * FROM tableWithPrimaryKey FOR UPDATE");
rs.next();
try {
rs.deleteRow();
@@ -546,15 +596,17 @@
System.out.println("Got expected exception " +
e.getMessage());
}
System.out.println("Since autocommit is on, the
constraint exception resulted in a runtime rollback causing updatable resultset
object to close");
- try {
- rs.next();
- System.out.println("FAIL!!! next should have
failed because foreign key constraint failure resulted in a runtime rollback");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ try {
+ rs.next();
+ if (TestUtil.isNetFramework())
+ System.out.println("Jira entry
Derby-160 : for Network Server because next should have failed");
+ System.out.println("FAIL!!! next should have
failed because foreign key constraint failure resulted in a runtime rollback");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
-
+ }
+
System.out.println("Negative Test14 - foreign key
constraint failure will cause updateRow to fail");
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT c1, c2 FROM
tableWithPrimaryKey FOR UPDATE");
@@ -570,18 +622,20 @@
System.out.println("Got expected exception " +
e.getMessage());
}
System.out.println("Since autocommit is on, the
constraint exception resulted in a runtime rollback causing updatable resultset
object to close");
- try {
- rs.next();
- System.out.println("FAIL!!! next should have
failed because foreign key constraint failure resulted in a runtime rollback");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ try {
+ rs.next();
+ if (TestUtil.isNetFramework())
+ System.out.println("Jira entry
Derby-160 : for Network Server because next should have failed");
+ System.out.println("FAIL!!! next should have
failed because foreign key constraint failure resulted in a runtime rollback");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
-
+ }
+
System.out.println("Negative Test15 - Can't call
updateXXX methods on columns that do not correspond to a column in the table");
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT 1, 2 FROM
tableWithPrimaryKey FOR UPDATE");
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT 1, 2 FROM t1 FOR
UPDATE");
rs.next();
try {
rs.updateInt(1,22);
@@ -593,7 +647,7 @@
}
System.out.println("Negative Test16 - Call updateXXX
method on out of the range column");
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT c1, c2 FROM t1 FOR
UPDATE");
rs.next();
System.out.println("There are only 2 columns in the
select list and we are trying to send updateXXX on column position 3");
@@ -623,14 +677,18 @@
System.out.println("column 1 on this row before deleteRow is " +
rs.getInt(1));
System.out.println("column 2 on this row before deleteRow is " +
rs.getString(2));
rs.deleteRow();
- System.out.println("Since after deleteRow(), ResultSet is positioned
before the next row, getXXX will fail");
- try {
- System.out.println("column 1 on this deleted
row is " + rs.getInt(1));
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
- System.out.println("Got expected exception " +
e.getMessage());
- }
+ System.out.println("Since after deleteRow(), in embedded mode, ResultSet
is positioned before the next row, getXXX will fail");
+ System.out.println("In Network Server mode, the ResultSet stays on the
deleted row after deleteRow and hence no error for getXXX");
+ try {
+ System.out.println("column 1 on this deleted
row is " + rs.getInt(1));
+ }
+ catch (SQLException e) {
+ if (TestUtil.isEmbeddedFramework()) {
+ System.out.println("SQL State : " +
e.getSQLState());
+ System.out.println("Got expected
exception " + e.getMessage());
+ } else
+ System.out.println("Got unexpected
exception " + e.getMessage());
+ }
System.out.println("calling deleteRow again w/o first positioning the
ResultSet on the next row will fail");
try {
rs.deleteRow();
@@ -643,10 +701,11 @@
System.out.println("Position the ResultSet with next()");
rs.next();
System.out.println("Should be able to deletRow() on the current row
now");
- rs.deleteRow();
+ rs.deleteRow();
//have to close the resultset because by default,
resultsets are held open over commit
rs.close();
+ if (TestUtil.isEmbeddedFramework()) {
System.out.println("Positive Test1b - request updatable
resultset for forward only type resultset");
reloadData();
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
@@ -664,14 +723,15 @@
System.out.println("column 2 on this row before
updateString is " + rs.getString(2));
System.out.println("now updateRow on the row");
rs.updateRow();
- System.out.println("Since after updateRow(), ResultSet
is positioned before the next row, getXXX will fail");
+ System.out.println("Since after updateRow(), in
embedded mode, ResultSet is positioned before the next row, getXXX will fail");
+ System.out.println("In Network Server mode, the ResultSet stays on the
updated row after updateRow and hence no error for getXXX");
try {
- System.out.println("column 1 on this updateRow
row is " + rs.getInt(1));
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ System.out.println("column 1 on this updateRow
row is " + rs.getInt(1));
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
+ }
System.out.println("calling updateRow again w/o first
positioning the ResultSet on the next row will fail");
try {
rs.updateRow();
@@ -684,15 +744,15 @@
System.out.println("Position the ResultSet with
next()");
rs.next();
System.out.println("Should be able to updateRow() on
the current row now");
- rs.updateString(2,"234");
- rs.updateRow();
+ rs.updateString(2,"234");
+ rs.updateRow();
//have to close the resultset because by default,
resultsets are held open over commit
rs.close();
System.out.println("Positive Test2 - even if no columns
from table specified in the column list, we should be able to get updatable
resultset");
reloadData();
System.out.println("total number of rows in T1 ");
- dumpRS(stmt.executeQuery("select count(*) from t1"));
+ dumpRS(stmt.executeQuery("select count(*) from t1"));
rs = stmt.executeQuery("SELECT 1, 2 FROM t1 FOR UPDATE");
rs.next();
System.out.println("column 1 on this row is " + rs.getInt(1));
@@ -700,7 +760,7 @@
//have to close the resultset because by default,
resultsets are held open over commit
rs.close();
System.out.println("total number of rows in T1 after one deleteRow is ");
- dumpRS(stmt.executeQuery("select count(*) from t1"));
+ dumpRS(stmt.executeQuery("select count(*) from t1"));
System.out.println("Positive Test3a - use prepared
statement with concur updatable status to test deleteRow");
reloadData();
@@ -714,14 +774,14 @@
System.out.println("column 1 on this row is " + rs.getInt(1));
rs.deleteRow();
System.out.println("Since after deleteRow(), ResultSet is positioned
before the next row, getXXX will fail");
- try {
- System.out.println("column 1 on this deleted
row is " + rs.getInt(1));
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ try {
+ System.out.println("column 1 on this deleted
row is " + rs.getInt(1));
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- System.out.println("calling deleteRow again w/o first positioning the
ResultSet on the next row will fail");
+ }
+ System.out.println("calling deleteRow again w/o first positioning the
ResultSet on the next row will fail");
try {
rs.deleteRow();
System.out.println("FAIL!!! deleteRow should
have failed because it can't be called more than once on the same row");
@@ -733,7 +793,7 @@
System.out.println("Position the ResultSet with next()");
rs.next();
System.out.println("Should be able to deletRow() on the current row
now");
- rs.deleteRow();
+ rs.deleteRow();
//have to close the resultset because by default,
resultsets are held open over commit
rs.close();
@@ -751,14 +811,14 @@
System.out.println("column 1 on this row after
updateInt is " + rs.getInt(1));
rs.updateRow();
System.out.println("Since after updateRow(), ResultSet
is positioned before the next row, getXXX will fail");
- try {
- System.out.println("column 1 on this updated
row is " + rs.getInt(1));
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ try {
+ System.out.println("column 1 on this updated
row is " + rs.getInt(1));
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- System.out.println("calling updateRow/updateXXX again
w/o first positioning the ResultSet on the next row will fail");
+ }
+ System.out.println("calling updateRow/updateXXX again
w/o first positioning the ResultSet on the next row will fail");
try {
rs.updateInt(1,0);
System.out.println("FAIL!!! updateXXX should
have failed because resultset is not positioned on a row");
@@ -786,7 +846,7 @@
System.out.println("Position the ResultSet with
next()");
rs.next();
System.out.println("Should be able to
cancelRowUpdates() on the current row now");
- rs.cancelRowUpdates();
+ rs.cancelRowUpdates();
//have to close the resultset because by default,
resultsets are held open over commit
rs.close();
@@ -801,14 +861,14 @@
System.out.println("column 1 on this row is " + rs.getInt(1));
rs.deleteRow();
System.out.println("Since after deleteRow(), ResultSet is positioned
before the next row, getXXX will fail");
- try {
- System.out.println("column 1 on this deleted
row is " + rs.getInt(1));
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ try {
+ System.out.println("column 1 on this deleted
row is " + rs.getInt(1));
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- System.out.println("calling deleteRow again w/o first positioning the
ResultSet on the next row will fail");
+ }
+ System.out.println("calling deleteRow again w/o first positioning the
ResultSet on the next row will fail");
try {
rs.deleteRow();
System.out.println("FAIL!!! deleteRow should
have failed because it can't be called more than once on the same row");
@@ -820,7 +880,7 @@
System.out.println("Position the ResultSet with next()");
rs.next();
System.out.println("Should be able to deletRow() on the current row
now");
- rs.deleteRow();
+ rs.deleteRow();
//have to close the resultset because by default,
resultsets are held open over commit
rs.close();
@@ -839,39 +899,39 @@
rs.close();
System.out.println("Positive Test6a - For Forward Only
resultsets, DatabaseMetaData will return false for ownDeletesAreVisible and
deletesAreDetected");
- System.out.println("This is because, after deleteRow,
we position the ResultSet before the next row. We don't make a hole for the
deleted row and then stay on that deleted hole");
+ System.out.println("This is because, after deleteRow,
we position the ResultSet before the next row. We don't make a hole for the
deleted row and then stay on that deleted hole");
dbmt = conn.getMetaData();
System.out.println("ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY)? "
+ dbmt.ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
System.out.println("othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY)? " +
dbmt.othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
System.out.println("deletesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? " +
dbmt.deletesAreDetected(ResultSet.TYPE_FORWARD_ONLY));
reloadData();
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT 1, 2 FROM t1 FOR UPDATE of c1");
- rs.next();
- System.out.println("The JDBC program should look at rowDeleted only if
deletesAreDetected returns true");
- System.out.println("Since Derby returns false for detlesAreDetected for
FORWARD_ONLY updatable resultset,the program should not rely on rs.rowDeleted()
for FORWARD_ONLY updatable resultsets");
- System.out.println("Have this call to rs.rowDeleted() just to make sure
the method does always return false? " + rs.rowDeleted());
- rs.deleteRow();
- System.out.println("Have this call to rs.rowDeleted() just to make sure
the method does always return false? " + rs.rowDeleted());
- rs.close();
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT 1, 2 FROM t1 FOR UPDATE of c1");
+ rs.next();
+ System.out.println("The JDBC program should look at rowDeleted only if
deletesAreDetected returns true");
+ System.out.println("Since Derby returns false for detlesAreDetected for
FORWARD_ONLY updatable resultset,the program should not rely on rs.rowDeleted()
for FORWARD_ONLY updatable resultsets");
+ System.out.println("Have this call to rs.rowDeleted() just to make sure
the method does always return false? " + rs.rowDeleted());
+ rs.deleteRow();
+ System.out.println("Have this call to rs.rowDeleted() just to make sure
the method does always return false? " + rs.rowDeleted());
+ rs.close();
System.out.println("Positive Test6b - For Forward Only
resultsets, DatabaseMetaData will return false for ownUpdatesAreVisible and
updatesAreDetected");
- System.out.println("This is because, after updateRow,
we position the ResultSet before the next row");
+ System.out.println("This is because, after updateRow,
we position the ResultSet before the next row");
dbmt = conn.getMetaData();
System.out.println("ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY)? " +
dbmt.ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
System.out.println("othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY)? " +
dbmt.othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
System.out.println("updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? " +
dbmt.updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY));
reloadData();
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE of
c1");
- rs.next();
- System.out.println("The JDBC program should look at
rowUpdated only if updatesAreDetected returns true");
- System.out.println("Since Derby returns false for
updatesAreDetected for FORWARD_ONLY updatable resultset,the program should not
rely on rs.rowUpdated() for FORWARD_ONLY updatable resultsets");
- System.out.println("Have this call to rs.rowUpdated()
just to make sure the method does always return false? " + rs.rowUpdated());
- rs.updateLong(1,123);
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE of
c1");
+ rs.next();
+ System.out.println("The JDBC program should look at
rowUpdated only if updatesAreDetected returns true");
+ System.out.println("Since Derby returns false for
updatesAreDetected for FORWARD_ONLY updatable resultset,the program should not
rely on rs.rowUpdated() for FORWARD_ONLY updatable resultsets");
+ System.out.println("Have this call to rs.rowUpdated()
just to make sure the method does always return false? " + rs.rowUpdated());
+ rs.updateLong(1,123);
rs.updateRow();
- System.out.println("Have this call to rs.rowUpdated()
just to make sure the method does always return false? " + rs.rowUpdated());
- rs.close();
+ System.out.println("Have this call to rs.rowUpdated()
just to make sure the method does always return false? " + rs.rowUpdated());
+ rs.close();
System.out.println("Positive Test7a - delete using
updatable resultset api from a temporary table");
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
@@ -975,19 +1035,56 @@
reloadData();
rs = stmt.executeQuery("SELECT c1, c2 FROM t1 abcde FOR
UPDATE of c1");
rs.next();
- rs.updateString(2,"bbbb");
try {
- rs.updateRow();
- System.out.println("FAIL!!! updateRow should
have failed");
+ rs.updateString(2,"bbbb");
+ System.out.println("FAIL!!! updateString on
readonly column should have failed");
}
catch (SQLException e) {
System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
}
+ System.out.println("attempt to get an updatable
resultset using correlation name for an readonly column. It should work");
+ System.out.println("The sql is SELECT c1, c2 as col2
FROM t1 abcde FOR UPDATE of c1");
+ rs = stmt.executeQuery("SELECT c1, c2 as col2 FROM t1
abcde FOR UPDATE of c1");
+ rs.next();
+ rs.updateInt(1,11);
+ rs.updateRow();
rs.close();
System.out.println("Table t1 after updateRow has
following rows");
dumpRS(stmt.executeQuery("select * from t1"));
+ System.out.println("Positive Test9c - try to updateXXX
on a readonly column. Should get error");
+ reloadData();
+ rs = stmt.executeQuery("SELECT c1, c2 FROM t1 abcde FOR
UPDATE of c1");
+ rs.next();
+ try {
+ rs.updateString(2,"bbbb");
+ System.out.println("FAIL!!! updateString on
readonly column should have failed");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
+ System.out.println("Got expected exception " +
e.getMessage());
+ }
+ rs.close();
+ System.out.println("Table t1 has following rows");
+ dumpRS(stmt.executeQuery("select * from t1"));
+
+ System.out.println("Positive Test9d - try to updateXXX
on a readonly column with correlation name. Should get error");
+ reloadData();
+ rs = stmt.executeQuery("SELECT c1, c2 as col2 FROM t1
abcde FOR UPDATE of c1");
+ rs.next();
+ try {
+ rs.updateString(2,"bbbb");
+ System.out.println("FAIL!!! updateString on
readonly column should have failed");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
+ System.out.println("Got expected exception " +
e.getMessage());
+ }
+ rs.close();
+ System.out.println("Table t1 has following rows");
+ dumpRS(stmt.executeQuery("select * from t1"));
+
System.out.println("Positive Test10 - 2 updatable
resultsets going against the same table, will they conflict?");
conn.setAutoCommit(false);
reloadData();
@@ -1009,8 +1106,8 @@
System.out.println("Got expected exception " +
e.getMessage());
}
System.out.println("Move to next row in the 2nd
resultset and then delete using the second resultset");
- rs1.next();
- rs1.deleteRow();
+ rs1.next();
+ rs1.deleteRow();
rs.close();
rs1.close();
conn.setAutoCommit(true);
@@ -1060,218 +1157,218 @@
//have to close the resultset because by default,
resultsets are held open over commit
rs.close();
- System.out.println("Positive Test13a - Another test
case for delete trigger");
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT * FROM
table1WithTriggers FOR UPDATE");
- rs.next();
- System.out.println("column 1 on this row is " +
rs.getInt(1));
- System.out.println("this delete row will fire the
delete trigger which will delete all the rows from the table and from the
resultset");
- rs.deleteRow();
- rs.next();
- try {
- rs.deleteRow();
- System.out.println("FAIL!!! there should have
be no more rows in the resultset at this point because delete trigger deleted
all the rows");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ System.out.println("Positive Test13a - Another test
case for delete trigger");
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT * FROM
table1WithTriggers FOR UPDATE");
+ rs.next();
+ System.out.println("column 1 on this row is " +
rs.getInt(1));
+ System.out.println("this delete row will fire the
delete trigger which will delete all the rows from the table and from the
resultset");
+ rs.deleteRow();
+ rs.next();
+ try {
+ rs.deleteRow();
+ System.out.println("FAIL!!! there should have
be no more rows in the resultset at this point because delete trigger deleted
all the rows");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- rs.close();
- System.out.println("Verify that delete trigger got
fired by verifying the row count to be 0 in table1WithTriggers");
- dumpRS(stmt.executeQuery("select count(*) from
table1WithTriggers"));
- //have to close the resultset because by default,
resultsets are held open over commit
- rs.close();
+ }
+ rs.close();
+ System.out.println("Verify that delete trigger got
fired by verifying the row count to be 0 in table1WithTriggers");
+ dumpRS(stmt.executeQuery("select count(*) from
table1WithTriggers"));
+ //have to close the resultset because by default,
resultsets are held open over commit
+ rs.close();
- System.out.println("Positive Test13b - Another test
case for update trigger");
- System.out.println("Look at the current contents of
table2WithTriggers");
- dumpRS(stmt.executeQuery("select * from
table2WithTriggers"));
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT * FROM
table2WithTriggers where c1>1 FOR UPDATE");
- rs.next();
- System.out.println("column 1 on this row is " +
rs.getInt(1));
- System.out.println("this update row will fire the
update trigger which will update all the rows in the table to have c1=1 and
hence no more rows will qualify for the resultset");
- rs.updateLong(1,123);
+ System.out.println("Positive Test13b - Another test
case for update trigger");
+ System.out.println("Look at the current contents of
table2WithTriggers");
+ dumpRS(stmt.executeQuery("select * from
table2WithTriggers"));
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT * FROM
table2WithTriggers where c1>1 FOR UPDATE");
+ rs.next();
+ System.out.println("column 1 on this row is " +
rs.getInt(1));
+ System.out.println("this update row will fire the
update trigger which will update all the rows in the table to have c1=1 and
hence no more rows will qualify for the resultset");
+ rs.updateLong(1,123);
rs.updateRow();
- rs.next();
- try {
- rs.updateRow();
- System.out.println("FAIL!!! there should have
be no more rows in the resultset at this point because update trigger made all
the rows not qualify for the resultset");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ rs.next();
+ try {
+ rs.updateRow();
+ System.out.println("FAIL!!! there should have
be no more rows in the resultset at this point because update trigger made all
the rows not qualify for the resultset");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- rs.close();
- System.out.println("Verify that update trigger got
fired by verifying that all column c1s have value 1 in table2WithTriggers");
- dumpRS(stmt.executeQuery("select * from
table2WithTriggers"));
- //have to close the resultset because by default,
resultsets are held open over commit
- rs.close();
+ }
+ rs.close();
+ System.out.println("Verify that update trigger got
fired by verifying that all column c1s have value 1 in table2WithTriggers");
+ dumpRS(stmt.executeQuery("select * from
table2WithTriggers"));
+ //have to close the resultset because by default,
resultsets are held open over commit
+ rs.close();
- System.out.println("Positive Test14a - make sure self
referential delete cascade works when deleteRow is issued");
- dumpRS(stmt.executeQuery("select * from
selfReferencingT1"));
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT * FROM selfReferencingT1
FOR UPDATE");
- rs.next();
- System.out.println("column 1 on this row is " +
rs.getString(1));
- System.out.println("this delete row will cause the
delete cascade constraint to delete all the rows from the table and from the
resultset");
- rs.deleteRow();
- rs.next();
- try {
- rs.deleteRow();
- System.out.println("FAIL!!! there should have
be no more rows in the resultset at this point because delete cascade deleted
all the rows");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ System.out.println("Positive Test14a - make sure self
referential delete cascade works when deleteRow is issued");
+ dumpRS(stmt.executeQuery("select * from
selfReferencingT1"));
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT * FROM selfReferencingT1
FOR UPDATE");
+ rs.next();
+ System.out.println("column 1 on this row is " +
rs.getString(1));
+ System.out.println("this delete row will cause the
delete cascade constraint to delete all the rows from the table and from the
resultset");
+ rs.deleteRow();
+ rs.next();
+ try {
+ rs.deleteRow();
+ System.out.println("FAIL!!! there should have
be no more rows in the resultset at this point because delete cascade deleted
all the rows");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- rs.close();
- System.out.println("Verify that delete trigger got
fired by verifying the row count to be 0 in selfReferencingT1");
- dumpRS(stmt.executeQuery("select count(*) from
selfReferencingT1"));
- //have to close the resultset because by default,
resultsets are held open over commit
- rs.close();
+ }
+ rs.close();
+ System.out.println("Verify that delete trigger got
fired by verifying the row count to be 0 in selfReferencingT1");
+ dumpRS(stmt.executeQuery("select count(*) from
selfReferencingT1"));
+ //have to close the resultset because by default,
resultsets are held open over commit
+ rs.close();
- System.out.println("Positive Test14b - make sure self
referential update restrict works when updateRow is issued");
- dumpRS(stmt.executeQuery("select * from
selfReferencingT2"));
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT * FROM selfReferencingT2
FOR UPDATE");
- rs.next();
- System.out.println("column 1 on this row is " +
rs.getString(1));
- System.out.println("update row should fail because
cascade constraint is update restrict");
- rs.updateString(1,"e2");
- try {
- rs.updateRow();
- System.out.println("FAIL!!! this update should
have caused violation of foreign key constraint");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ System.out.println("Positive Test14b - make sure self
referential update restrict works when updateRow is issued");
+ dumpRS(stmt.executeQuery("select * from
selfReferencingT2"));
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT * FROM selfReferencingT2
FOR UPDATE");
+ rs.next();
+ System.out.println("column 1 on this row is " +
rs.getString(1));
+ System.out.println("update row should fail because
cascade constraint is update restrict");
+ rs.updateString(1,"e2");
+ try {
+ rs.updateRow();
+ System.out.println("FAIL!!! this update should
have caused violation of foreign key constraint");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- //have to close the resultset because by default,
resultsets are held open over commit
- rs.close();
+ }
+ //have to close the resultset because by default,
resultsets are held open over commit
+ rs.close();
- System.out.println("Positive Test15 - With autocommit
off, attempt to drop a table when there is an open updatable resultset on it");
- reloadData();
- conn.setAutoCommit(false);
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT 1, 2 FROM t1 FOR UPDATE");
- rs.next();
- System.out.println("Opened an updatable resultset. Now
trying to drop that table through another Statement");
- stmt1 = conn.createStatement();
- try {
- stmt1.executeUpdate("drop table t1");
- System.out.println("FAIL!!! drop table should
have failed because the updatable resultset is still open");
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ System.out.println("Positive Test15 - With autocommit
off, attempt to drop a table when there is an open updatable resultset on it");
+ reloadData();
+ conn.setAutoCommit(false);
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT 1, 2 FROM t1 FOR UPDATE");
+ rs.next();
+ System.out.println("Opened an updatable resultset. Now
trying to drop that table through another Statement");
+ stmt1 = conn.createStatement();
+ try {
+ stmt1.executeUpdate("drop table t1");
+ System.out.println("FAIL!!! drop table should
have failed because the updatable resultset is still open");
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- System.out.println("Since autocommit is off, the drop
table exception will NOT result in a runtime rollback and hence updatable
resultset object is still open");
- rs.deleteRow();
- rs.close();
- conn.setAutoCommit(true);
-
- System.out.println("Positive Test16a - Do deleteRow
within a transaction and then rollback the transaction");
- reloadData();
- conn.setAutoCommit(false);
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- System.out.println("Verify that before delete trigger
got fired, row count is 0 in deleteTriggerInsertIntoThisTable");
- dumpRS(stmt.executeQuery("select count(*) from
deleteTriggerInsertIntoThisTable"));
- System.out.println("Verify that before deleteRow, row
count is 4 in table0WithTriggers");
- dumpRS(stmt.executeQuery("select count(*) from
table0WithTriggers"));
- rs = stmt.executeQuery("SELECT * FROM
table0WithTriggers FOR UPDATE");
- rs.next();
- System.out.println("column 1 on this row is " +
rs.getInt(1));
- System.out.println("now try to delete row and make sure
that trigger got fired");
- rs.deleteRow();
- rs.close();
- System.out.println("Verify that delete trigger got
fired by verifying the row count to be 1 in deleteTriggerInsertIntoThisTable");
- dumpRS(stmt.executeQuery("select count(*) from
deleteTriggerInsertIntoThisTable"));
- System.out.println("Verify that deleteRow in
transaction, row count is 3 in table0WithTriggers");
- dumpRS(stmt.executeQuery("select count(*) from
table0WithTriggers"));
- //have to close the resultset because by default,
resultsets are held open over commit
- rs.close();
- conn.rollback();
- System.out.println("Verify that after rollback, row
count is back to 0 in deleteTriggerInsertIntoThisTable");
- dumpRS(stmt.executeQuery("select count(*) from
deleteTriggerInsertIntoThisTable"));
- System.out.println("Verify that after rollback, row
count is back to 4 in table0WithTriggers");
- dumpRS(stmt.executeQuery("select count(*) from
table0WithTriggers"));
- conn.setAutoCommit(true);
-
- System.out.println("Positive Test16b - Do updateRow
within a transaction and then rollback the transaction");
- reloadData();
- conn.setAutoCommit(false);
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- System.out.println("Verify that before update trigger
got fired, row count is 0 in updateTriggerInsertIntoThisTable");
- dumpRS(stmt.executeQuery("select count(*) from
updateTriggerInsertIntoThisTable"));
- System.out.println("Look at the data in
table0WithTriggers before trigger gets fired");
- dumpRS(stmt.executeQuery("select * from
table0WithTriggers"));
- rs = stmt.executeQuery("SELECT * FROM
table0WithTriggers FOR UPDATE");
- rs.next();
- System.out.println("column 1 on this row is " +
rs.getInt(1));
+ }
+ System.out.println("Since autocommit is off, the drop
table exception will NOT result in a runtime rollback and hence updatable
resultset object is still open");
+ rs.deleteRow();
+ rs.close();
+ conn.setAutoCommit(true);
+
+ System.out.println("Positive Test16a - Do deleteRow
within a transaction and then rollback the transaction");
+ reloadData();
+ conn.setAutoCommit(false);
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ System.out.println("Verify that before delete trigger
got fired, row count is 0 in deleteTriggerInsertIntoThisTable");
+ dumpRS(stmt.executeQuery("select count(*) from
deleteTriggerInsertIntoThisTable"));
+ System.out.println("Verify that before deleteRow, row
count is 4 in table0WithTriggers");
+ dumpRS(stmt.executeQuery("select count(*) from
table0WithTriggers"));
+ rs = stmt.executeQuery("SELECT * FROM
table0WithTriggers FOR UPDATE");
+ rs.next();
+ System.out.println("column 1 on this row is " +
rs.getInt(1));
+ System.out.println("now try to delete row and make sure
that trigger got fired");
+ rs.deleteRow();
+ rs.close();
+ System.out.println("Verify that delete trigger got
fired by verifying the row count to be 1 in deleteTriggerInsertIntoThisTable");
+ dumpRS(stmt.executeQuery("select count(*) from
deleteTriggerInsertIntoThisTable"));
+ System.out.println("Verify that deleteRow in
transaction, row count is 3 in table0WithTriggers");
+ dumpRS(stmt.executeQuery("select count(*) from
table0WithTriggers"));
+ //have to close the resultset because by default,
resultsets are held open over commit
+ rs.close();
+ conn.rollback();
+ System.out.println("Verify that after rollback, row
count is back to 0 in deleteTriggerInsertIntoThisTable");
+ dumpRS(stmt.executeQuery("select count(*) from
deleteTriggerInsertIntoThisTable"));
+ System.out.println("Verify that after rollback, row
count is back to 4 in table0WithTriggers");
+ dumpRS(stmt.executeQuery("select count(*) from
table0WithTriggers"));
+ conn.setAutoCommit(true);
+
+ System.out.println("Positive Test16b - Do updateRow
within a transaction and then rollback the transaction");
+ reloadData();
+ conn.setAutoCommit(false);
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ System.out.println("Verify that before update trigger
got fired, row count is 0 in updateTriggerInsertIntoThisTable");
+ dumpRS(stmt.executeQuery("select count(*) from
updateTriggerInsertIntoThisTable"));
+ System.out.println("Look at the data in
table0WithTriggers before trigger gets fired");
+ dumpRS(stmt.executeQuery("select * from
table0WithTriggers"));
+ rs = stmt.executeQuery("SELECT * FROM
table0WithTriggers FOR UPDATE");
+ rs.next();
+ System.out.println("column 1 on this row is " +
rs.getInt(1));
System.out.println("now try to update row and make sure
that trigger got fired");
rs.updateLong(1,123);
rs.updateRow();
rs.close();
- System.out.println("Verify that update trigger got
fired by verifying the row count to be 1 in updateTriggerInsertIntoThisTable");
- dumpRS(stmt.executeQuery("select count(*) from
updateTriggerInsertIntoThisTable"));
- System.out.println("Verify that new data in
table0WithTriggers");
- dumpRS(stmt.executeQuery("select * from
table0WithTriggers"));
- //have to close the resultset because by default,
resultsets are held open over commit
- rs.close();
- conn.rollback();
- System.out.println("Verify that after rollback, row
count is back to 0 in updateTriggerInsertIntoThisTable");
- dumpRS(stmt.executeQuery("select count(*) from
updateTriggerInsertIntoThisTable"));
- System.out.println("Verify that after rollback,
table0WithTriggers is back to its original contents");
- dumpRS(stmt.executeQuery("select * from
table0WithTriggers"));
- conn.setAutoCommit(true);
-
- System.out.println("Positive Test17 - After deleteRow,
resultset is positioned before the next row");
- reloadData();
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
- rs.next();
- rs.deleteRow();
- System.out.println("getXXX right after deleteRow will fail because
resultset is not positioned on a row, instead it is right before the next row");
- try {
- System.out.println("column 1 (which is not
nullable) after deleteRow is " + rs.getString(1));
- }
- catch (SQLException e) {
- System.out.println("SQL State : " +
e.getSQLState());
+ System.out.println("Verify that update trigger got
fired by verifying the row count to be 1 in updateTriggerInsertIntoThisTable");
+ dumpRS(stmt.executeQuery("select count(*) from
updateTriggerInsertIntoThisTable"));
+ System.out.println("Verify that new data in
table0WithTriggers");
+ dumpRS(stmt.executeQuery("select * from
table0WithTriggers"));
+ //have to close the resultset because by default,
resultsets are held open over commit
+ rs.close();
+ conn.rollback();
+ System.out.println("Verify that after rollback, row
count is back to 0 in updateTriggerInsertIntoThisTable");
+ dumpRS(stmt.executeQuery("select count(*) from
updateTriggerInsertIntoThisTable"));
+ System.out.println("Verify that after rollback,
table0WithTriggers is back to its original contents");
+ dumpRS(stmt.executeQuery("select * from
table0WithTriggers"));
+ conn.setAutoCommit(true);
+
+ System.out.println("Positive Test17 - After deleteRow,
resultset is positioned before the next row");
+ reloadData();
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
+ rs.next();
+ rs.deleteRow();
+ System.out.println("getXXX right after deleteRow will fail because
resultset is not positioned on a row, instead it is right before the next row");
+ try {
+ System.out.println("column 1 (which is not
nullable) after deleteRow is " + rs.getString(1));
+ }
+ catch (SQLException e) {
+ System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
- }
- rs.close();
-
- System.out.println("Positive Test18 - Test
cancelRowUpdates method as the first updatable ResultSet api on a read-only
resultset");
- stmt = conn.createStatement();
- rs = stmt.executeQuery("SELECT * FROM
AllDataTypesForTestingTable");
- try {
- rs.cancelRowUpdates();
- System.out.println("Test failed - should not
have reached here because cancelRowUpdates is being called on a read-only
resultset");
- } catch (SQLException e) {
+ }
+ rs.close();
+
+ System.out.println("Positive Test18 - Test
cancelRowUpdates method as the first updatable ResultSet api on a read-only
resultset");
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery("SELECT * FROM
AllDataTypesForTestingTable");
+ try {
+ rs.cancelRowUpdates();
+ System.out.println("Test failed - should not
have reached here because cancelRowUpdates is being called on a read-only
resultset");
+ } catch (SQLException e) {
System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
}
- rs.close();
-
- System.out.println("Positive Test19 - Test updateRow
method as the first updatable ResultSet api on a read-only resultset");
- stmt = conn.createStatement();
- rs = stmt.executeQuery("SELECT * FROM
AllDataTypesForTestingTable");
- rs.next();
- try {
- rs.updateRow();
- System.out.println("Test failed - should not
have reached here because updateRow is being called on a read-only resultset");
- return;
- } catch (Throwable e) {
+ rs.close();
+
+ System.out.println("Positive Test19 - Test updateRow
method as the first updatable ResultSet api on a read-only resultset");
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery("SELECT * FROM
AllDataTypesForTestingTable");
+ rs.next();
+ try {
+ rs.updateRow();
+ System.out.println("Test failed - should not
have reached here because updateRow is being called on a read-only resultset");
+ return;
+ } catch (Throwable e) {
System.out.println(" Got expected exception :
" + e.getMessage());
}
- rs.close();
-
- System.out.println("Positive Test20 - Test updateXXX
methods as the first updatable ResultSet api on a read-only resultset");
- conn.setAutoCommit(false);
- stmt = conn.createStatement();
- for (int updateXXXName = 1; updateXXXName <=
allUpdateXXXNames.length; updateXXXName++) {
- System.out.println(" Test " +
allUpdateXXXNames[updateXXXName-1] + " on a readonly resultset");
- for (int indexOrName = 1; indexOrName <= 2;
indexOrName++) {
+ rs.close();
+
+ System.out.println("Positive Test20 - Test updateXXX
methods as the first updatable ResultSet api on a read-only resultset");
+ conn.setAutoCommit(false);
+ stmt = conn.createStatement();
+ for (int updateXXXName = 1; updateXXXName <=
allUpdateXXXNames.length; updateXXXName++) {
+ System.out.println(" Test " +
allUpdateXXXNames[updateXXXName-1] + " on a readonly resultset");
+ for (int indexOrName = 1; indexOrName <= 2;
indexOrName++) {
rs = stmt.executeQuery("SELECT * FROM
AllDataTypesForTestingTable");
rs.next();
rs1 = stmt1.executeQuery("SELECT * FROM
AllDataTypesNewValuesData");
@@ -1280,7 +1377,7 @@
System.out.println(" Using
column position as first parameter to " + allUpdateXXXNames[updateXXXName-1]);
else
System.out.println(" Using
column name as first parameter to " + allUpdateXXXNames[updateXXXName-1]);
- try {
+ try {
if (updateXXXName == 1)
{//update column with updateShort methods
if (indexOrName
== 1) //test by passing column position
rs.updateShort(1, rs1.getShort(updateXXXName));
@@ -1398,21 +1495,21 @@
rs.updateRef(ColumnNames[0], null);
}
System.out.println("Test failed
- should not have reached here because updateXXX is being called on a read-only
resultset");
- return;
- } catch (Throwable e) {
+ return;
+ } catch (Throwable e) {
System.out.println("
Got expected exception : " + e.getMessage());
}
- }
- }
- conn.setAutoCommit(true);
-
- System.out.println("Positive Test21 - Test all
updateXXX(excluding updateObject) methods on all the supported sql datatypes");
- conn.setAutoCommit(false);
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- stmt1 = conn.createStatement();
- for (int sqlType = 1, checkAgainstColumn = 1; sqlType
<= allSQLTypes.length; sqlType++ ) {
- System.out.println("Next datatype to test is "
+ allSQLTypes[sqlType-1]);
- for (int updateXXXName = 1; updateXXXName <=
allUpdateXXXNames.length; updateXXXName++) {
+ }
+ }
+ conn.setAutoCommit(true);
+
+ System.out.println("Positive Test21 - Test all
updateXXX(excluding updateObject) methods on all the supported sql datatypes");
+ conn.setAutoCommit(false);
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ stmt1 = conn.createStatement();
+ for (int sqlType = 1, checkAgainstColumn = 1; sqlType
<= allSQLTypes.length; sqlType++ ) {
+ System.out.println("Next datatype to test is "
+ allSQLTypes[sqlType-1]);
+ for (int updateXXXName = 1; updateXXXName <=
allUpdateXXXNames.length; updateXXXName++) {
checkAgainstColumn = updateXXXName;
System.out.println(" Testing " +
allUpdateXXXNames[updateXXXName-1] + " on SQL type " + allSQLTypes[sqlType-1]);
for (int indexOrName = 1; indexOrName
<= 2; indexOrName++) {
@@ -1543,17 +1640,17 @@
rs.updateRef(ColumnNames[sqlType-1], null);
}
rs.updateRow();
- if
(updateXXXRulesTable[sqlType-1][updateXXXName-1].equals("ERROR")) {
+ if
(updateXXXRulesTableForEmbedded[sqlType-1][updateXXXName-1].equals("ERROR")) {
System.out.println("FAILURE : We shouldn't reach here. The test should have
failed earlier on updateXXX or updateRow call");
return;
}
if
(verifyData(sqlType,checkAgainstColumn, "AllDataTypesNewValuesData") == false)
- {
-
System.out.println("Test failed");
- return;
- }
+ {
+
System.out.println("Test failed");
+ return;
+ }
} catch (Throwable e) {
- if
(updateXXXRulesTable[sqlType-1][updateXXXName-1].equals("ERROR"))
+ if
(updateXXXRulesTableForEmbedded[sqlType-1][updateXXXName-1].equals("ERROR"))
System.out.println(" Got expected exception : " + e.getMessage());
else {
if ((sqlType ==
14 || sqlType == 15 || sqlType == 16) && //we are dealing with
DATE/TIME/TIMESTAMP column types
@@ -1567,19 +1664,19 @@
}
}
rs.close();
- rs1.close();
+ rs1.close();
}
}
- conn.setAutoCommit(true);
-
- System.out.println("Positive Test22 - Test updateObject
method");
- conn.setAutoCommit(false);
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- stmt1 = conn.createStatement();
- String displayString;
- for (int sqlType = 1; sqlType <= allSQLTypes.length;
sqlType++ ) {
- System.out.println("Next datatype to test is "
+ allSQLTypes[sqlType-1]);
- for (int updateXXXName = 1; updateXXXName <=
allUpdateXXXNames.length; updateXXXName++) {
+ conn.setAutoCommit(true);
+
+ System.out.println("Positive Test22 - Test updateObject
method");
+ conn.setAutoCommit(false);
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ stmt1 = conn.createStatement();
+ String displayString;
+ for (int sqlType = 1; sqlType <= allSQLTypes.length;
sqlType++ ) {
+ System.out.println("Next datatype to test is "
+ allSQLTypes[sqlType-1]);
+ for (int updateXXXName = 1; updateXXXName <=
allUpdateXXXNames.length; updateXXXName++) {
for (int indexOrName = 1; indexOrName
<= 2; indexOrName++) {
if (indexOrName == 1) //test by
passing column position
displayString = "
updateObject with column position &";
@@ -1696,17 +1793,17 @@
continue;
rs.updateRow();
- if
(updateXXXRulesTable[sqlType-1][updateXXXName-1].equals("ERROR")) {
+ if
(updateXXXRulesTableForEmbedded[sqlType-1][updateXXXName-1].equals("ERROR")) {
System.out.println("FAILURE : We shouldn't reach here. The test should have
failed earlier on updateXXX or updateRow call");
return;
}
if
(verifyData(sqlType,updateXXXName, "AllDataTypesNewValuesData") == false)
- {
-
System.out.println("Test failed");
- return;
- }
+ {
+
System.out.println("Test failed");
+ return;
+ }
} catch (Throwable e) {
- if
(updateXXXRulesTable[sqlType-1][updateXXXName-1].equals("ERROR"))
+ if
(updateXXXRulesTableForEmbedded[sqlType-1][updateXXXName-1].equals("ERROR"))
System.out.println(" Got expected exception : " + e.getMessage());
else {
if
((sqlType == 14 || sqlType == 15 || sqlType == 16) && //we are dealing with
DATE/TIME/TIMESTAMP column types
@@ -1718,18 +1815,18 @@
}
}
rs.close();
- rs1.close();
+ rs1.close();
}
}
}
- conn.setAutoCommit(true);
-
- System.out.println("Positive Test23 - Test
cancelRowUpdates after updateXXX methods on all the supported sql datatypes");
- conn.setAutoCommit(false);
- reloadAllDataTypesForTestingTableData();
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
- stmt1 = conn.createStatement();
- rs = stmt.executeQuery("SELECT * FROM
AllDataTypesForTestingTable FOR UPDATE");
+ conn.setAutoCommit(true);
+
+ System.out.println("Positive Test23 - Test
cancelRowUpdates after updateXXX methods on all the supported sql datatypes");
+ conn.setAutoCommit(false);
+ reloadAllDataTypesForTestingTableData();
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ stmt1 = conn.createStatement();
+ rs = stmt.executeQuery("SELECT * FROM
AllDataTypesForTestingTable FOR UPDATE");
rs.next();
rs1 = stmt1.executeQuery("SELECT * FROM
AllDataTypesNewValuesData");
rs1.next();
@@ -1889,9 +1986,9 @@
}
rs.close();
- rs1.close();
- conn.setAutoCommit(true);
-
+ rs1.close();
+ conn.setAutoCommit(true);
+
System.out.println("Positive Test24a - after updateXXX,
try cancelRowUpdates and then deleteRow");
reloadData();
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
@@ -1905,13 +2002,13 @@
System.out.println("Since after cancelRowUpdates(),
ResultSet is positioned on the same row, getXXX will pass");
System.out.println("column 1 on this row after
cancelRowUpdates is " + rs.getInt(1));
System.out.println("Since after cancelRowUpdates(),
ResultSet is positioned on the same row, a deleteRow at this point will pass");
- try {
- rs.deleteRow();
- System.out.println("PASS : deleteRow passed as
expected");
- }
- catch (SQLException e) {
- dumpSQLExceptions(e);
- }
+ try {
+ rs.deleteRow();
+ System.out.println("PASS : deleteRow passed as
expected");
+ }
+ catch (SQLException e) {
+ dumpSQLExceptions(e);
+ }
System.out.println("calling updateRow after deleteRow
w/o first positioning the ResultSet on the next row will fail");
try {
rs.updateRow();
@@ -1924,39 +2021,39 @@
System.out.println("Position the ResultSet with
next()");
rs.next();
System.out.println("Should be able to updateRow() on
the current row now");
- rs.updateString(2,"234");
- rs.updateRow();
+ rs.updateString(2,"234");
+ rs.updateRow();
//have to close the resultset because by default,
resultsets are held open over commit
rs.close();
-
+
System.out.println("Positive Test25 - issue
cancelRowUpdates without any updateXXX");
reloadData();
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
rs.next();
- rs.cancelRowUpdates();
- //have to close the resultset because by default,
resultsets are held open over commit
+ rs.cancelRowUpdates();
+ //have to close the resultset because by default,
resultsets are held open over commit
rs.close();
-
+
System.out.println("Positive Test26 - issue updateRow
without any updateXXX will not move the resultset position");
reloadData();
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
rs.next();
- rs.updateRow(); //this will not move the resultset to
right before the next row because there were no updateXXX issued before
updateRow
- rs.updateRow();
- //have to close the resultset because by default,
resultsets are held open over commit
+ rs.updateRow(); //this will not move the resultset to
right before the next row because there were no updateXXX issued before
updateRow
+ rs.updateRow();
+ //have to close the resultset because by default,
resultsets are held open over commit
rs.close();
-
+
System.out.println("Positive Test27 - issue updateXXX
and then deleteRow");
reloadData();
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
rs.next();
- rs.updateInt(1,1234);
- rs.updateString(2,"aaaaa");
- rs.deleteRow();
- try {
+ rs.updateInt(1,1234);
+ rs.updateString(2,"aaaaa");
+ rs.deleteRow();
+ try {
rs.updateRow();
System.out.println("FAIL!!! deleteRow should
have moved the ResultSet to right before the next row");
}
@@ -1964,7 +2061,7 @@
System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
}
- try {
+ try {
rs.updateInt(1,2345);
System.out.println("FAIL!!! deleteRow should
have moved the ResultSet to right before the next row");
}
@@ -1972,7 +2069,7 @@
System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
}
- try {
+ try {
rs.getInt(1);
System.out.println("FAIL!!! deleteRow should
have moved the ResultSet to right before the next row");
}
@@ -1980,48 +2077,48 @@
System.out.println("SQL State : " +
e.getSQLState());
System.out.println("Got expected exception " +
e.getMessage());
}
- //have to close the resultset because by default,
resultsets are held open over commit
+ //have to close the resultset because by default,
resultsets are held open over commit
rs.close();
-
+
System.out.println("Positive Test28 - issue updateXXXs
and then move off the row, the changes should be ignored");
reloadData();
dumpRS(stmt.executeQuery("select * from t1"));
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
rs.next();
- System.out.println(" column 1 on this row before
updateInt is " + rs.getInt(1));
- System.out.println(" Issue updateInt to change the
column's value to 2345");
- rs.updateInt(1,2345);
- System.out.println(" Move to next row w/o issuing
updateRow");
- rs.next(); //the changes made on the earlier row should
have be ignored because we moved off that row without issuing updateRow
- //have to close the resultset because by default,
resultsets are held open over commit
+ System.out.println(" column 1 on this row before
updateInt is " + rs.getInt(1));
+ System.out.println(" Issue updateInt to change the
column's value to 2345");
+ rs.updateInt(1,2345);
+ System.out.println(" Move to next row w/o issuing
updateRow");
+ rs.next(); //the changes made on the earlier row should
have be ignored because we moved off that row without issuing updateRow
+ //have to close the resultset because by default,
resultsets are held open over commit
rs.close();
- System.out.println(" Make sure that changes didn't
make it to the database");
- dumpRS(stmt.executeQuery("select * from t1"));
-
+ System.out.println(" Make sure that changes didn't
make it to the database");
+ dumpRS(stmt.executeQuery("select * from t1"));
+
System.out.println("Positive Test29 - issue multiple
updateXXXs and then a updateRow");
reloadData();
dumpRS(stmt.executeQuery("select * from t1"));
stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
rs.next();
- System.out.println(" column 1 on this row before
updateInt is " + rs.getInt(1));
- System.out.println(" Issue updateInt to change the
column's value to 2345");
- rs.updateInt(1,2345);
- System.out.println(" Issue another updateInt on the
same row and column to change the column's value to 9999");
- rs.updateInt(1,9999);
- System.out.println(" Issue updateString to change the
column's value to 'xxxxxxx'");
- rs.updateString(2,"xxxxxxx");
- System.out.println(" Now issue updateRow");
- rs.updateRow();
- //have to close the resultset because by default,
resultsets are held open over commit
+ System.out.println(" column 1 on this row before
updateInt is " + rs.getInt(1));
+ System.out.println(" Issue updateInt to change the
column's value to 2345");
+ rs.updateInt(1,2345);
+ System.out.println(" Issue another updateInt on the
same row and column to change the column's value to 9999");
+ rs.updateInt(1,9999);
+ System.out.println(" Issue updateString to change the
column's value to 'xxxxxxx'");
+ rs.updateString(2,"xxxxxxx");
+ System.out.println(" Now issue updateRow");
+ rs.updateRow();
+ //have to close the resultset because by default,
resultsets are held open over commit
rs.close();
- System.out.println(" Make sure that changes made it to
the database correctly");
- dumpRS(stmt.executeQuery("select * from t1"));
-
+ System.out.println(" Make sure that changes made it to
the database correctly");
+ dumpRS(stmt.executeQuery("select * from t1"));
+
System.out.println("Positive Test30 - call updateXXX
methods on only columns that correspond to a column in the table");
- dumpRS(stmt.executeQuery("select * from t1"));
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ dumpRS(stmt.executeQuery("select * from t1"));
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT 1, 2, c1, c2 FROM t1 FOR
UPDATE");
rs.next();
rs.updateInt(3,22);
@@ -2061,14 +2158,13 @@
dumpRS(stmt.executeQuery("select * from \" t 11 \""));
System.out.println("Positive Test32 - call updateXXX
methods on column that is not in for update columns list");
- dumpRS(stmt.executeQuery("select * from t1"));
- stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ dumpRS(stmt.executeQuery("select * from t1"));
+ stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT c1, c2 FROM t1 FOR
UPDATE of c1");
rs.next();
- rs.updateInt(2,22);
try {
- rs.updateRow();
- System.out.println("FAIL!!! updateRow should
have failed because c12 is not the FOR UPDATE columns list.");
+ rs.updateInt(2,22);
+ System.out.println("FAIL!!! updateInt should
have failed because c12 is not the FOR UPDATE columns list.");
}
catch (SQLException e) {
System.out.println("SQL State : " +
e.getSQLState());
@@ -2267,15 +2363,15 @@
stmt.executeUpdate("insert into t1 values (1,'aa'), (2,'bb'),
(3,'cc')");
stmt.executeUpdate("delete from t3");
stmt.executeUpdate("insert into t3 values (1,1), (2,2)");
- stmt.executeUpdate("delete from table0WithTriggers");
- stmt.executeUpdate("insert into table0WithTriggers values (1,
1), (2, 2), (3, 3), (4, 4)");
- stmt.executeUpdate("delete from table1WithTriggers");
- stmt.executeUpdate("insert into table1WithTriggers values (1,
1), (2, 2), (3, 3), (4, 4)");
- stmt.executeUpdate("delete from table2WithTriggers");
- stmt.executeUpdate("insert into table2WithTriggers values (1,
1), (2, 2), (3, 3), (4, 4)");
- stmt.executeUpdate("delete from
deleteTriggerInsertIntoThisTable");
- stmt.executeUpdate("delete from
updateTriggerInsertIntoThisTable");
- }
+ stmt.executeUpdate("delete from table0WithTriggers");
+ stmt.executeUpdate("insert into table0WithTriggers values (1,
1), (2, 2), (3, 3), (4, 4)");
+ stmt.executeUpdate("delete from table1WithTriggers");
+ stmt.executeUpdate("insert into table1WithTriggers values (1,
1), (2, 2), (3, 3), (4, 4)");
+ stmt.executeUpdate("delete from table2WithTriggers");
+ stmt.executeUpdate("insert into table2WithTriggers values (1,
1), (2, 2), (3, 3), (4, 4)");
+ stmt.executeUpdate("delete from
deleteTriggerInsertIntoThisTable");
+ stmt.executeUpdate("delete from
updateTriggerInsertIntoThisTable");
+ }
static void setup(boolean first) throws SQLException {
Statement stmt = conn.createStatement();
@@ -2291,12 +2387,12 @@
stmt.executeUpdate("create trigger tr1 after delete on
table0WithTriggers for each statement mode db2sql insert into
deleteTriggerInsertIntoThisTable values (1)");
stmt.executeUpdate("create trigger tr2 after update on
table0WithTriggers for each statement mode db2sql insert into
updateTriggerInsertIntoThisTable values (1)");
stmt.executeUpdate("create table table1WithTriggers (c1 int, c2
bigint)");
- stmt.executeUpdate("create trigger tr3 after delete on
table1WithTriggers for each statement mode db2sql delete from
table1WithTriggers");
- stmt.executeUpdate("create table table2WithTriggers (c1 int, c2
bigint)");
- stmt.executeUpdate("create trigger tr4 after update on
table2WithTriggers for each statement mode db2sql update table2WithTriggers set
c1=1");
- stmt.executeUpdate("create table selfReferencingT1 (c1 char(2)
not null, c2 char(2), constraint selfReferencingT1 primary key(c1), constraint
manages1 foreign key(c2) references selfReferencingT1(c1) on delete cascade)");
- stmt.executeUpdate("create table selfReferencingT2 (c1 char(2)
not null, c2 char(2), constraint selfReferencingT2 primary key(c1), constraint
manages2 foreign key(c2) references selfReferencingT2(c1) on update restrict)");
-
+ stmt.executeUpdate("create trigger tr3 after delete on
table1WithTriggers for each statement mode db2sql delete from
table1WithTriggers");
+ stmt.executeUpdate("create table table2WithTriggers (c1 int, c2
bigint)");
+ stmt.executeUpdate("create trigger tr4 after update on
table2WithTriggers for each statement mode db2sql update table2WithTriggers set
c1=1");
+ stmt.executeUpdate("create table selfReferencingT1 (c1 char(2)
not null, c2 char(2), constraint selfReferencingT1 primary key(c1), constraint
manages1 foreign key(c2) references selfReferencingT1(c1) on delete cascade)");
+ stmt.executeUpdate("create table selfReferencingT2 (c1 char(2)
not null, c2 char(2), constraint selfReferencingT2 primary key(c1), constraint
manages2 foreign key(c2) references selfReferencingT2(c1) on update restrict)");
+
stmt.executeUpdate("insert into t1 values (1,'aa')");
stmt.executeUpdate("insert into t1 values (2,'bb')");
stmt.executeUpdate("insert into t1 values (3,'cc')");
@@ -2349,11 +2445,11 @@
stmt.executeUpdate("drop table
deleteTriggerInsertIntoThisTable");
stmt.executeUpdate("drop table
updateTriggerInsertIntoThisTable");
stmt.executeUpdate("drop table table0WithTriggers");
- stmt.executeUpdate("drop table table1WithTriggers");
- stmt.executeUpdate("drop table table2WithTriggers");
- stmt.executeUpdate("drop table selfReferencingT1");
- stmt.executeUpdate("drop table selfReferencingT2");
- conn.commit();
+ stmt.executeUpdate("drop table table1WithTriggers");
+ stmt.executeUpdate("drop table table2WithTriggers");
+ stmt.executeUpdate("drop table selfReferencingT1");
+ stmt.executeUpdate("drop table selfReferencingT2");
+ conn.commit();
stmt.close();
}
Index:
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/updatableResultSet.out
===================================================================
---
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/updatableResultSet.out
(revision 160207)
+++
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/updatableResultSet.out
(working copy)
@@ -47,13 +47,88 @@
Got expected exception This method cannot be invoked while the cursor is on
the insert row or if the concurrency of this ResultSet object is
CONCUR_READ_ONLY.
Now attempting to send a updateRow on a sql with no FOR UPDATE clause.
SQL State : null
-Got expected exception Invalid operation: result set closed
+Got expected exception This method cannot be invoked while the cursor is on
the insert row or if the concurrency of this ResultSet object is
CONCUR_READ_ONLY.
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
Now attempting to send a delete on a sql with FOR READ ONLY clause.
SQL State : null
Got expected exception This method cannot be invoked while the cursor is on
the insert row or if the concurrency of this ResultSet object is
CONCUR_READ_ONLY.
Now attempting to send a updateRow on a sql with FOR READ ONLY clause.
SQL State : null
Got expected exception This method cannot be invoked while the cursor is on
the insert row or if the concurrency of this ResultSet object is
CONCUR_READ_ONLY.
+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.
+SQL State : XCL08
+Got expected exception Cursor 'SQL_CURSH200C7' is not on a row.
+Now attempt a updateRow without first doing next on the resultset.
+In embedded mode, updateRow will check if it is on a row or not even though no
changes have been made to the row using updateXXX
+In Network Server mode, if no updateXXX were issued before updateRow, then
updateRow is a no-op and doesn't check if it is on a row or not
+PASS!!! In Network Server mode, this updateRow is a no-op because no updateXXX
were issued before the updateRow
+ResultSet is positioned after the last row. attempt to deleteRow at this point
should fail!
+SQL State : null
+Got expected exception Invalid operation: result set closed
+ResultSet is positioned after the last row. attempt to updateRow at this point
should fail!
+SQL State : null
+Got expected exception Invalid operation: result set closed
+Negative Test8 - attempt deleteRow & updateRow on updatable resultset after
closing the resultset
+Make sure that we got CONCUR_UPDATABLE? true
+SQL State : null
+Got expected exception Invalid operation: result set closed
+SQL State : null
+Got expected exception Invalid operation: result set closed
+Negative Test9 - try updatable resultset on system table
+SQL State : 42Y90
+Got expected exception FOR UPDATE is not permitted on this type of statement.
+Negative Test10 - try updatable resultset on a view
+SQL State : 42Y90
+Got expected exception FOR UPDATE is not permitted on this type of statement.
+Negative Test11 - attempt to open updatable resultset when there is join in
the select query should fail
+SQL State : 42Y90
+Got expected exception FOR UPDATE is not permitted on this type of statement.
+Negative Test12 - With autocommit on, attempt to drop a table when there is an
open updatable resultset on it
+Opened an updatable resultset. Now trying to drop that table through another
Statement
+SQL State : X0X95
+Got expected exception Operation 'DROP TABLE' cannot be performed on object
'T1' because there is an open ResultSet dependent on that object.
+Since autocommit is on, the drop table exception resulted in a runtime
rollback causing updatable resultset object to close
+SQL State : 42X01
+Got expected exception Syntax error: Encountered "(" at line 1, column 19.
+SQL State : 24000
+Got expected exception Invalid cursor state - no current row.
+Negative Test13 - foreign key constraint failure will cause deleteRow to fail
+SQL State : 23503
+Got expected exception DELETE on table 'TABLEWITHPRIMARYKEY' caused a
violation of foreign key constraint 'FK' for key (1,1). The statement has been
rolled back.
+Since autocommit is on, the constraint exception resulted in a runtime
rollback causing updatable resultset object to close
+Jira entry Derby-160 : for Network Server because next should have failed
+FAIL!!! next should have failed because foreign key constraint failure
resulted in a runtime rollback
+Negative Test14 - foreign key constraint failure will cause updateRow to fail
+SQL State : 42X01
+Got expected exception Syntax error: Encountered "(" at line 1, column 36.
+Since autocommit is on, the constraint exception resulted in a runtime
rollback causing updatable resultset object to close
+Jira entry Derby-160 : for Network Server because next should have failed
+FAIL!!! next should have failed because foreign key constraint failure
resulted in a runtime rollback
+Negative Test15 - Can't call updateXXX methods on columns that do not
correspond to a column in the table
+SQL State : null
+Got expected exception Column not updatable
+Negative Test16 - Call updateXXX method on out of the range column
+There are only 2 columns in the select list and we are trying to send
updateXXX on column position 3
+SQL State : null
+Got expected exception Invalid argument: parameter index 3 is out of range.
+Positive Test1a - request updatable resultset for forward only type resultset
+requested TYPE_FORWARD_ONLY, CONCUR_UPDATABLE
+got TYPE_FORWARD_ONLY? true
+got CONCUR_UPDATABLE? true
+JDBC 2.0 updatable resultset apis on this ResultSet object will pass because
this is an updatable resultset
+column 1 on this row before deleteRow is 1
+column 2 on this row before deleteRow is aa
+Since after deleteRow(), in embedded mode, ResultSet is positioned before the
next row, getXXX will fail
+In Network Server mode, the ResultSet stays on the deleted row after deleteRow
and hence no error for getXXX
+column 1 on this deleted row is 0
+calling deleteRow again w/o first positioning the ResultSet on the next row
will fail
+SQL State : 24000
+Got expected exception Invalid cursor state - no current row.
+Position the ResultSet with next()
+Should be able to deletRow() on the current row now
Finished testing updateable resultsets
Index:
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/resultset.out
===================================================================
---
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/resultset.out
(revision 160207)
+++
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/resultset.out
(working copy)
@@ -10,7 +10,7 @@
getColumnLabel(1): I
getColumnName(1): I
getTableName(1): T
-getSchemaName(1):
+getSchemaName(1): APP
getCatalogName(1):
getColumnType(1): 4
getPrecision(1): 10
@@ -28,7 +28,7 @@
getColumnLabel(2): S
getColumnName(2): S
getTableName(2): T
-getSchemaName(2):
+getSchemaName(2): APP
getCatalogName(2):
getColumnType(2): 5
getPrecision(2): 5
@@ -46,7 +46,7 @@
getColumnLabel(3): R
getColumnName(3): R
getTableName(3): T
-getSchemaName(3):
+getSchemaName(3): APP
getCatalogName(3):
getColumnType(3): 7
getPrecision(3): 7
@@ -64,7 +64,7 @@
getColumnLabel(4): D
getColumnName(4): D
getTableName(4): T
-getSchemaName(4):
+getSchemaName(4): APP
getCatalogName(4):
getColumnType(4): 8
getPrecision(4): 15
@@ -82,7 +82,7 @@
getColumnLabel(5): DT
getColumnName(5): DT
getTableName(5): T
-getSchemaName(5):
+getSchemaName(5): APP
getCatalogName(5):
getColumnType(5): 91
getPrecision(5): 10
@@ -100,7 +100,7 @@
getColumnLabel(6): T
getColumnName(6): T
getTableName(6): T
-getSchemaName(6):
+getSchemaName(6): APP
getCatalogName(6):
getColumnType(6): 92
getPrecision(6): 8
@@ -118,7 +118,7 @@
getColumnLabel(7): TS
getColumnName(7): TS
getTableName(7): T
-getSchemaName(7):
+getSchemaName(7): APP
getCatalogName(7):
getColumnType(7): 93
getPrecision(7): 26
@@ -136,7 +136,7 @@
getColumnLabel(8): C
getColumnName(8): C
getTableName(8): T
-getSchemaName(8):
+getSchemaName(8): APP
getCatalogName(8):
getColumnType(8): 1
getPrecision(8): 10
@@ -154,7 +154,7 @@
getColumnLabel(9): V
getColumnName(9): V
getTableName(9): T
-getSchemaName(9):
+getSchemaName(9): APP
getCatalogName(9):
getColumnType(9): 12
getPrecision(9): 40
@@ -172,7 +172,7 @@
getColumnLabel(10): DC
getColumnName(10): DC
getTableName(10): T
-getSchemaName(10):
+getSchemaName(10): APP
getCatalogName(10):
getColumnType(10): 3
getPrecision(10): 10
@@ -190,7 +190,7 @@
getColumnLabel(11): BI
getColumnName(11): BI
getTableName(11): T
-getSchemaName(11):
+getSchemaName(11): APP
getCatalogName(11):
getColumnType(11): -5
getPrecision(11): 19
@@ -208,7 +208,7 @@
getColumnLabel(12): CBD
getColumnName(12): CBD
getTableName(12): T
-getSchemaName(12):
+getSchemaName(12): APP
getCatalogName(12):
getColumnType(12): -2
getPrecision(12): 10
@@ -226,7 +226,7 @@
getColumnLabel(13): VBD
getColumnName(13): VBD
getTableName(13): T
-getSchemaName(13):
+getSchemaName(13): APP
getCatalogName(13):
getColumnType(13): -3
getPrecision(13): 10
@@ -244,7 +244,7 @@
getColumnLabel(14): LVBD
getColumnName(14): LVBD
getTableName(14): T
-getSchemaName(14):
+getSchemaName(14): APP
getCatalogName(14):
getColumnType(14): -4
getPrecision(14): 32700
@@ -262,7 +262,7 @@
getColumnLabel(15): CL
getColumnName(15): CL
getTableName(15): T
-getSchemaName(15):
+getSchemaName(15): APP
getCatalogName(15):
getColumnType(15): 2005
getPrecision(15): 2147483647
@@ -280,7 +280,7 @@
getColumnLabel(16): BL
getColumnName(16): BL
getTableName(16): T
-getSchemaName(16):
+getSchemaName(16): APP
getCatalogName(16):
getColumnType(16): 2004
getPrecision(16): 1073741824
Index:
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out
===================================================================
---
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out
(revision 160207)
+++
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out
(working copy)
@@ -47,13 +47,88 @@
Got expected exception This method cannot be invoked while the cursor is on
the insert row or if the concurrency of this ResultSet object is
CONCUR_READ_ONLY.
Now attempting to send a updateRow on a sql with no FOR UPDATE clause.
SQL State : null
-Got expected exception Invalid operation: result set closed
+Got expected exception This method cannot be invoked while the cursor is on
the insert row or if the concurrency of this ResultSet object is
CONCUR_READ_ONLY.
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
Now attempting to send a delete on a sql with FOR READ ONLY clause.
SQL State : null
Got expected exception This method cannot be invoked while the cursor is on
the insert row or if the concurrency of this ResultSet object is
CONCUR_READ_ONLY.
Now attempting to send a updateRow on a sql with FOR READ ONLY clause.
SQL State : null
Got expected exception This method cannot be invoked while the cursor is on
the insert row or if the concurrency of this ResultSet object is
CONCUR_READ_ONLY.
+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.
+SQL State : XCL08
+Got expected exception Cursor 'SQL_CURLH000C8' is not on a row.
+Now attempt a updateRow without first doing next on the resultset.
+In embedded mode, updateRow will check if it is on a row or not even though no
changes have been made to the row using updateXXX
+In Network Server mode, if no updateXXX were issued before updateRow, then
updateRow is a no-op and doesn't check if it is on a row or not
+PASS!!! In Network Server mode, this updateRow is a no-op because no updateXXX
were issued before the updateRow
+ResultSet is positioned after the last row. attempt to deleteRow at this point
should fail!
+SQL State : null
+Got expected exception Invalid operation: result set closed
+ResultSet is positioned after the last row. attempt to updateRow at this point
should fail!
+SQL State : null
+Got expected exception Invalid operation: result set closed
+Negative Test8 - attempt deleteRow & updateRow on updatable resultset after
closing the resultset
+Make sure that we got CONCUR_UPDATABLE? true
+SQL State : null
+Got expected exception Invalid operation: result set closed
+SQL State : null
+Got expected exception Invalid operation: result set closed
+Negative Test9 - try updatable resultset on system table
+SQL State : 42Y90
+Got expected exception FOR UPDATE is not permitted on this type of statement.
+Negative Test10 - try updatable resultset on a view
+SQL State : 42Y90
+Got expected exception FOR UPDATE is not permitted on this type of statement.
+Negative Test11 - attempt to open updatable resultset when there is join in
the select query should fail
+SQL State : 42Y90
+Got expected exception FOR UPDATE is not permitted on this type of statement.
+Negative Test12 - With autocommit on, attempt to drop a table when there is an
open updatable resultset on it
+Opened an updatable resultset. Now trying to drop that table through another
Statement
+SQL State : X0X95
+Got expected exception Operation 'DROP TABLE' cannot be performed on object
'T1' because there is an open ResultSet dependent on that object.
+Since autocommit is on, the drop table exception resulted in a runtime
rollback causing updatable resultset object to close
+SQL State : 24000
+Got expected exception Invalid cursor state - no current row.
+SQL State : 24000
+Got expected exception Invalid cursor state - no current row.
+Negative Test13 - foreign key constraint failure will cause deleteRow to fail
+SQL State : 23503
+Got expected exception DELETE on table 'TABLEWITHPRIMARYKEY' caused a
violation of foreign key constraint 'FK' for key (1,1). The statement has been
rolled back.
+Since autocommit is on, the constraint exception resulted in a runtime
rollback causing updatable resultset object to close
+Jira entry Derby-160 : for Network Server because next should have failed
+FAIL!!! next should have failed because foreign key constraint failure
resulted in a runtime rollback
+Negative Test14 - foreign key constraint failure will cause updateRow to fail
+SQL State : 23503
+Got expected exception UPDATE on table 'TABLEWITHPRIMARYKEY' caused a
violation of foreign key constraint 'FK' for key (1,1). The statement has been
rolled back.
+Since autocommit is on, the constraint exception resulted in a runtime
rollback causing updatable resultset object to close
+Jira entry Derby-160 : for Network Server because next should have failed
+FAIL!!! next should have failed because foreign key constraint failure
resulted in a runtime rollback
+Negative Test15 - Can't call updateXXX methods on columns that do not
correspond to a column in the table
+SQL State : null
+Got expected exception Column not updatable
+Negative Test16 - Call updateXXX method on out of the range column
+There are only 2 columns in the select list and we are trying to send
updateXXX on column position 3
+SQL State : null
+Got expected exception Invalid argument: parameter index 3 is out of range.
+Positive Test1a - request updatable resultset for forward only type resultset
+requested TYPE_FORWARD_ONLY, CONCUR_UPDATABLE
+got TYPE_FORWARD_ONLY? true
+got CONCUR_UPDATABLE? true
+JDBC 2.0 updatable resultset apis on this ResultSet object will pass because
this is an updatable resultset
+column 1 on this row before deleteRow is 1
+column 2 on this row before deleteRow is aa
+Since after deleteRow(), in embedded mode, ResultSet is positioned before the
next row, getXXX will fail
+In Network Server mode, the ResultSet stays on the deleted row after deleteRow
and hence no error for getXXX
+column 1 on this deleted row is 0
+calling deleteRow again w/o first positioning the ResultSet on the next row
will fail
+SQL State : 24000
+Got expected exception Invalid cursor state - no current row.
+Position the ResultSet with next()
+Should be able to deletRow() on the current row now
Finished testing updateable resultsets
Index:
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/resultset.out
===================================================================
---
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/resultset.out
(revision 160207)
+++
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/resultset.out
(working copy)
@@ -10,7 +10,7 @@
getColumnLabel(1): I
getColumnName(1): I
getTableName(1): T
-getSchemaName(1):
+getSchemaName(1): APP
getCatalogName(1):
getColumnType(1): 4
getPrecision(1): 10
@@ -28,7 +28,7 @@
getColumnLabel(2): S
getColumnName(2): S
getTableName(2): T
-getSchemaName(2):
+getSchemaName(2): APP
getCatalogName(2):
getColumnType(2): 5
getPrecision(2): 5
@@ -46,7 +46,7 @@
getColumnLabel(3): R
getColumnName(3): R
getTableName(3): T
-getSchemaName(3):
+getSchemaName(3): APP
getCatalogName(3):
getColumnType(3): 7
getPrecision(3): 7
@@ -64,7 +64,7 @@
getColumnLabel(4): D
getColumnName(4): D
getTableName(4): T
-getSchemaName(4):
+getSchemaName(4): APP
getCatalogName(4):
getColumnType(4): 8
getPrecision(4): 15
@@ -82,7 +82,7 @@
getColumnLabel(5): DT
getColumnName(5): DT
getTableName(5): T
-getSchemaName(5):
+getSchemaName(5): APP
getCatalogName(5):
getColumnType(5): 91
getPrecision(5): 10
@@ -100,7 +100,7 @@
getColumnLabel(6): T
getColumnName(6): T
getTableName(6): T
-getSchemaName(6):
+getSchemaName(6): APP
getCatalogName(6):
getColumnType(6): 92
getPrecision(6): 8
@@ -118,7 +118,7 @@
getColumnLabel(7): TS
getColumnName(7): TS
getTableName(7): T
-getSchemaName(7):
+getSchemaName(7): APP
getCatalogName(7):
getColumnType(7): 93
getPrecision(7): 26
@@ -136,7 +136,7 @@
getColumnLabel(8): C
getColumnName(8): C
getTableName(8): T
-getSchemaName(8):
+getSchemaName(8): APP
getCatalogName(8):
getColumnType(8): 1
getPrecision(8): 10
@@ -154,7 +154,7 @@
getColumnLabel(9): V
getColumnName(9): V
getTableName(9): T
-getSchemaName(9):
+getSchemaName(9): APP
getCatalogName(9):
getColumnType(9): 12
getPrecision(9): 40
@@ -172,7 +172,7 @@
getColumnLabel(10): DC
getColumnName(10): DC
getTableName(10): T
-getSchemaName(10):
+getSchemaName(10): APP
getCatalogName(10):
getColumnType(10): 3
getPrecision(10): 10
@@ -190,7 +190,7 @@
getColumnLabel(11): BI
getColumnName(11): BI
getTableName(11): T
-getSchemaName(11):
+getSchemaName(11): APP
getCatalogName(11):
getColumnType(11): -5
getPrecision(11): 19
@@ -208,7 +208,7 @@
getColumnLabel(12): CBD
getColumnName(12): CBD
getTableName(12): T
-getSchemaName(12):
+getSchemaName(12): APP
getCatalogName(12):
getColumnType(12): -2
getPrecision(12): 10
@@ -226,7 +226,7 @@
getColumnLabel(13): VBD
getColumnName(13): VBD
getTableName(13): T
-getSchemaName(13):
+getSchemaName(13): APP
getCatalogName(13):
getColumnType(13): -3
getPrecision(13): 10
@@ -244,7 +244,7 @@
getColumnLabel(14): LVBD
getColumnName(14): LVBD
getTableName(14): T
-getSchemaName(14):
+getSchemaName(14): APP
getCatalogName(14):
getColumnType(14): -4
getPrecision(14): 32700
@@ -262,7 +262,7 @@
getColumnLabel(15): CL
getColumnName(15): CL
getTableName(15): T
-getSchemaName(15):
+getSchemaName(15): APP
getCatalogName(15):
getColumnType(15): 2005
getPrecision(15): 2147483647
@@ -280,7 +280,7 @@
getColumnLabel(16): BL
getColumnName(16): BL
getTableName(16): T
-getSchemaName(16):
+getSchemaName(16): APP
getCatalogName(16):
getColumnType(16): 2004
getPrecision(16): 1073741824
Index:
java/testing/org/apache/derbyTesting/functionTests/master/updatableResultSet.out
===================================================================
---
java/testing/org/apache/derbyTesting/functionTests/master/updatableResultSet.out
(revision 160207)
+++
java/testing/org/apache/derbyTesting/functionTests/master/updatableResultSet.out
(working copy)
@@ -51,6 +51,8 @@
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
Expected warnings on resultset = java.sql.SQLWarning: 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 : XJ083
@@ -64,6 +66,8 @@
SQL State : 24000
Got expected exception Invalid cursor state - no current row.
Now attempt a updateRow without first doing next on the resultset.
+In embedded mode, updateRow will check if it is on a row or not even though no
changes have been made to the row using updateXXX
+In Network Server mode, if no updateXXX were issued before updateRow, then
updateRow is a no-op and doesn't check if it is on a row or not
SQL State : 24000
Got expected exception Invalid cursor state - no current row.
ResultSet is positioned after the last row. attempt to deleteRow at this point
should fail!
@@ -122,7 +126,8 @@
JDBC 2.0 updatable resultset apis on this ResultSet object will pass because
this is an updatable resultset
column 1 on this row before deleteRow is 1
column 2 on this row before deleteRow is aa
-Since after deleteRow(), ResultSet is positioned before the next row, getXXX
will fail
+Since after deleteRow(), in embedded mode, ResultSet is positioned before the
next row, getXXX will fail
+In Network Server mode, the ResultSet stays on the deleted row after deleteRow
and hence no error for getXXX
SQL State : 24000
Got expected exception Invalid cursor state - no current row.
calling deleteRow again w/o first positioning the ResultSet on the next row
will fail
@@ -135,7 +140,8 @@
column 1 on this row after updateInt is 234
column 2 on this row before updateString is aa
now updateRow on the row
-Since after updateRow(), ResultSet is positioned before the next row, getXXX
will fail
+Since after updateRow(), in embedded mode, ResultSet is positioned before the
next row, getXXX will fail
+In Network Server mode, the ResultSet stays on the updated row after updateRow
and hence no error for getXXX
SQL State : 24000
Got expected exception Invalid cursor state - no current row.
calling updateRow again w/o first positioning the ResultSet on the next row
will fail
@@ -269,17 +275,37 @@
Positive Test9c - try to updateXXX on a readonly column. Should get error
SQL State : 42X31
Got expected exception Column 'C2' is not in FOR UPDATE list of cursor
'SQLCUR15'.
+attempt to get an updatable resultset using correlation name for an readonly
column. It should work
+The sql is SELECT c1, c2 as col2 FROM t1 abcde FOR UPDATE of c1
Table t1 after updateRow has following rows
C1,C2
-- --
+ {11,aa }
+ {2,bb }
+ {3,cc }
+Positive Test9c - try to updateXXX on a readonly column. Should get error
+SQL State : 42X31
+Got expected exception Column 'C2' is not in FOR UPDATE list of cursor
'SQLCUR17'.
+Table t1 has following rows
+ C1,C2
+ -- --
{1,aa }
{2,bb }
{3,cc }
+Positive Test9d - try to updateXXX on a readonly column with correlation name.
Should get error
+SQL State : 42X31
+Got expected exception Column 'COL2' is not in FOR UPDATE list of cursor
'SQLCUR18'.
+Table t1 has following rows
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
Positive Test10 - 2 updatable resultsets going against the same table, will
they conflict?
delete using first resultset
attempt to send deleteRow on the same row through a different resultset should
throw an exception
SQL State : XCL08
-Got expected exception Cursor 'SQLCUR17' is not on a row.
+Got expected exception Cursor 'SQLCUR20' is not on a row.
Move to next row in the 2nd resultset and then delete using the second
resultset
Positive Test11 - setting the fetch size to > 1 will be ignored by updatable
resultset. Same as updatable cursors
Notice the Fetch Size in run time statistics output.
@@ -563,7 +589,9 @@
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 : 'updateClob' not allowed because the ResultSet is
not an updatable ResultSet.
Using column name as first parameter to updateClob
+ Got expected exception : 'updateClob' not allowed because the ResultSet is
not an updatable ResultSet.
Test updateDate on a readonly resultset
Using column position as first parameter to updateDate
Got expected exception : 'updateDate' not allowed because the ResultSet is
not an updatable ResultSet.
@@ -581,7 +609,9 @@
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 : 'updateBlob' not allowed because the ResultSet is
not an updatable ResultSet.
Using column name as first parameter to updateBlob
+ Got expected exception : 'updateBlob' not allowed because the ResultSet is
not an updatable ResultSet.
Test updateBoolean on a readonly resultset
Using column position as first parameter to updateBoolean
Got expected exception : 'updateBoolean' not allowed because the ResultSet
is not an updatable ResultSet.
@@ -594,10 +624,14 @@
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 : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Test updateRef on a readonly resultset
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Positive Test21 - Test all updateXXX(excluding updateObject) methods on all
the supported sql datatypes
Next datatype to test is SMALLINT
Testing updateShort on SQL type SMALLINT
@@ -646,7 +680,9 @@
Got expected exception : An attempt was made to get a data value of type
'SMALLINT' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type SMALLINT
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'SMALLINT' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'SMALLINT' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type SMALLINT
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'SMALLINT'.
@@ -664,7 +700,9 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'SMALLINT'.
Testing updateBlob on SQL type SMALLINT
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'SMALLINT' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'SMALLINT' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type SMALLINT
Using column position as first parameter to updateBoolean
Using column name as first parameter to updateBoolean
@@ -673,10 +711,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type SMALLINT
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type SMALLINT
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is INTEGER
Testing updateShort on SQL type INTEGER
Using column position as first parameter to updateShort
@@ -724,7 +766,9 @@
Got expected exception : An attempt was made to get a data value of type
'INTEGER' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type INTEGER
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'INTEGER' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'INTEGER' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type INTEGER
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'INTEGER'.
@@ -742,7 +786,9 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'INTEGER'.
Testing updateBlob on SQL type INTEGER
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'INTEGER' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'INTEGER' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type INTEGER
Using column position as first parameter to updateBoolean
Using column name as first parameter to updateBoolean
@@ -751,10 +797,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type INTEGER
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type INTEGER
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is BIGINT
Testing updateShort on SQL type BIGINT
Using column position as first parameter to updateShort
@@ -802,7 +852,9 @@
Got expected exception : An attempt was made to get a data value of type
'BIGINT' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type BIGINT
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'BIGINT' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'BIGINT' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type BIGINT
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'BIGINT'.
@@ -820,7 +872,9 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'BIGINT'.
Testing updateBlob on SQL type BIGINT
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'BIGINT' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'BIGINT' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type BIGINT
Using column position as first parameter to updateBoolean
Using column name as first parameter to updateBoolean
@@ -829,10 +883,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type BIGINT
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type BIGINT
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is DECIMAL(10,5)
Testing updateShort on SQL type DECIMAL(10,5)
Using column position as first parameter to updateShort
@@ -880,7 +938,9 @@
Got expected exception : An attempt was made to get a data value of type
'DECIMAL' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type DECIMAL(10,5)
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'DECIMAL' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'DECIMAL' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type DECIMAL(10,5)
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'DECIMAL'.
@@ -898,7 +958,9 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'DECIMAL'.
Testing updateBlob on SQL type DECIMAL(10,5)
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'DECIMAL' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'DECIMAL' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type DECIMAL(10,5)
Using column position as first parameter to updateBoolean
Using column name as first parameter to updateBoolean
@@ -907,10 +969,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type DECIMAL(10,5)
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type DECIMAL(10,5)
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is REAL
Testing updateShort on SQL type REAL
Using column position as first parameter to updateShort
@@ -958,7 +1024,9 @@
Got expected exception : An attempt was made to get a data value of type
'REAL' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type REAL
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'REAL' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'REAL' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type REAL
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'REAL'.
@@ -976,7 +1044,9 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'REAL'.
Testing updateBlob on SQL type REAL
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'REAL' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'REAL' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type REAL
Using column position as first parameter to updateBoolean
Using column name as first parameter to updateBoolean
@@ -985,10 +1055,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type REAL
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type REAL
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is DOUBLE
Testing updateShort on SQL type DOUBLE
Using column position as first parameter to updateShort
@@ -1036,7 +1110,9 @@
Got expected exception : An attempt was made to get a data value of type
'DOUBLE' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type DOUBLE
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'DOUBLE' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'DOUBLE' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type DOUBLE
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'DOUBLE'.
@@ -1054,7 +1130,9 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'DOUBLE'.
Testing updateBlob on SQL type DOUBLE
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'DOUBLE' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'DOUBLE' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type DOUBLE
Using column position as first parameter to updateBoolean
Using column name as first parameter to updateBoolean
@@ -1063,10 +1141,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type DOUBLE
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type DOUBLE
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is CHAR(60)
Testing updateShort on SQL type CHAR(60)
Using column position as first parameter to updateShort
@@ -1108,7 +1190,9 @@
Got expected exception : An attempt was made to get a data value of type
'CHAR' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type CHAR(60)
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'CHAR' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'CHAR' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type CHAR(60)
Using column position as first parameter to updateDate
Using column name as first parameter to updateDate
@@ -1120,7 +1204,9 @@
Using column name as first parameter to updateTimestamp
Testing updateBlob on SQL type CHAR(60)
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'CHAR' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'CHAR' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type CHAR(60)
Using column position as first parameter to updateBoolean
Using column name as first parameter to updateBoolean
@@ -1129,10 +1215,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type CHAR(60)
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type CHAR(60)
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is VARCHAR(60)
Testing updateShort on SQL type VARCHAR(60)
Using column position as first parameter to updateShort
@@ -1174,7 +1264,9 @@
Got expected exception : An attempt was made to get a data value of type
'VARCHAR' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type VARCHAR(60)
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type VARCHAR(60)
Using column position as first parameter to updateDate
Using column name as first parameter to updateDate
@@ -1186,7 +1278,9 @@
Using column name as first parameter to updateTimestamp
Testing updateBlob on SQL type VARCHAR(60)
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type VARCHAR(60)
Using column position as first parameter to updateBoolean
Using column name as first parameter to updateBoolean
@@ -1195,10 +1289,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type VARCHAR(60)
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type VARCHAR(60)
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is LONG VARCHAR
Testing updateShort on SQL type LONG VARCHAR
Using column position as first parameter to updateShort
@@ -1240,7 +1338,9 @@
Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type LONG VARCHAR
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type LONG VARCHAR
Using column position as first parameter to updateDate
Using column name as first parameter to updateDate
@@ -1252,7 +1352,9 @@
Using column name as first parameter to updateTimestamp
Testing updateBlob on SQL type LONG VARCHAR
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type LONG VARCHAR
Using column position as first parameter to updateBoolean
Using column name as first parameter to updateBoolean
@@ -1261,10 +1363,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type LONG VARCHAR
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type LONG VARCHAR
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is CHAR(2) FOR BIT DATA
Testing updateShort on SQL type CHAR(2) FOR BIT DATA
Using column position as first parameter to updateShort
@@ -1324,7 +1430,9 @@
Using column name as first parameter to updateBinaryStream
Testing updateClob on SQL type CHAR(2) FOR BIT DATA
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'CHAR () FOR BIT DATA' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'CHAR () FOR BIT DATA' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type CHAR(2) FOR BIT DATA
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'CHAR () FOR BIT DATA'.
@@ -1342,7 +1450,9 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'CHAR () FOR BIT DATA'.
Testing updateBlob on SQL type CHAR(2) FOR BIT DATA
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'CHAR () FOR BIT DATA' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'CHAR () FOR BIT DATA' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type CHAR(2) FOR BIT DATA
Using column position as first parameter to updateBoolean
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'CHAR () FOR BIT DATA'.
@@ -1353,10 +1463,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type CHAR(2) FOR BIT DATA
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type CHAR(2) FOR BIT DATA
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is VARCHAR(2) FOR BIT DATA
Testing updateShort on SQL type VARCHAR(2) FOR BIT DATA
Using column position as first parameter to updateShort
@@ -1416,7 +1530,9 @@
Using column name as first parameter to updateBinaryStream
Testing updateClob on SQL type VARCHAR(2) FOR BIT DATA
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR () FOR BIT DATA' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR () FOR BIT DATA' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type VARCHAR(2) FOR BIT DATA
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'VARCHAR () FOR BIT DATA'.
@@ -1434,7 +1550,9 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'VARCHAR () FOR BIT DATA'.
Testing updateBlob on SQL type VARCHAR(2) FOR BIT DATA
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR () FOR BIT DATA' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR () FOR BIT DATA' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type VARCHAR(2) FOR BIT DATA
Using column position as first parameter to updateBoolean
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'VARCHAR () FOR BIT DATA'.
@@ -1445,10 +1563,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type VARCHAR(2) FOR BIT DATA
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type VARCHAR(2) FOR BIT DATA
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is LONG VARCHAR FOR BIT DATA
Testing updateShort on SQL type LONG VARCHAR FOR BIT DATA
Using column position as first parameter to updateShort
@@ -1508,7 +1630,9 @@
Using column name as first parameter to updateBinaryStream
Testing updateClob on SQL type LONG VARCHAR FOR BIT DATA
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR FOR BIT DATA' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR FOR BIT DATA' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type LONG VARCHAR FOR BIT DATA
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'LONG VARCHAR FOR BIT DATA'.
@@ -1526,7 +1650,9 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'LONG VARCHAR FOR BIT DATA'.
Testing updateBlob on SQL type LONG VARCHAR FOR BIT DATA
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR FOR BIT DATA' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR FOR BIT DATA' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type LONG VARCHAR FOR BIT DATA
Using column position as first parameter to updateBoolean
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'LONG VARCHAR FOR BIT DATA'.
@@ -1537,10 +1663,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type LONG VARCHAR FOR BIT DATA
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type LONG VARCHAR FOR BIT DATA
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is CLOB(1k)
Testing updateShort on SQL type CLOB(1k)
Using column position as first parameter to updateShort
@@ -1616,7 +1746,9 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'CLOB'.
Testing updateBlob on SQL type CLOB(1k)
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'CLOB' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'CLOB' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type CLOB(1k)
Using column position as first parameter to updateBoolean
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'CLOB'.
@@ -1627,10 +1759,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type CLOB(1k)
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type CLOB(1k)
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is DATE
Testing updateShort on SQL type DATE
Using column position as first parameter to updateShort
@@ -1694,7 +1830,9 @@
Got expected exception : An attempt was made to get a data value of type
'DATE' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type DATE
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'DATE' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'DATE' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type DATE
Using column position as first parameter to updateDate
Using column name as first parameter to updateDate
@@ -1708,7 +1846,9 @@
Using column name as first parameter to updateTimestamp
Testing updateBlob on SQL type DATE
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'DATE' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'DATE' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type DATE
Using column position as first parameter to updateBoolean
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'DATE'.
@@ -1719,10 +1859,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type DATE
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type DATE
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is TIME
Testing updateShort on SQL type TIME
Using column position as first parameter to updateShort
@@ -1786,7 +1930,9 @@
Got expected exception : An attempt was made to get a data value of type
'TIME' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type TIME
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'TIME' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'TIME' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type TIME
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'TIME'.
@@ -1800,7 +1946,9 @@
Using column name as first parameter to updateTimestamp
Testing updateBlob on SQL type TIME
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'TIME' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'TIME' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type TIME
Using column position as first parameter to updateBoolean
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'TIME'.
@@ -1811,10 +1959,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type TIME
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type TIME
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is TIMESTAMP
Testing updateShort on SQL type TIMESTAMP
Using column position as first parameter to updateShort
@@ -1878,7 +2030,9 @@
Got expected exception : An attempt was made to get a data value of type
'TIMESTAMP' from a data value of type 'java.io.InputStream'.
Testing updateClob on SQL type TIMESTAMP
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'TIMESTAMP' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'TIMESTAMP' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type TIMESTAMP
Using column position as first parameter to updateDate
Using column name as first parameter to updateDate
@@ -1890,7 +2044,9 @@
Using column name as first parameter to updateTimestamp
Testing updateBlob on SQL type TIMESTAMP
Using column position as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'TIMESTAMP' from a data value of type 'java.sql.Blob'.
Using column name as first parameter to updateBlob
+ Got expected exception : An attempt was made to get a data value of type
'TIMESTAMP' from a data value of type 'java.sql.Blob'.
Testing updateBoolean on SQL type TIMESTAMP
Using column position as first parameter to updateBoolean
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'TIMESTAMP'.
@@ -1901,10 +2057,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type TIMESTAMP
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type TIMESTAMP
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Next datatype to test is BLOB(1k)
Testing updateShort on SQL type BLOB(1k)
Using column position as first parameter to updateShort
@@ -1964,7 +2124,9 @@
Using column name as first parameter to updateBinaryStream
Testing updateClob on SQL type BLOB(1k)
Using column position as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'BLOB' from a data value of type 'java.sql.Clob'.
Using column name as first parameter to updateClob
+ Got expected exception : An attempt was made to get a data value of type
'BLOB' from a data value of type 'java.sql.Clob'.
Testing updateDate on SQL type BLOB(1k)
Using column position as first parameter to updateDate
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'BLOB'.
@@ -1993,10 +2155,14 @@
Using column name as first parameter to updateNull
Testing updateArray on SQL type BLOB(1k)
Using column position as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateArray
+ Got expected exception : Feature not implemented: no details.
Testing updateRef on SQL type BLOB(1k)
Using column position as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Using column name as first parameter to updateRef
+ Got expected exception : Feature not implemented: no details.
Positive Test22 - Test updateObject method
Next datatype to test is SMALLINT
updateObject with column position & Short object as parameters
@@ -2017,6 +2183,10 @@
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'SMALLINT'.
updateObject with column name & bytes[] array as parameters
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'SMALLINT'.
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'SMALLINT' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'SMALLINT' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'SMALLINT'.
updateObject with column name & Date object as parameters
@@ -2029,6 +2199,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'SMALLINT'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'SMALLINT'.
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'SMALLINT' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'SMALLINT' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
updateObject with column name & Boolean object as parameters
updateObject with column position & null as parameters
@@ -2052,6 +2226,10 @@
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'INTEGER'.
updateObject with column name & bytes[] array as parameters
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'INTEGER'.
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'INTEGER' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'INTEGER' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'INTEGER'.
updateObject with column name & Date object as parameters
@@ -2064,6 +2242,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'INTEGER'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'INTEGER'.
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'INTEGER' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'INTEGER' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
updateObject with column name & Boolean object as parameters
updateObject with column position & null as parameters
@@ -2087,6 +2269,10 @@
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'BIGINT'.
updateObject with column name & bytes[] array as parameters
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'BIGINT'.
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'BIGINT' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'BIGINT' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'BIGINT'.
updateObject with column name & Date object as parameters
@@ -2099,6 +2285,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'BIGINT'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'BIGINT'.
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'BIGINT' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'BIGINT' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
updateObject with column name & Boolean object as parameters
updateObject with column position & null as parameters
@@ -2122,6 +2312,10 @@
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'DECIMAL'.
updateObject with column name & bytes[] array as parameters
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'DECIMAL'.
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DECIMAL' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DECIMAL' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'DECIMAL'.
updateObject with column name & Date object as parameters
@@ -2134,6 +2328,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'DECIMAL'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'DECIMAL'.
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DECIMAL' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DECIMAL' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
updateObject with column name & Boolean object as parameters
updateObject with column position & null as parameters
@@ -2157,6 +2355,10 @@
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'REAL'.
updateObject with column name & bytes[] array as parameters
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'REAL'.
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'REAL' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'REAL' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'REAL'.
updateObject with column name & Date object as parameters
@@ -2169,6 +2371,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'REAL'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'REAL'.
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'REAL' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'REAL' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
updateObject with column name & Boolean object as parameters
updateObject with column position & null as parameters
@@ -2192,6 +2398,10 @@
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'DOUBLE'.
updateObject with column name & bytes[] array as parameters
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'DOUBLE'.
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DOUBLE' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DOUBLE' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'DOUBLE'.
updateObject with column name & Date object as parameters
@@ -2204,6 +2414,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'DOUBLE'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'DOUBLE'.
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DOUBLE' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DOUBLE' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
updateObject with column name & Boolean object as parameters
updateObject with column position & null as parameters
@@ -2225,12 +2439,20 @@
updateObject with column name & String object as parameters
updateObject with column position & bytes[] array as parameters
updateObject with column name & bytes[] array as parameters
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'CHAR' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'CHAR' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
updateObject with column name & Date object as parameters
updateObject with column position & Time object as parameters
updateObject with column name & Time object as parameters
updateObject with column position & TimeStamp object as parameters
updateObject with column name & TimeStamp object as parameters
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'CHAR' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'CHAR' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
updateObject with column name & Boolean object as parameters
updateObject with column position & null as parameters
@@ -2252,12 +2474,20 @@
updateObject with column name & String object as parameters
updateObject with column position & bytes[] array as parameters
updateObject with column name & bytes[] array as parameters
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
updateObject with column name & Date object as parameters
updateObject with column position & Time object as parameters
updateObject with column name & Time object as parameters
updateObject with column position & TimeStamp object as parameters
updateObject with column name & TimeStamp object as parameters
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
updateObject with column name & Boolean object as parameters
updateObject with column position & null as parameters
@@ -2279,12 +2509,20 @@
updateObject with column name & String object as parameters
updateObject with column position & bytes[] array as parameters
updateObject with column name & bytes[] array as parameters
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
updateObject with column name & Date object as parameters
updateObject with column position & Time object as parameters
updateObject with column name & Time object as parameters
updateObject with column position & TimeStamp object as parameters
updateObject with column name & TimeStamp object as parameters
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
updateObject with column name & Boolean object as parameters
updateObject with column position & null as parameters
@@ -2320,6 +2558,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.lang.String' into a data value of type 'CHAR () FOR BIT DATA'.
updateObject with column position & bytes[] array as parameters
updateObject with column name & bytes[] array as parameters
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'CHAR () FOR BIT DATA' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'CHAR () FOR BIT DATA' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'CHAR () FOR BIT DATA'.
updateObject with column name & Date object as parameters
@@ -2332,6 +2574,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'CHAR () FOR BIT DATA'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'CHAR () FOR BIT DATA'.
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'CHAR () FOR BIT DATA' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'CHAR () FOR BIT DATA' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'CHAR () FOR BIT DATA'.
updateObject with column name & Boolean object as parameters
@@ -2369,6 +2615,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.lang.String' into a data value of type 'VARCHAR () FOR BIT DATA'.
updateObject with column position & bytes[] array as parameters
updateObject with column name & bytes[] array as parameters
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR () FOR BIT DATA' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR () FOR BIT DATA' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'VARCHAR () FOR BIT DATA'.
updateObject with column name & Date object as parameters
@@ -2381,6 +2631,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'VARCHAR () FOR BIT DATA'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'VARCHAR () FOR BIT DATA'.
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR () FOR BIT DATA' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'VARCHAR () FOR BIT DATA' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'VARCHAR () FOR BIT DATA'.
updateObject with column name & Boolean object as parameters
@@ -2418,6 +2672,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.lang.String' into a data value of type 'LONG VARCHAR FOR BIT DATA'.
updateObject with column position & bytes[] array as parameters
updateObject with column name & bytes[] array as parameters
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR FOR BIT DATA' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR FOR BIT DATA' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'LONG VARCHAR FOR BIT DATA'.
updateObject with column name & Date object as parameters
@@ -2430,6 +2688,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'LONG VARCHAR FOR BIT DATA'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'LONG VARCHAR FOR BIT DATA'.
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR FOR BIT DATA' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'LONG VARCHAR FOR BIT DATA' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'LONG VARCHAR FOR BIT DATA'.
updateObject with column name & Boolean object as parameters
@@ -2467,6 +2729,8 @@
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'CLOB'.
updateObject with column name & bytes[] array as parameters
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'CLOB'.
+ updateObject with column position & Clob object as parameters
+ updateObject with column name & Clob object as parameters
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'CLOB'.
updateObject with column name & Date object as parameters
@@ -2479,6 +2743,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'CLOB'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'CLOB'.
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'CLOB' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'CLOB' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'CLOB'.
updateObject with column name & Boolean object as parameters
@@ -2518,6 +2786,10 @@
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'DATE'.
updateObject with column name & bytes[] array as parameters
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'DATE'.
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DATE' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DATE' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
updateObject with column name & Date object as parameters
updateObject with column position & Time object as parameters
@@ -2526,6 +2798,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Time' into a data value of type 'DATE'.
updateObject with column position & TimeStamp object as parameters
updateObject with column name & TimeStamp object as parameters
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DATE' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'DATE' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'DATE'.
updateObject with column name & Boolean object as parameters
@@ -2565,6 +2841,10 @@
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'TIME'.
updateObject with column name & bytes[] array as parameters
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'TIME'.
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'TIME' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'TIME' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'TIME'.
updateObject with column name & Date object as parameters
@@ -2573,6 +2853,10 @@
updateObject with column name & Time object as parameters
updateObject with column position & TimeStamp object as parameters
updateObject with column name & TimeStamp object as parameters
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'TIME' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'TIME' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'TIME'.
updateObject with column name & Boolean object as parameters
@@ -2612,12 +2896,20 @@
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'TIMESTAMP'.
updateObject with column name & bytes[] array as parameters
Got expected exception : An attempt was made to put a data value of type
'byte[]' into a data value of type 'TIMESTAMP'.
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'TIMESTAMP' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'TIMESTAMP' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
updateObject with column name & Date object as parameters
updateObject with column position & Time object as parameters
updateObject with column name & Time object as parameters
updateObject with column position & TimeStamp object as parameters
updateObject with column name & TimeStamp object as parameters
+ updateObject with column position & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'TIMESTAMP' from a data value of type 'java.sql.Blob'.
+ updateObject with column name & Blob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'TIMESTAMP' from a data value of type 'java.sql.Blob'.
updateObject with column position & Boolean object as parameters
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'TIMESTAMP'.
updateObject with column name & Boolean object as parameters
@@ -2655,6 +2947,10 @@
Got expected exception : An attempt was made to put a data value of type
'java.lang.String' into a data value of type 'BLOB'.
updateObject with column position & bytes[] array as parameters
updateObject with column name & bytes[] array as parameters
+ updateObject with column position & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'BLOB' from a data value of type 'java.sql.Clob'.
+ updateObject with column name & Clob object as parameters
+ Got expected exception : An attempt was made to get a data value of type
'BLOB' from a data value of type 'java.sql.Clob'.
updateObject with column position & Date object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Date' into a data value of type 'BLOB'.
updateObject with column name & Date object as parameters
@@ -2667,6 +2963,8 @@
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'BLOB'.
updateObject with column name & TimeStamp object as parameters
Got expected exception : An attempt was made to put a data value of type
'java.sql.Timestamp' into a data value of type 'BLOB'.
+ updateObject with column position & Blob object as parameters
+ updateObject with column name & Blob object as parameters
updateObject with column position & Boolean object as parameters
Got expected exception : An attempt was made to put a data value of type
'boolean' into a data value of type 'BLOB'.
updateObject with column name & Boolean object as parameters
@@ -2689,6 +2987,8 @@
updateDate and then cancelRowUpdates
updateTime and then cancelRowUpdates
updateTimestamp and then cancelRowUpdates
+ updateClob and then cancelRowUpdates
+ updateBlob and then cancelRowUpdates
Positive Test24a - after updateXXX, try cancelRowUpdates and then deleteRow
column 1 on this row before updateInt is 1
column 1 on this row after updateInt is 234
@@ -2772,7 +3072,7 @@
{2,bb }
{3,cc }
SQL State : 42X31
-Got expected exception Column 'C2' is not in FOR UPDATE list of cursor
'SQLCUR528'.
+Got expected exception Column 'C2' is not in FOR UPDATE list of cursor
'SQLCUR539'.
Make sure the contents of table are unchanged
C1,C2
-- --
Index:
java/testing/org/apache/derbyTesting/functionTests/master/jdk14/updatableResultSet.out
===================================================================
---
java/testing/org/apache/derbyTesting/functionTests/master/jdk14/updatableResultSet.out
(revision 160207)
+++
java/testing/org/apache/derbyTesting/functionTests/master/jdk14/updatableResultSet.out
(working copy)
@@ -51,6 +51,8 @@
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
Expected warnings on resultset = java.sql.SQLWarning: 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 : XJ083
@@ -64,6 +66,8 @@
SQL State : 24000
Got expected exception Invalid cursor state - no current row.
Now attempt a updateRow without first doing next on the resultset.
+In embedded mode, updateRow will check if it is on a row or not even though no
changes have been made to the row using updateXXX
+In Network Server mode, if no updateXXX were issued before updateRow, then
updateRow is a no-op and doesn't check if it is on a row or not
SQL State : 24000
Got expected exception Invalid cursor state - no current row.
ResultSet is positioned after the last row. attempt to deleteRow at this point
should fail!
@@ -122,7 +126,8 @@
JDBC 2.0 updatable resultset apis on this ResultSet object will pass because
this is an updatable resultset
column 1 on this row before deleteRow is 1
column 2 on this row before deleteRow is aa
-Since after deleteRow(), ResultSet is positioned before the next row, getXXX
will fail
+Since after deleteRow(), in embedded mode, ResultSet is positioned before the
next row, getXXX will fail
+In Network Server mode, the ResultSet stays on the deleted row after deleteRow
and hence no error for getXXX
SQL State : 24000
Got expected exception Invalid cursor state - no current row.
calling deleteRow again w/o first positioning the ResultSet on the next row
will fail
@@ -135,7 +140,8 @@
column 1 on this row after updateInt is 234
column 2 on this row before updateString is aa
now updateRow on the row
-Since after updateRow(), ResultSet is positioned before the next row, getXXX
will fail
+Since after updateRow(), in embedded mode, ResultSet is positioned before the
next row, getXXX will fail
+In Network Server mode, the ResultSet stays on the updated row after updateRow
and hence no error for getXXX
SQL State : 24000
Got expected exception Invalid cursor state - no current row.
calling updateRow again w/o first positioning the ResultSet on the next row
will fail
@@ -269,17 +275,37 @@
Positive Test9c - try to updateXXX on a readonly column. Should get error
SQL State : 42X31
Got expected exception Column 'C2' is not in FOR UPDATE list of cursor
'SQLCUR15'.
+attempt to get an updatable resultset using correlation name for an readonly
column. It should work
+The sql is SELECT c1, c2 as col2 FROM t1 abcde FOR UPDATE of c1
Table t1 after updateRow has following rows
C1,C2
-- --
+ {11,aa }
+ {2,bb }
+ {3,cc }
+Positive Test9c - try to updateXXX on a readonly column. Should get error
+SQL State : 42X31
+Got expected exception Column 'C2' is not in FOR UPDATE list of cursor
'SQLCUR17'.
+Table t1 has following rows
+ C1,C2
+ -- --
{1,aa }
{2,bb }
{3,cc }
+Positive Test9d - try to updateXXX on a readonly column with correlation name.
Should get error
+SQL State : 42X31
+Got expected exception Column 'COL2' is not in FOR UPDATE list of cursor
'SQLCUR18'.
+Table t1 has following rows
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
Positive Test10 - 2 updatable resultsets going against the same table, will
they conflict?
delete using first resultset
attempt to send deleteRow on the same row through a different resultset should
throw an exception
SQL State : XCL08
-Got expected exception Cursor 'SQLCUR17' is not on a row.
+Got expected exception Cursor 'SQLCUR20' is not on a row.
Move to next row in the 2nd resultset and then delete using the second
resultset
Positive Test11 - setting the fetch size to > 1 will be ignored by updatable
resultset. Same as updatable cursors
Notice the Fetch Size in run time statistics output.
@@ -3046,7 +3072,7 @@
{2,bb }
{3,cc }
SQL State : 42X31
-Got expected exception Column 'C2' is not in FOR UPDATE list of cursor
'SQLCUR536'.
+Got expected exception Column 'C2' is not in FOR UPDATE list of cursor
'SQLCUR539'.
Make sure the contents of table are unchanged
C1,C2
-- --
Index: java/testing/org/apache/derbyTesting/functionTests/master/resultset.out
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/master/resultset.out
(revision 160207)
+++ java/testing/org/apache/derbyTesting/functionTests/master/resultset.out
(working copy)
@@ -10,7 +10,7 @@
getColumnLabel(1): I
getColumnName(1): I
getTableName(1): T
-getSchemaName(1):
+getSchemaName(1): APP
getCatalogName(1):
getColumnType(1): 4
getPrecision(1): 10
@@ -29,7 +29,7 @@
getColumnLabel(2): S
getColumnName(2): S
getTableName(2): T
-getSchemaName(2):
+getSchemaName(2): APP
getCatalogName(2):
getColumnType(2): 5
getPrecision(2): 5
@@ -48,7 +48,7 @@
getColumnLabel(3): R
getColumnName(3): R
getTableName(3): T
-getSchemaName(3):
+getSchemaName(3): APP
getCatalogName(3):
getColumnType(3): 7
getPrecision(3): 7
@@ -67,7 +67,7 @@
getColumnLabel(4): D
getColumnName(4): D
getTableName(4): T
-getSchemaName(4):
+getSchemaName(4): APP
getCatalogName(4):
getColumnType(4): 8
getPrecision(4): 15
@@ -86,7 +86,7 @@
getColumnLabel(5): DT
getColumnName(5): DT
getTableName(5): T
-getSchemaName(5):
+getSchemaName(5): APP
getCatalogName(5):
getColumnType(5): 91
getPrecision(5): 10
@@ -105,7 +105,7 @@
getColumnLabel(6): T
getColumnName(6): T
getTableName(6): T
-getSchemaName(6):
+getSchemaName(6): APP
getCatalogName(6):
getColumnType(6): 92
getPrecision(6): 0
@@ -124,7 +124,7 @@
getColumnLabel(7): TS
getColumnName(7): TS
getTableName(7): T
-getSchemaName(7):
+getSchemaName(7): APP
getCatalogName(7):
getColumnType(7): 93
getPrecision(7): 0
@@ -143,7 +143,7 @@
getColumnLabel(8): C
getColumnName(8): C
getTableName(8): T
-getSchemaName(8):
+getSchemaName(8): APP
getCatalogName(8):
getColumnType(8): 1
getPrecision(8): 10
@@ -162,7 +162,7 @@
getColumnLabel(9): V
getColumnName(9): V
getTableName(9): T
-getSchemaName(9):
+getSchemaName(9): APP
getCatalogName(9):
getColumnType(9): 12
getPrecision(9): 40
@@ -181,7 +181,7 @@
getColumnLabel(10): DC
getColumnName(10): DC
getTableName(10): T
-getSchemaName(10):
+getSchemaName(10): APP
getCatalogName(10):
getColumnType(10): 3
getPrecision(10): 10
@@ -200,7 +200,7 @@
getColumnLabel(11): BI
getColumnName(11): BI
getTableName(11): T
-getSchemaName(11):
+getSchemaName(11): APP
getCatalogName(11):
getColumnType(11): -5
getPrecision(11): 19
@@ -219,7 +219,7 @@
getColumnLabel(12): CBD
getColumnName(12): CBD
getTableName(12): T
-getSchemaName(12):
+getSchemaName(12): APP
getCatalogName(12):
getColumnType(12): -2
getPrecision(12): 10
@@ -238,7 +238,7 @@
getColumnLabel(13): VBD
getColumnName(13): VBD
getTableName(13): T
-getSchemaName(13):
+getSchemaName(13): APP
getCatalogName(13):
getColumnType(13): -3
getPrecision(13): 10
@@ -257,7 +257,7 @@
getColumnLabel(14): LVBD
getColumnName(14): LVBD
getTableName(14): T
-getSchemaName(14):
+getSchemaName(14): APP
getCatalogName(14):
getColumnType(14): -4
getPrecision(14): 32700
@@ -276,7 +276,7 @@
getColumnLabel(15): CL
getColumnName(15): CL
getTableName(15): T
-getSchemaName(15):
+getSchemaName(15): APP
getCatalogName(15):
getColumnType(15): 2005
getPrecision(15): 2147483647
@@ -295,7 +295,7 @@
getColumnLabel(16): BL
getColumnName(16): BL
getTableName(16): T
-getSchemaName(16):
+getSchemaName(16): APP
getCatalogName(16):
getColumnType(16): 2004
getPrecision(16): 1073741824