org.apache.derbyTesting.functionTests.tests.jdbcapi
Class UpdatableResultSetTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.derbyTesting.junit.BaseTestCase
              extended by org.apache.derbyTesting.junit.BaseJDBCTestCase
                  extended by org.apache.derbyTesting.functionTests.tests.jdbcapi.UpdatableResultSetTest
All Implemented Interfaces:
junit.framework.Test

public class UpdatableResultSetTest
extends BaseJDBCTestCase

Tests updatable result sets. DERBY-1767 - Test that the deleteRow, insertRow and updateRow methods with column/table/schema/cursor names containing quotes.


Field Summary
private static byte[] BYTES1
           
private static byte[] BYTES2
           
private static int insertKey
          Key used to identify inserted rows.
private  int key
           
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
UpdatableResultSetTest(java.lang.String name)
          Creates a new instance of UpdatableResultSetTest
 
Method Summary
private  java.sql.ResultSet fetch(java.lang.String colName, int key)
          Fetch the specified row.
private  java.sql.ResultSet fetchUpd(java.lang.String colName, int key)
          Fetch the specified row for update.
private  java.sql.PreparedStatement prep(java.lang.String colName)
          Prepare commonly used statement to insert a row.
private static int requestKey()
          Get a key that is used to identify an inserted row.
protected  void setUp()
          Create require objects and data.
static junit.framework.Test suite()
          Create a test suite with all tests in this class.
 void testDeleteRowOnQuotedColumn()
          Tests deleteRow with column name containing quotes
 void testDeleteRowOnQuotedCursor()
          Tests deleteRow with cursor name containing quotes
 void testDeleteRowOnQuotedSchema()
          Tests deleteRow with schema name containing quotes
 void testDeleteRowOnQuotedTable()
          Tests deleteRow with table name containing quotes
 void testInsertRowOnQuotedColumn()
          Tests insertRow with column name containing quotes
 void testInsertRowOnQuotedCursor()
          Tests insertRow with cursor name containing quotes
 void testInsertRowOnQuotedSchema()
          Tests insertRow with schema name containing quotes
 void testInsertRowOnQuotedTable()
          Tests insertRow with table name containing quotes
 void testUpdateBlob()
          This methods tests the ResultSet interface method updateBlob
 void testUpdateBlobStringParameterName()
          This methods tests the ResultSet interface method updateBlob
 void testUpdateClob()
          This methods tests the ResultSet interface method updateClob
 void testUpdateClobStringParameterName()
          This methods tests the ResultSet interface method updateClob
 void testUpdateRowOnQuotedColumn()
          Tests updateRow with column name containing quotes
 void testUpdateRowOnQuotedCursor()
          Tests updateRow with cursor name containing quotes
 void testUpdateRowOnQuotedSchema()
          Tests updateRow with schema name containing quotes
 void testUpdateRowOnQuotedTable()
          Tests updateRow with table name containing quotes
 
Methods inherited from class org.apache.derbyTesting.junit.BaseJDBCTestCase
assertCallError, assertCheckTable, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertGetIntError, assertNextError, assertPreparedStatementError, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertTableRowCount, assertUpdateCount, assertUpdateCount, checkAllConsistency, checkEstimatedRowCount, commit, createStatement, createStatement, createStatement, dropTable, dropTable, getConnection, getDatabaseProperty, getLastSQLException, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
 
Methods inherited from class org.apache.derbyTesting.junit.BaseTestCase
alarm, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertSecurityManager, assertThrowableEquals, execJavaCmd, fail, getFailureFolder, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeSystemProperty, runBare, setSystemProperty, traceit
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BYTES1

private static final byte[] BYTES1

BYTES2

private static final byte[] BYTES2

insertKey

private static int insertKey
Key used to identify inserted rows. Use method requestKey to obtain it.


key

private int key
Constructor Detail

UpdatableResultSetTest

public UpdatableResultSetTest(java.lang.String name)
Creates a new instance of UpdatableResultSetTest

Method Detail

setUp

protected void setUp()
              throws java.sql.SQLException
Create require objects and data. No tearDown is needed because these are created in non-auto-commit mode and no commit is ever issued. Thus on the super's tearDown the rollback will revert everything.

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.sql.SQLException

suite

public static junit.framework.Test suite()
Create a test suite with all tests in this class.


testInsertRowOnQuotedTable

public void testInsertRowOnQuotedTable()
                                throws java.sql.SQLException
Tests insertRow with table name containing quotes

Throws:
java.sql.SQLException

testUpdateRowOnQuotedTable

public void testUpdateRowOnQuotedTable()
                                throws java.sql.SQLException
Tests updateRow with table name containing quotes

Throws:
java.sql.SQLException

testDeleteRowOnQuotedTable

public void testDeleteRowOnQuotedTable()
                                throws java.sql.SQLException
Tests deleteRow with table name containing quotes

Throws:
java.sql.SQLException

testInsertRowOnQuotedColumn

public void testInsertRowOnQuotedColumn()
                                 throws java.sql.SQLException
Tests insertRow with column name containing quotes

Throws:
java.sql.SQLException

testUpdateRowOnQuotedColumn

public void testUpdateRowOnQuotedColumn()
                                 throws java.sql.SQLException
Tests updateRow with column name containing quotes

Throws:
java.sql.SQLException

testDeleteRowOnQuotedColumn

public void testDeleteRowOnQuotedColumn()
                                 throws java.sql.SQLException
Tests deleteRow with column name containing quotes

Throws:
java.sql.SQLException

testInsertRowOnQuotedSchema

public void testInsertRowOnQuotedSchema()
                                 throws java.sql.SQLException
Tests insertRow with schema name containing quotes

Throws:
java.sql.SQLException

testUpdateRowOnQuotedSchema

public void testUpdateRowOnQuotedSchema()
                                 throws java.sql.SQLException
Tests updateRow with schema name containing quotes

Throws:
java.sql.SQLException

testDeleteRowOnQuotedSchema

public void testDeleteRowOnQuotedSchema()
                                 throws java.sql.SQLException
Tests deleteRow with schema name containing quotes

Throws:
java.sql.SQLException

testInsertRowOnQuotedCursor

public void testInsertRowOnQuotedCursor()
                                 throws java.sql.SQLException
Tests insertRow with cursor name containing quotes

Throws:
java.sql.SQLException

testUpdateRowOnQuotedCursor

public void testUpdateRowOnQuotedCursor()
                                 throws java.sql.SQLException
Tests updateRow with cursor name containing quotes

Throws:
java.sql.SQLException

testDeleteRowOnQuotedCursor

public void testDeleteRowOnQuotedCursor()
                                 throws java.sql.SQLException
Tests deleteRow with cursor name containing quotes

Throws:
java.sql.SQLException

testUpdateBlob

public void testUpdateBlob()
                    throws java.lang.Exception
This methods tests the ResultSet interface method updateBlob

Throws:
java.lang.Exception

testUpdateBlobStringParameterName

public void testUpdateBlobStringParameterName()
                                       throws java.lang.Exception
This methods tests the ResultSet interface method updateBlob

Throws:
java.lang.Exception

testUpdateClob

public void testUpdateClob()
                    throws java.lang.Exception
This methods tests the ResultSet interface method updateClob

Throws:
java.lang.Exception

testUpdateClobStringParameterName

public void testUpdateClobStringParameterName()
                                       throws java.lang.Exception
This methods tests the ResultSet interface method updateClob

Throws:
java.lang.Exception

requestKey

private static final int requestKey()
Get a key that is used to identify an inserted row. Introduced to avoid having to delete table contents after each test, and because the order of the tests is not guaranteed.

Returns:
an integer in range [1, Integer.MAX_VALUE -1]

prep

private java.sql.PreparedStatement prep(java.lang.String colName)
                                 throws java.sql.SQLException
Prepare commonly used statement to insert a row.

Parameters:
colName - name of the column to insert into
Throws:
java.sql.SQLException

fetchUpd

private java.sql.ResultSet fetchUpd(java.lang.String colName,
                                    int key)
                             throws java.sql.SQLException
Fetch the specified row for update.

Parameters:
colName - name of the column to fetch
key - identifier for row to fetch
Returns:
a ResultSet with zero or one row, depending on the key used
Throws:
java.sql.SQLException

fetch

private java.sql.ResultSet fetch(java.lang.String colName,
                                 int key)
                          throws java.sql.SQLException
Fetch the specified row.

Parameters:
colName - name of the column to fetch
key - identifier for row to fetch
Returns:
a ResultSet with zero or one row, depending on the key used
Throws:
java.sql.SQLException

Built on Sat 2009-11-28 18:44:18-0800, from revision 885187

Apache Derby V10.6 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.