public class StatementTest extends BaseJDBCTestCase
Modifier and Type | Class and Description |
---|---|
static class |
StatementTest.StatementWrapper
This wrapper is used to expose JDBC 4.2 methods which can run on
VM rev levels lower than Java 8.
|
Modifier and Type | Field and Description |
---|---|
private java.sql.Statement |
stmt
Default statement used by the tests.
|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
StatementTest(java.lang.String name)
Create a new test with the given name.
|
Modifier and Type | Method and Description |
---|---|
private static void |
createBatch(StatementTest.StatementWrapper sw) |
private static void |
largeBatchTest(StatementTest.StatementWrapper sw,
long rowCountBase) |
private static void |
largeBatchUpdateExceptionTest(StatementTest.StatementWrapper sw,
long rowCountBase) |
private static void |
largeMaxRowsTest(StatementTest.StatementWrapper sw,
long maxRows) |
static void |
largeUpdate_jdbc4_2(java.sql.Connection conn) |
private static void |
largeUpdateTest(StatementTest.StatementWrapper sw,
long rowCountBase) |
private static void |
largeUpdateTest(StatementTest.StatementWrapper sw,
long rowCountBase,
long rowCount) |
static void |
setRowCountBase(long newBase)
Set the base which is used for returned row counts and fetched row counters
|
static void |
setRowCountBase(java.sql.Statement stmt,
boolean onClient,
long rowCountBase) |
protected void |
setUp()
Create default connection and statement.
|
private static int[] |
squashLongs(long[] longs) |
static junit.framework.Test |
suite()
Create test suite for StatementTest.
|
protected void |
tearDown()
Close default connection and statement if necessary.
|
void |
test_jdbc4_1_queryTimeoutException()
Test that Statement.setQueryTimeout() causes statements to
raise SQLTimeoutException per the JDBC 4.1 spec clarification.
|
void |
testCompletionClosure_jdbc4_1_implicitRSClosure()
Test the closeOnCompletion() and isCloseOnCompletion() methods
when using ResultSets which close implicitly.
|
void |
testIsClosedBasic()
Check that
isClosed returns true after
the statement has been explicitly closed. |
void |
testIsClosedWhenClosingConnection()
Test that the two statements created on the connection are closed
when the connection itself is closed.
|
void |
testIsClosedWhenClosingConnectionInInvalidState()
Check the state of the statement when the connection is first attempted
closed when in an invalid transaction state, then closed after a
commit.
|
void |
testIsClosedWithTwoStatementsOnSameConnection()
Test that creating two statements on the same connection does not
cause side effects on the statements.
|
void |
testIsNotWrapperForCallableStatement() |
void |
testIsNotWrapperForPreparedStatement() |
void |
testIsNotWrapperForResultSet() |
void |
testIsWrapperForStatement() |
void |
testLargeUpdate_jdbc4_2()
Test the large update methods added by JDBC 4.2.
|
void |
testPoolable()
Tests isPoolable, setPoolable, and the default poolability.
|
void |
testStatementExecuteAfterConnectionClose()
Execute a query on a statement after the parent connection has been
closed.
|
void |
testUnwrapCallableStatement() |
void |
testUnwrapPreparedStatement() |
void |
testUnwrapResultSet() |
void |
testUnwrapStatement() |
private static void |
truncate(StatementTest.StatementWrapper sw) |
private static void |
vetUpdateSize(StatementTest.StatementWrapper sw,
int expected,
int actual,
long longAnswer) |
private static void |
vetUpdateSize(StatementTest.StatementWrapper sw,
long expected,
long actual,
long longAnswer) |
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
public StatementTest(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
- if setAutoCommit, createStatement or
BaseJDBCTestCase.getConnection fails.protected void tearDown() throws java.lang.Exception
tearDown
in class BaseJDBCTestCase
java.sql.SQLException
- if a database access exception occurs.java.lang.Exception
public void testIsClosedBasic() throws java.sql.SQLException
isClosed
returns true
after
the statement has been explicitly closed.java.sql.SQLException
public void testIsClosedWithTwoStatementsOnSameConnection() throws java.sql.SQLException
java.sql.SQLException
public void testIsClosedWhenClosingConnection() throws java.sql.SQLException
java.sql.SQLException
public void testIsClosedWhenClosingConnectionInInvalidState() throws java.sql.SQLException
java.sql.SQLException
public void testStatementExecuteAfterConnectionClose() throws java.sql.SQLException
java.sql.SQLException
public void testIsWrapperForStatement() throws java.sql.SQLException
java.sql.SQLException
public void testIsNotWrapperForPreparedStatement() throws java.sql.SQLException
java.sql.SQLException
public void testIsNotWrapperForCallableStatement() throws java.sql.SQLException
java.sql.SQLException
public void testIsNotWrapperForResultSet() throws java.sql.SQLException
java.sql.SQLException
public void testUnwrapStatement() throws java.sql.SQLException
java.sql.SQLException
public void testUnwrapPreparedStatement()
public void testUnwrapCallableStatement()
public void testUnwrapResultSet() throws java.sql.SQLException
java.sql.SQLException
public void testPoolable() throws java.sql.SQLException
java.sql.SQLException
public void test_jdbc4_1_queryTimeoutException() throws java.lang.Exception
java.lang.Exception
public void testCompletionClosure_jdbc4_1_implicitRSClosure() throws java.lang.Exception
java.lang.Exception
public void testLargeUpdate_jdbc4_2() throws java.lang.Exception
java.lang.Exception
public static void largeUpdate_jdbc4_2(java.sql.Connection conn) throws java.lang.Exception
java.lang.Exception
private static void largeUpdateTest(StatementTest.StatementWrapper sw, long rowCountBase) throws java.lang.Exception
java.lang.Exception
private static void largeUpdateTest(StatementTest.StatementWrapper sw, long rowCountBase, long rowCount) throws java.lang.Exception
java.lang.Exception
private static void vetUpdateSize(StatementTest.StatementWrapper sw, int expected, int actual, long longAnswer) throws java.lang.Exception
java.lang.Exception
private static void vetUpdateSize(StatementTest.StatementWrapper sw, long expected, long actual, long longAnswer) throws java.lang.Exception
java.lang.Exception
private static void largeBatchTest(StatementTest.StatementWrapper sw, long rowCountBase) throws java.lang.Exception
java.lang.Exception
private static void createBatch(StatementTest.StatementWrapper sw) throws java.lang.Exception
java.lang.Exception
private static void largeMaxRowsTest(StatementTest.StatementWrapper sw, long maxRows) throws java.lang.Exception
java.lang.Exception
private static void largeBatchUpdateExceptionTest(StatementTest.StatementWrapper sw, long rowCountBase) throws java.lang.Exception
java.lang.Exception
public static void setRowCountBase(java.sql.Statement stmt, boolean onClient, long rowCountBase) throws java.lang.Exception
java.lang.Exception
private static void truncate(StatementTest.StatementWrapper sw) throws java.lang.Exception
java.lang.Exception
private static int[] squashLongs(long[] longs)
public static junit.framework.Test suite()
public static void setRowCountBase(long newBase)
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.