public class ResultSetTest extends Wrapper41Test
Modifier and Type | Field and Description |
---|---|
private static byte[] |
BYTES1 |
private static byte[] |
BYTES2 |
private static int |
insertKey
Key used to identify inserted rows.
|
private int |
key
Default row identifier used by the tests.
|
private java.sql.ResultSet |
rs
Default resultset used by the tests.
|
private java.sql.Statement |
stmt
Statement used to obtain default resultset.
|
private static java.lang.String |
str1 |
private static java.lang.String |
str2 |
BINARY_VALUE, TIME_VALUE, TIMESTAMP_VALUE
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
ResultSetTest(java.lang.String name)
Create test with given name.
|
Modifier and Type | Method and Description |
---|---|
private static junit.framework.Test |
decorateTestSuite(junit.framework.Test rsSuite) |
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.
|
static void |
getResultSetWithHoldability(int holdability,
java.sql.ResultSet[] rs)
Method invoked by
testGetHoldability() (as a stored
procedure) to retrieve a result set with a given holdability. |
private static java.lang.String |
holdabilityString(int holdability)
Convert holdability from an integer to a readable string.
|
static java.sql.Blob |
makeBlob()
Function for making a Blob.
|
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() |
static junit.framework.Test |
suite()
T E S T S E T U P *
|
protected void |
tearDown()
Tear down this fixture, sub-classes should call
super.tearDown().
|
void |
testDerby1368()
EOFException when reading from blob's binary stream
and calling length() twice
Test with and without lengthless insert.
|
void |
testDerby1368(boolean lengthless)
EOFException when reading from blob's binary stream
and calling length() twice
|
void |
testExceptionWhenClosed()
Test that an exception is thrown when methods are called
on a closed result set (DERBY-1060).
|
void |
testGetHoldability()
Tests that
ResultSet.getHoldability() has the
correct behaviour. |
void |
testGetNCharacterStreamIntNotImplemented() |
void |
testGetNCharaterStreamStringNotImplemented() |
void |
testGetNClobNotIntImplemented() |
void |
testGetNClobStringNotImplemented() |
void |
testGetNStringIntNotImplemented() |
void |
testGetNStringStringNotImplemented() |
void |
testGetSQLXMLIntNotImplemented() |
void |
testGetSQLXMLStringNotImplemented() |
void |
testIsClosed()
Tests that
ResultSet.isClosed() returns the
correct value in different situations. |
void |
testIsClosedOnNonHoldableResultSet()
Test that a
ResultSet is marked as closed after commit if its
holdability is CLOSE_CURSORS_AT_COMMIT (DERBY-3404). |
void |
testJDBC4_1()
Test the JDBC 4.1 extensions.
|
void |
testUpdateAsciiStream()
This methods tests the ResultSet interface method
updateAsciiStream
|
void |
testUpdateAsciiStreamLengthless() |
void |
testUpdateAsciiStreamLengthlessParameterName() |
void |
testUpdateAsciiStreamStringParameterName()
This methods tests the ResultSet interface method
updateAsciiStream
|
void |
testUpdateBinaryStream()
This methods tests the ResultSet interface method
updateBinaryStream
|
void |
testUpdateBinaryStreamLengthless()
Test
updateBinaryStream on a BINARY column, without
specifying length of inputstream. |
void |
testUpdateBinaryStreamLengthlessBlob()
Test
updateBinaryStream on a BLOB column, without
specifying length of inputstream. |
void |
testUpdateBinaryStreamLengthlessParameterName() |
void |
testUpdateBinaryStreamStringParameterName()
This methods tests the ResultSet interface method
updateBinaryStream
|
void |
testUpdateBlob()
This methods tests the ResultSet interface method
updateBlob
|
void |
testUpdateBlobLengthless() |
void |
testUpdateBlobStringParameterName()
This methods tests the ResultSet interface method
updateBlob
|
void |
testUpdateBlobStringParameterNameWithLengthofIS()
Tests the updateBlob that accepts a input stream and the length of the IS
and the parameter name String.
|
void |
testUpdateBlobWithLengthofIS()
tests the updateBlob that accepts a input stream and the length of the IS.
|
void |
testUpdateBlobWithStreamLengthlessParameterName() |
void |
testUpdateCharacterStream()
This methods tests the ResultSet interface method
updateCharacterStream
|
void |
testUpdateCharacterStreamLengthless() |
void |
testUpdateCharacterStreamLengthlessParameterName() |
void |
testUpdateCharacterStreamStringParameterName()
This methods tests the ResultSet interface method
updateCharacterStream
|
void |
testUpdateClob()
This methods tests the ResultSet interface method
updateClob
|
void |
testUpdateClobLengthless() |
void |
testUpdateClobLengthlessParameterName() |
void |
testUpdateClobStringParameterName()
This methods tests the ResultSet interface method
updateClob
|
void |
testUpdateClobStringParameterNameWithLengthofIS()
Tests the updateClob that accepts a input stream and the length of the IS
and the parameter name String.
|
void |
testUpdateClobwithLengthofIS()
Test the Clob method that accepts a Input Stream and its length
as input parameter.
|
void |
testUpdateNCharacterStreamIntLengthLessNotImplemented() |
void |
testUpdateNCharacterStreamIntNotImplemented() |
void |
testUpdateNCharacterStreamStringLengthlessNotImplemented() |
void |
testUpdateNCharacterStreamStringNotImplemented() |
void |
testUpdateNClobIntLengthlessNotImplemented() |
void |
testUpdateNClobIntNotImplemented() |
void |
testUpdateNClobStringLengthlessNotImplemented() |
void |
testUpdateNClobStringNotImplemented() |
void |
testUpdateNStringIntNotImplemented() |
void |
testUpdateNStringStringNotImplemented() |
void |
testUpdateSQLXMLIntNotImplemented() |
void |
testUpdateSQLXMLStringNotImplemented() |
void |
testWrapper()
Tests the wrapper methods isWrapperFor and unwrap.
|
static void |
threeResultSets(java.sql.ResultSet[] rs1,
java.sql.ResultSet[] rs2,
java.sql.ResultSet[] rs3)
Method that is invoked by
testIsClosed() (as a
stored procedure) to retrieve three result sets. |
private void |
vetDataTypeCount(java.sql.Connection conn) |
examineJDBC4_1extensions, prepareCall, prepareStatement
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeast
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, toString
private static final byte[] BYTES1
private static final byte[] BYTES2
private static final java.lang.String str1
private static final java.lang.String str2
private static int insertKey
requestKey
to obtain it.private java.sql.Statement stmt
private java.sql.ResultSet rs
private int key
public ResultSetTest(java.lang.String name)
name
- name of the test.protected void setUp() throws java.sql.SQLException
setUp
in class junit.framework.TestCase
java.sql.SQLException
protected void tearDown() throws java.lang.Exception
BaseJDBCTestCase
tearDown
in class BaseJDBCTestCase
java.lang.Exception
public void testGetNCharacterStreamIntNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testGetNCharaterStreamStringNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testGetNClobNotIntImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testGetNClobStringNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testGetNStringIntNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testGetNStringStringNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testGetSQLXMLIntNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testGetSQLXMLStringNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateNCharacterStreamIntNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateNCharacterStreamIntLengthLessNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateNCharacterStreamStringNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateNCharacterStreamStringLengthlessNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateNClobIntNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateNClobIntLengthlessNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateNClobStringNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateNClobStringLengthlessNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateNStringIntNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateNStringStringNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateSQLXMLIntNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateSQLXMLStringNotImplemented() throws java.sql.SQLException
java.sql.SQLException
public void testUpdateBinaryStream() throws java.lang.Exception
java.sql.SQLException
- if some error occurs while calling the methodjava.lang.Exception
public void testUpdateAsciiStream() throws java.lang.Exception
java.sql.SQLException
- if some error occurs while calling the methodjava.lang.Exception
public void testUpdateCharacterStream() throws java.lang.Exception
java.sql.SQLException
- if some error occurs while calling the methodjava.lang.Exception
public void testUpdateBinaryStreamStringParameterName() throws java.lang.Exception
java.sql.SQLException
- if some error occurs while calling the methodjava.lang.Exception
public void testUpdateBinaryStreamLengthless() throws java.io.IOException, java.sql.SQLException
updateBinaryStream
on a BINARY column, without
specifying length of inputstream.java.io.IOException
java.sql.SQLException
public void testUpdateBinaryStreamLengthlessBlob() throws java.io.IOException, java.sql.SQLException
updateBinaryStream
on a BLOB column, without
specifying length of inputstream.java.io.IOException
java.sql.SQLException
public void testUpdateBinaryStreamLengthlessParameterName() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testUpdateAsciiStreamStringParameterName() throws java.lang.Exception
java.sql.SQLException
- if some error occurs while calling the methodjava.lang.Exception
public void testUpdateAsciiStreamLengthless() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testUpdateAsciiStreamLengthlessParameterName() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testUpdateCharacterStreamStringParameterName() throws java.lang.Exception
java.sql.SQLException
- if some error occurs while calling the methodjava.lang.Exception
public void testUpdateCharacterStreamLengthless() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testUpdateCharacterStreamLengthlessParameterName() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testUpdateClob() throws java.lang.Exception
java.sql.SQLException
- if some error occurs while calling the methodjava.lang.Exception
public void testUpdateClobLengthless() throws java.lang.Exception
java.lang.Exception
public void testUpdateClobwithLengthofIS() throws java.lang.Exception
java.lang.Exception
public void testUpdateBlob() throws java.lang.Exception
java.sql.SQLException
- if some error occurs while calling the methodjava.lang.Exception
public void testUpdateBlobLengthless() throws java.lang.Exception
java.lang.Exception
public void testUpdateBlobWithLengthofIS() throws java.lang.Exception
an
- Exceptionjava.lang.Exception
public void testUpdateBlobStringParameterNameWithLengthofIS() throws java.lang.Exception
an
- Exceptionjava.lang.Exception
public void testUpdateClobStringParameterName() throws java.lang.Exception
java.sql.SQLException
- if some error occurs while calling the methodjava.lang.Exception
public void testUpdateClobLengthlessParameterName() throws java.lang.Exception
java.lang.Exception
public void testUpdateClobStringParameterNameWithLengthofIS() throws java.lang.Exception
an
- Exceptionjava.lang.Exception
public void testUpdateBlobStringParameterName() throws java.lang.Exception
java.sql.SQLException
- if some error occurs while calling the methodjava.lang.Exception
public void testUpdateBlobWithStreamLengthlessParameterName() throws java.lang.Exception
java.lang.Exception
public void testGetHoldability() throws java.sql.SQLException, java.lang.Exception
ResultSet.getHoldability()
has the
correct behaviour.java.sql.SQLException
- Thrown if some unexpected error happensjava.lang.Exception
- Thrown if some unexpected error happenspublic void testIsClosed() throws java.sql.SQLException
ResultSet.isClosed()
returns the
correct value in different situations.java.sql.SQLException
- Thrown if some unexpected error happenspublic void testIsClosedOnNonHoldableResultSet() throws java.sql.SQLException
ResultSet
is marked as closed after commit if its
holdability is CLOSE_CURSORS_AT_COMMIT
(DERBY-3404).java.sql.SQLException
public void testExceptionWhenClosed() throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.sql.SQLException
java.sql.SQLException
- Thrown if some unexpected error happensjava.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public void testWrapper() throws java.sql.SQLException
java.sql.SQLException
- Thrown if some unexpected error happenspublic static junit.framework.Test suite()
private static junit.framework.Test decorateTestSuite(junit.framework.Test rsSuite)
private static final int requestKey()
private java.sql.PreparedStatement prep(java.lang.String colName) throws java.sql.SQLException
colName
- name of the column to insert intojava.sql.SQLException
private java.sql.ResultSet fetchUpd(java.lang.String colName, int key) throws java.sql.SQLException
colName
- name of the column to fetchkey
- identifier for row to fetchResultSet
with zero or one row, depending on
the key usedjava.sql.SQLException
private java.sql.ResultSet fetch(java.lang.String colName, int key) throws java.sql.SQLException
colName
- name of the column to fetchkey
- identifier for row to fetchResultSet
with zero or one row, depending on
the key usedjava.sql.SQLException
private static java.lang.String holdabilityString(int holdability)
holdability
- an int
value representing a holdabilityString
value representing the same holdabilitypublic static void threeResultSets(java.sql.ResultSet[] rs1, java.sql.ResultSet[] rs2, java.sql.ResultSet[] rs3) throws java.sql.SQLException
testIsClosed()
(as a
stored procedure) to retrieve three result sets.rs1
- first result setrs2
- second result setrs3
- third result setjava.sql.SQLException
- if a database error occurspublic static void getResultSetWithHoldability(int holdability, java.sql.ResultSet[] rs) throws java.sql.SQLException
testGetHoldability()
(as a stored
procedure) to retrieve a result set with a given holdability.holdability
- requested holdabilityrs
- result set returned from stored procedurejava.sql.SQLException
- if a database error occurspublic void testDerby1368() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public void testDerby1368(boolean lengthless) throws java.sql.SQLException, java.io.IOException
lengthless
- Insert data with lengthless method.java.sql.SQLException
java.io.IOException
public void testJDBC4_1() throws java.lang.Exception
java.lang.Exception
private void vetDataTypeCount(java.sql.Connection conn) throws java.lang.Exception
java.lang.Exception
public static final java.sql.Blob makeBlob() throws java.lang.Exception
Function for making a Blob.
java.lang.Exception
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.