public class DatabaseMetaDataTest extends BaseJDBCTestCase
For a number of methods that return a ResultSet to determine the
attributes of SQL objects (e.g. getTables) two methods
are provided. A non-modify and a modify one.
The non-modify method tests that the getXXX method call works.
This can be used by other tests where issues have been seen
with database meta data, such as upgrade and read-only databases.
The non-modify means that the test method does not change the database
in order to test the return of the getXXX method is correct.
This test is also called from the upgrade tests to test that metadata continues to work at various points in the upgrade.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String[] |
BUILTIN_SCHEMAS
All the builtin schemas.
|
private static java.lang.String[] |
IDS
Six combinations of valid identifiers with mixed
case, to see how the various pattern matching
and returned values handle them.
|
private boolean |
modifiedDatabase
Did the test modifiy the database.
|
private static java.lang.String[][] |
NUMERIC_FUNCTIONS |
private java.lang.String |
schema
The schema used by the test.
|
private static java.lang.String[][] |
STRING_FUNCTIONS |
private static java.lang.String[][] |
SYSTEM_FUNCTIONS |
private static java.lang.String[][] |
TIMEDATE_FUNCTIONS |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
DatabaseMetaDataTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private java.lang.Object[][] |
appendArray(java.lang.Object[][] target,
java.lang.Object[][] suffix)
Append one two-dimensional array to another.
|
private void |
assertFullResultSet(java.sql.ResultSet[] rs,
java.lang.String[][] expRS,
boolean trim)
Helper method - unravels a ResultSet array created e.g.
|
private void |
assertFullUnorderedResultSet(java.sql.ResultSet[] rs,
java.lang.String[][] expRS,
boolean trim)
Helper method - unravels a ResultSet array created e.g.
|
private void |
assertGetImportedAndExportedKeysShape(java.sql.ResultSet[] rss)
Assert the shape of the ResultSets for getImportedKeys,
getExportedKeys and getCrossReference.
|
private void |
assertMatchesPattern(java.lang.String pattern,
java.lang.String result) |
static void |
assertMetaDataResultSet(java.sql.ResultSet rs,
java.lang.String[] columnNames,
int[] columnTypes,
boolean[] nullability) |
private void |
checkCatalogsShape(java.sql.ResultSet rs)
Check the shape of the ResultSet from any getCatlogs call.
|
private void |
checkColumnsShape(java.sql.ResultSet rs,
int odbc) |
private void |
checkGetTablesODBC(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String[] tableTypes)
Execute and check the ODBC variant of getTables which
uses a procedure to provide the same information to ODBC clients.
|
private void |
checkODBCKeys(java.lang.String pCatalog,
java.lang.String pSchema,
java.lang.String pTable,
java.lang.String fCatalog,
java.lang.String fSchema,
java.lang.String fTable)
Execute a call to the ODBC system procedure "SQLFOREIGNKEYS"
and verify the results by comparing them with the results of
an equivalent JDBC call (if one exists).
|
private void |
checkODBCKeysShape(java.sql.ResultSet rs)
Check the shape of the ResultSet from a call to the ODBC function
SQLForeignKeys.
|
static void |
checkSchemas(java.sql.ResultSet rs,
java.lang.String[] userExpected)
Check the returned information from a getSchemas().
|
private static void |
checkSchemasShape(java.sql.ResultSet rs)
Check the shape of the ResultSet from any
getSchemas call.
|
private void |
checkTablesShape(java.sql.ResultSet rs)
Check the shape of the ResultSet from any getTables call.
|
private static void |
checkVersionColumnsShape(java.sql.ResultSet[] rs)
Check the shape of the ResultSet from any
getVersionColumns call.
|
void |
concurrentCompilationTest()
Test that a meta-data query is compiled and stored correctly even when
there's a lock conflict that causes the first attempt to store it to
stop midway (DERBY-4160).
|
private void |
concurrentCompilationTestHelper(Barrier barrier,
java.sql.DatabaseMetaData dmd) |
private static junit.framework.Test |
connectionPoolingSuite(java.lang.String jdbcClient)
Returns a suite of tests to be run with connection pooling enabled.
|
private void |
createObjectsForKeysTests()
Create the tables for get*Keys tests
|
private void |
createObjectsForUDTTests()
Create objects needed to test the UDT-related metadata calls
|
private void |
createSchemasForTests() |
private int |
createTablesForTest(boolean skipXML)
Create a set of tables using the identifiers in IDS.
|
void |
crossCheckGetColumnRowAndResultSetMetaData(java.sql.ResultSet rs,
java.sql.ResultSetMetaData rsmdt,
int odbc)
Cross check a single row from getColumns() with ResultSetMetaData
for a SELECT * from the same table.
|
private void |
crossCheckGetColumnsAndResultSetMetaData(java.sql.ResultSet rs,
boolean partial,
int odbc)
Compare a ResultSet from getColumns() with ResultSetMetaData
returned from a SELECT * against the table.
|
private boolean |
doesMatch(java.lang.String pattern,
int pp,
java.lang.String result,
int rp)
See if a string matches the pattern as defined by
DatabaseMetaData.
|
private void |
dropObjectsForKeysTests()
Drop the database objects for get*Keys tests
|
private void |
dropObjectsForUDTTests()
Drop the objects needed for testing the UDT-related metadata methods
|
private void |
escapedFunctions(java.lang.String[][] specList,
java.lang.String metaDataList)
Check that the list of escaped functions provided by
the driver is a strict subet of the specified set,
the list does not contain duplicates, all the functions
listed can be executed and that if a function is not
in the list but is specified it cannot be executed.
|
private void |
executeEscaped(java.lang.String[] specDetails)
Test we can execute a function listed as a supported
JDBC escaped function.
|
private java.sql.ResultSet[] |
getBestRowIdentifier(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
int scope,
boolean nullable)
Helper method for testing getBestRowIdentifier - calls
dmd.getBestRowIdentifier for the JDBC call, and getBestRowIdentifierODBC
for the ODBC procedure
|
private java.sql.ResultSet |
getBestRowIdentifierODBC(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
int scope,
boolean nullable)
Helper method for testing getBestRowIdentifier - calls the ODBC procedure
|
private java.sql.ResultSet[] |
getColumnPrivileges(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String columnNamePattern)
Helper method for testing getColumnPrivileges - calls dmd.getIndexInfo for the
JDBC call, and getColumnPrivilegesODBC for the ODBC procedure
|
private java.sql.ResultSet |
getColumnPrivilegesODBC(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String columnNamePattern)
Helper method for testing getColumnPrivileges - calls the ODBC procedure
|
private java.sql.ResultSet[] |
getColumns(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern,
java.lang.String columnNamePattern)
Helper method for testing getColumns - calls dmd.getColumns for
the JDBC call, and getColumnsODBC for the ODBC procedure
|
private java.sql.ResultSet |
getColumnsODBC(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern,
java.lang.String columnNamePattern)
Implement ODBC equivalent for getColumns - SYSIBM.SQLCOLUMNS
|
private java.sql.ResultSet[] |
getCrossReference(java.lang.String parentcatalog,
java.lang.String parentschema,
java.lang.String parenttable,
java.lang.String foreigncatalog,
java.lang.String foreignschema,
java.lang.String foreigntable)
Helper method for testing getCrossReference - calls dmd.getCrossReference for
the JDBC call, and getCrossReferenceODBC for the ODBC procedure
|
private java.sql.ResultSet |
getCrossReferenceODBC(java.lang.String parentcatalog,
java.lang.String parentschema,
java.lang.String parenttable,
java.lang.String foreigncatalog,
java.lang.String foreignschema,
java.lang.String foreigntable)
Helper method for testing getCrossReference - calls the ODBC procedure
|
private Version |
getDataVersion(java.sql.Connection conn)
Get the version of the data in the database.
|
private java.sql.DatabaseMetaData |
getDMD() |
private java.sql.ResultSet |
getDMDTables(java.sql.DatabaseMetaData dmd,
java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String[] tableTypes)
Execute dmd.getTables() but perform additional checking
of the ODBC variant.
|
private java.sql.ResultSet[] |
getExportedKeys(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Helper method for testing getExportedKeys - calls dmd.getExportedKeys for
the JDBC call, and getExportedKeysODBC for the ODBC procedure
|
private java.sql.ResultSet |
getExportedKeysODBC(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Helper method for testing getExportedKeys - calls the ODBC procedure
|
private java.sql.ResultSet[] |
getImportedKeys(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Helper method for testing getImportedKeys - calls dmd.getImportedKeys for
the JDBC call, and getImportedKeysODBC for the ODBC procedure
|
private java.sql.ResultSet |
getImportedKeysODBC(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Helper method for testing getImportedKeys - calls the ODBC procedure
|
private java.sql.ResultSet[] |
getIndexInfo(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
boolean unique,
boolean approximate)
Helper method for testing getIndexInfo - calls dmd.getIndexInfo for the
JDBC call, and getIndexInfoODBC for the ODBC procedure
|
private java.sql.ResultSet |
getIndexInfoODBC(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
boolean unique,
boolean approximate)
Helper method for testing getIndexInfo - calls the ODBC procedure
|
static int |
getJDBCType(java.lang.String type)
Given a valid SQL type return the corresponding
JDBC type identifier from java.sql.Types.
|
private java.lang.String |
getPattern(java.util.Random rand,
java.lang.String[] dbIDS) |
private static void |
getpc(int a,
long b)
Overload getpc to further test getProcedureColumns
private method shouldn't be returned with alias, ok with procedure
|
static void |
getpc(int a,
long[] b)
Overload getpc to further test getProcedureColumns
|
static byte[] |
getpc(java.lang.String a,
java.math.BigDecimal b,
short c,
byte d,
short e,
int f,
long g,
float h,
double i,
byte[] j,
java.sql.Date k,
java.sql.Time l,
java.sql.Timestamp T)
Dummy method to test getProcedureColumns
|
void |
getpc(java.lang.String a,
java.lang.String b)
instance method for getProcedureColumns testing
with method alias, this should not be returned by getProcedureColumns
but DB2 returns this with a java procedure
|
static void |
getpc4a()
this method should notbe seen by getProcedureColumns as
it has no parameters and no return value.
|
static int |
getpc4b()
Check a method with no parameters and a return value works
for getProcedureColumns
|
static int |
getPrecision(int jdbcType,
java.lang.String type)
Given a valid SQL type return the corresponding
precision/length for this specific value
if the type is variable, e.g.
|
private java.sql.ResultSet[] |
getPrimaryKeys(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Helper method for testing getPrimaryKeys - calls dmd.getPrimaryKeys for
the JDBC call, and getPrimaryKeysODBC for the ODBC procedure
|
private java.sql.ResultSet |
getPrimaryKeysODBC(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Helper method for testing getPrimaryKeys - calls the ODBC procedure
|
private java.sql.ResultSet[] |
getProcedureColumns(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String procedureNamePattern,
java.lang.String columnNamePattern)
Helper method for testing getProcedureColumns - calls
dmd.getProcedureColumns for the JDBC call, and
getProcedureColumnssODBC for the ODBC procedure
|
private java.sql.ResultSet |
getProcedureColumnsODBC(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String procedureNamePattern,
java.lang.String columnNamePattern)
Helper method for testing getProcedureColumns - calls the ODBC procedure
|
private java.sql.ResultSet[] |
getProcedures(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String procedureNamePattern)
Helper method for testing getProcedures - calls dmd.getProcedures for
the JDBC call, and getProceduresODBC for the ODBC procedure
|
private java.sql.ResultSet |
getProceduresODBC(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String procedureNamePattern)
Helper method for testing getProcedures - calls the ODBC procedure
|
private java.lang.String[] |
getSortedIdentifiers()
Return the identifiers used to create schemas,
tables etc. in the order the database stores them.
|
static java.util.List<java.lang.String> |
getSQLTypes(java.sql.Connection conn)
Return a list of all valid supported datatypes as Strings
suitable for use in any SQL statement where a SQL type is
expected.
|
static java.lang.String |
getStoredIdentifier(java.lang.String sqlIdentifier) |
private java.sql.ResultSet[] |
getTablePrivileges(java.lang.String catalog,
java.lang.String schema,
java.lang.String tableNamePattern)
Helper method for testing getTablePrivileges - calls dmd.getIndexInfo for the
JDBC call, and getTablePrivilegesODBC for the ODBC procedure
|
private java.sql.ResultSet |
getTablePrivilegesODBC(java.lang.String catalog,
java.lang.String schema,
java.lang.String tableNamePattern)
Helper method for testing getTablePrivileges - calls the ODBC procedure
|
private java.sql.ResultSet[] |
getVersionColumns(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Helper method for testing getVersionColumns - calls
dmd.getVersionColumns for the JDBC call, and getVersionColumnsODBC for
the ODBC procedure
|
java.sql.ResultSet |
getVersionColumnsODBC(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Implement ODBC equivalent for getVersionColumns - SYSIBM.SQLCOLUMNS
|
private static java.lang.Integer |
i(int i)
Convert an
int to a java.lang.Integer . |
void |
initialCompilationTest()
Tests that a meta-data query is compiled and stored correctly even when
there's a lock on the system tables (DERBY-2584).
|
static void |
isro()
method used in testBugFixes, for testing nexted connection metadata
|
void |
recompileTimeoutTest()
Tests that we don't get an internal timeout when a meta-data statement
is recompiled because the size of the tables it queries has changed
(DERBY-3693).
|
protected void |
setUp()
Set the schema name to be used by the test.
|
static junit.framework.Test |
suite()
Default suite for running this test.
|
protected void |
tearDown()
Tear down this fixture, sub-classes should call
super.tearDown().
|
void |
test_jdbc4_1()
Test methods added by JDBC 4.1
|
void |
test_jdbc4_2()
Test methods added by JDBC 4.2
|
void |
testBugFixes() |
void |
testConnectionSpecific()
Methods that return information specific to
the current connection.
|
void |
testConstants()
This is not a test of Derby but JDBC constants for meta data
that this test depends on.
|
void |
testDataSourceLimits()
Test group of methods provides the limits imposed by a given data source
Methods start with
'getMax'.
|
void |
testDetermineFeatureSupport()
Test the methods that indicate if a feature
is supported or not.
|
void |
testDMDconnClosed()
Reading of DatabaseMetaData obtained earlier, after a connection
is closed.
|
void |
testGetBestRowIdentifier()
Test getBestRowIdentifier
|
void |
testGetColumnPrivileges()
Test getGetColumnPrivileges; does not modify database
For further testing see test lang.grantRevokeTest
|
void |
testGetColumns_DERBY5274()
getColumns() used to fail with a truncation error if an auto-increment
column had a start value or an increment that was very large (that is,
when its CHAR representation exceeded 12 characters).
|
void |
testGetColumnsModify()
Test getColumns() with modifying the database.
|
void |
testGetColumnsReadOnly()
Test getTableColumns().
|
void |
testGetFunctionColumns()
Test DatabaseMetaData.getFunctionColumns()
|
void |
testGetIndexInfo()
Test getIndexInfo; does not modify database
|
void |
testGetPrimaryKeys()
Test getPrimaryKeys; does modify database
|
void |
testGetProceduresGetProcColumns()
Test DatabaseMetaData.getProcedures and .getProcedureColumns,
Both for JDBC and ODBC.
|
void |
testGetSchemasModify()
Test getSchemas().
|
void |
testGetSchemasReadOnly()
Test getSchemas() without modifying the database.
|
void |
testGetTablePrivileges()
Test getGetTablePrivileges; does not modify database
For further testing see test lang.grantRevokeTest
|
void |
testGetTablesModify()
Test getTables() with modifying the database.
|
void |
testGetTablesReadOnly()
Test getTables() without modifying the database.
|
void |
testGetTypeInfo()
Test getTypeInfo
|
void |
testGetURL()
getURL() method.
|
void |
testGetXXportedKeys()
Test getImportedKeys, getExportedKeys, getCrossReference; modifies db
|
void |
testGetXXportedKeysODBC()
Execute and check the ODBC variant of getImported/Exported keys, which
uses the SQLFOREIGNKEYS system procedure to provide the same information
to ODBC clients.
|
void |
testIdentifierStorage()
Derby stores unquoted identifiers as upper
case and quoted ones as mixed case.
|
void |
testMiscellaneous() |
void |
testMoreGetIndexInfo()
Test getIndexInfo further; does modify database
|
void |
testNullInfo()
methods that return information about handling NULL.
|
void |
testNumericFunctions()
JDBC escaped numeric functions - JDBC 3.0 C.1
|
void |
testReferentialAction()
Test referential action values; modifies database
|
void |
testSQLKeywords()
Method getSQLKeywords, returns list of SQL keywords
that are not defined by SQL92.
|
void |
testStringFunctions()
JDBC escaped string functions - JDBC 3.0 C.2
|
void |
testSystemFunctions()
JDBC escaped system functions - JDBC 3.0 C.4
|
void |
testTableTypes()
Test getTableTypes()
|
void |
testTimeDataFunctions()
JDBC escaped date time functions - JDBC 3.0 C.3
|
void |
testUDTs()
Test UDT-related metadata methods.
|
void |
testUnimplementedSQLObjectAttributes()
Test methods that describe attributes of SQL Objects
that are not supported by derby.
|
void |
testVersionInfo()
Methods that describe the version of the
driver and database.
|
void |
verifyBRIResults(java.sql.ResultSet[] rss,
java.lang.String[][] expRS)
helper method for test testGetBestRowIdentifier
|
void |
verifyReferentialAction(java.sql.ResultSet[] rs,
short[] expRes) |
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 java.lang.String[][] NUMERIC_FUNCTIONS
private static final java.lang.String[][] TIMEDATE_FUNCTIONS
private static final java.lang.String[][] SYSTEM_FUNCTIONS
private static final java.lang.String[][] STRING_FUNCTIONS
private boolean modifiedDatabase
private java.lang.String schema
Added to avoid other tests interfering with our metadata queries. Configured by running the test with a specific user, i.e. use TestConfiguration.changeUserDecorator(junit.framework.Test, java.lang.String, java.lang.String).
private static final java.lang.String[] IDS
private static final java.lang.String[] BUILTIN_SCHEMAS
protected void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
protected void tearDown() throws java.lang.Exception
BaseJDBCTestCase
tearDown
in class BaseJDBCTestCase
java.lang.Exception
public static junit.framework.Test suite()
private static junit.framework.Test connectionPoolingSuite(java.lang.String jdbcClient)
jdbcClient
- name of the client being used (for verbosity only)private java.lang.String[] getSortedIdentifiers()
private java.sql.DatabaseMetaData getDMD() throws java.sql.SQLException
java.sql.SQLException
public void initialCompilationTest() throws java.sql.SQLException
getIndexInfo
must not have been
prepared and stored in SYS.SYSSTATEMENTS
).java.sql.SQLException
public void concurrentCompilationTest() throws java.lang.Exception
java.lang.Exception
private void concurrentCompilationTestHelper(Barrier barrier, java.sql.DatabaseMetaData dmd) throws java.lang.Exception
java.lang.Exception
public void recompileTimeoutTest() throws java.sql.SQLException
java.sql.SQLException
public void testDetermineFeatureSupport() throws java.sql.SQLException
java.sql.SQLException
public void testDataSourceLimits() throws java.sql.SQLException
java.sql.SQLException
public void testMiscellaneous() throws java.sql.SQLException
java.sql.SQLException
public void testVersionInfo() throws java.sql.SQLException
java.sql.SQLException
public void testGetURL() throws java.sql.SQLException
java.sql.SQLException
public void testIdentifierStorage() throws java.sql.SQLException
java.sql.SQLException
public void testNullInfo() throws java.sql.SQLException
java.sql.SQLException
public void testSQLKeywords() throws java.sql.SQLException
java.sql.SQLException
public void testConnectionSpecific() throws java.sql.SQLException
java.sql.SQLException
public void testConstants()
public void testUDTs() throws java.lang.Exception
java.lang.Exception
private void createObjectsForUDTTests() throws java.sql.SQLException
java.sql.SQLException
private void dropObjectsForUDTTests() throws java.sql.SQLException
java.sql.SQLException
public void testUnimplementedSQLObjectAttributes() throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet getVersionColumnsODBC(java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
catalog
- schema
- table
- java.sql.SQLException
private java.sql.ResultSet[] getVersionColumns(java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
catalog
- schema
- table
- java.sql.SQLException
public static java.lang.String getStoredIdentifier(java.lang.String sqlIdentifier)
public void testGetSchemasReadOnly() throws java.sql.SQLException
java.sql.SQLException
public void testGetSchemasModify() throws java.sql.SQLException
java.sql.SQLException
private void createSchemasForTests() throws java.sql.SQLException
java.sql.SQLException
public static void checkSchemas(java.sql.ResultSet rs, java.lang.String[] userExpected) throws java.sql.SQLException
rs
- userExpected
- java.sql.SQLException
private static void checkSchemasShape(java.sql.ResultSet rs) throws java.sql.SQLException
rs
- result setjava.sql.SQLException
private java.sql.ResultSet getDMDTables(java.sql.DatabaseMetaData dmd, java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String[] tableTypes) throws java.sql.SQLException, java.io.IOException
dmd
- catalog
- schema
- table
- tableTypes
- java.sql.SQLException
java.io.IOException
public void testGetTablesReadOnly() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public void testGetTablesModify() throws java.lang.Exception
java.sql.SQLException
java.io.IOException
java.lang.Exception
private void checkGetTablesODBC(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String[] tableTypes) throws java.sql.SQLException, java.io.IOException
catalog
- schema
- table
- tableTypes
- java.sql.SQLException
java.io.IOException
private int createTablesForTest(boolean skipXML) throws java.lang.Exception
skipXML
- true if tables with the XML column should not
be created.java.sql.SQLException
java.lang.Exception
public void testGetColumnsReadOnly() throws java.lang.Exception
java.lang.Exception
public void testGetColumnsModify() throws java.lang.Exception
java.sql.SQLException
java.lang.Exception
private void assertMatchesPattern(java.lang.String pattern, java.lang.String result)
private boolean doesMatch(java.lang.String pattern, int pp, java.lang.String result, int rp)
pattern
- Patternpp
- Position in pattern to start the actual pattern fromresult
- result stringrp
- position in result to starting checkingprivate java.lang.String getPattern(java.util.Random rand, java.lang.String[] dbIDS)
private void crossCheckGetColumnsAndResultSetMetaData(java.sql.ResultSet rs, boolean partial, int odbc) throws java.lang.Exception
rs
- resultset to crossCheckpartial
- used to indicate if ordinal position should get checkedodbc
- - flag to indicate if this was a resultset obtained
from a JDBC (0) or ODBC (1) call.java.sql.SQLException
java.lang.Exception
public void crossCheckGetColumnRowAndResultSetMetaData(java.sql.ResultSet rs, java.sql.ResultSetMetaData rsmdt, int odbc) throws java.lang.Exception
rs
- ResultSet from getColumns already positioned on the row.rsmdt
- ResultSetMetaData for the SELECT *odbc
- 0 for JDBC call, 1 for ODBC. Needed to allow for difference
in using BUFFER_LENGTH (ODBC) or no(JDBC).java.sql.SQLException
java.lang.Exception
private java.sql.ResultSet getColumnsODBC(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String columnNamePattern) throws java.sql.SQLException
catalog
- schemaPattern
- tableNamePattern
- columnNamePattern
- java.sql.SQLException
private java.sql.ResultSet[] getColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String columnNamePattern) throws java.sql.SQLException
catalog
- schemaPattern
- tableNamePattern
- columnNamePattern
- java.sql.SQLException
public void testTableTypes() throws java.sql.SQLException
java.sql.SQLException
public void testGetTypeInfo() throws java.lang.Exception
java.lang.Exception
private void checkColumnsShape(java.sql.ResultSet rs, int odbc) throws java.sql.SQLException
java.sql.SQLException
private void checkTablesShape(java.sql.ResultSet rs) throws java.sql.SQLException
rs
- java.sql.SQLException
private void checkCatalogsShape(java.sql.ResultSet rs) throws java.sql.SQLException
rs
- java.sql.SQLException
private static void checkVersionColumnsShape(java.sql.ResultSet[] rs) throws java.sql.SQLException
rs
- java.sql.SQLException
public static void assertMetaDataResultSet(java.sql.ResultSet rs, java.lang.String[] columnNames, int[] columnTypes, boolean[] nullability) throws java.sql.SQLException
java.sql.SQLException
public void testNumericFunctions() throws java.sql.SQLException
java.sql.SQLException
public void testStringFunctions() throws java.sql.SQLException
java.sql.SQLException
public void testTimeDataFunctions() throws java.sql.SQLException
java.sql.SQLException
public void testSystemFunctions() throws java.sql.SQLException
java.sql.SQLException
private void escapedFunctions(java.lang.String[][] specList, java.lang.String metaDataList) throws java.sql.SQLException
specList
- metaDataList
- java.sql.SQLException
private void executeEscaped(java.lang.String[] specDetails) throws java.sql.SQLException
specDetails
- java.sql.SQLException
public static java.util.List<java.lang.String> getSQLTypes(java.sql.Connection conn) throws java.sql.SQLException
conn
- current connectionjava.sql.SQLException
public static int getJDBCType(java.lang.String type)
type
- public static int getPrecision(int jdbcType, java.lang.String type)
jdbcType
- type
- public void testGetXXportedKeysODBC() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
private void checkODBCKeys(java.lang.String pCatalog, java.lang.String pSchema, java.lang.String pTable, java.lang.String fCatalog, java.lang.String fSchema, java.lang.String fTable) throws java.sql.SQLException, java.io.IOException
pCatalog
- pSchema
- pTable
- fCatalog
- fSchema
- fTable
- java.sql.SQLException
java.io.IOException
private void checkODBCKeysShape(java.sql.ResultSet rs) throws java.sql.SQLException
rs
- java.sql.SQLException
public void testGetBestRowIdentifier() throws java.sql.SQLException
java.sql.SQLException
private java.sql.ResultSet getBestRowIdentifierODBC(java.lang.String catalog, java.lang.String schema, java.lang.String table, int scope, boolean nullable) throws java.sql.SQLException
catalog
- schema
- table
- scope
- nullable
- java.sql.SQLException
private java.sql.ResultSet[] getBestRowIdentifier(java.lang.String catalog, java.lang.String schema, java.lang.String table, int scope, boolean nullable) throws java.sql.SQLException
catalog
- schema
- table
- scope
- nullable
- java.sql.SQLException
public void verifyBRIResults(java.sql.ResultSet[] rss, java.lang.String[][] expRS) throws java.sql.SQLException
rss
- - ResultSet array from getBestRowIdentifier;
rss[0] will have the JDBC result, rss[1] the ODBC resultexpRS
- - bi-dimensional String array with expected result row(s)java.sql.SQLException
public void testGetColumnPrivileges() throws java.sql.SQLException
java.sql.SQLException
private java.sql.ResultSet getColumnPrivilegesODBC(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String columnNamePattern) throws java.sql.SQLException
catalog
- schema
- table
- columnNamePattern
- java.sql.SQLException
private java.sql.ResultSet[] getColumnPrivileges(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String columnNamePattern) throws java.sql.SQLException
catalog
- schema
- table
- columnNamePattern
- java.sql.SQLException
public void testGetTablePrivileges() throws java.sql.SQLException
java.sql.SQLException
private java.sql.ResultSet getTablePrivilegesODBC(java.lang.String catalog, java.lang.String schema, java.lang.String tableNamePattern) throws java.sql.SQLException
catalog
- schema
- tableNamePattern
- java.sql.SQLException
private java.sql.ResultSet[] getTablePrivileges(java.lang.String catalog, java.lang.String schema, java.lang.String tableNamePattern) throws java.sql.SQLException
catalog
- schema
- tableNamePattern
- java.sql.SQLException
public void testGetIndexInfo() throws java.sql.SQLException
java.sql.SQLException
public void testMoreGetIndexInfo() throws java.sql.SQLException
java.sql.SQLException
private java.sql.ResultSet getIndexInfoODBC(java.lang.String catalog, java.lang.String schema, java.lang.String table, boolean unique, boolean approximate) throws java.sql.SQLException
catalog
- schema
- table
- approximate
- unique
- java.sql.SQLException
private java.sql.ResultSet[] getIndexInfo(java.lang.String catalog, java.lang.String schema, java.lang.String table, boolean unique, boolean approximate) throws java.sql.SQLException
catalog
- schema
- table
- unique
- approximate
- java.sql.SQLException
private void assertFullResultSet(java.sql.ResultSet[] rs, java.lang.String[][] expRS, boolean trim) throws java.sql.SQLException
rs
- expRS
- trim
- java.sql.SQLException
private void assertFullUnorderedResultSet(java.sql.ResultSet[] rs, java.lang.String[][] expRS, boolean trim) throws java.sql.SQLException
rs
- expRS
- trim
- java.sql.SQLException
private void createObjectsForKeysTests() throws java.sql.SQLException
java.sql.SQLException
private void dropObjectsForKeysTests() throws java.sql.SQLException
java.sql.SQLException
public void testGetPrimaryKeys() throws java.sql.SQLException
java.sql.SQLException
private java.sql.ResultSet getPrimaryKeysODBC(java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
catalog
- schema
- table
- java.sql.SQLException
private java.sql.ResultSet[] getPrimaryKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
catalog
- schema
- table
- java.sql.SQLException
public void testGetXXportedKeys() throws java.sql.SQLException
java.sql.SQLException
private java.sql.ResultSet getImportedKeysODBC(java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
catalog
- schema
- table
- java.sql.SQLException
private java.sql.ResultSet[] getImportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
catalog
- schema
- table
- java.sql.SQLException
private void assertGetImportedAndExportedKeysShape(java.sql.ResultSet[] rss) throws java.sql.SQLException
rss
- ResultSets from JDBC and ODBC calls.java.sql.SQLException
private java.sql.ResultSet getExportedKeysODBC(java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
catalog
- schema
- table
- java.sql.SQLException
private java.sql.ResultSet[] getExportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
catalog
- schema
- table
- java.sql.SQLException
private java.sql.ResultSet getCrossReferenceODBC(java.lang.String parentcatalog, java.lang.String parentschema, java.lang.String parenttable, java.lang.String foreigncatalog, java.lang.String foreignschema, java.lang.String foreigntable) throws java.sql.SQLException
parentcatalog
- parentschema
- parenttable
- foreigncatalog
- foreignschema
- foreigntable
- java.sql.SQLException
private java.sql.ResultSet[] getCrossReference(java.lang.String parentcatalog, java.lang.String parentschema, java.lang.String parenttable, java.lang.String foreigncatalog, java.lang.String foreignschema, java.lang.String foreigntable) throws java.sql.SQLException
parentcatalog
- parentschema
- parenttable
- foreigncatalog
- foreignschema
- foreigntable
- java.sql.SQLException
public void testReferentialAction() throws java.sql.SQLException
java.sql.SQLException
public void verifyReferentialAction(java.sql.ResultSet[] rs, short[] expRes) throws java.sql.SQLException
java.sql.SQLException
public void testGetProceduresGetProcColumns() throws java.lang.Exception
java.lang.Exception
private java.lang.Object[][] appendArray(java.lang.Object[][] target, java.lang.Object[][] suffix)
target
- suffix
- private java.sql.ResultSet getProceduresODBC(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern) throws java.sql.SQLException
catalog
- schemaPattern
- procedureNamePattern
- java.sql.SQLException
private java.sql.ResultSet[] getProcedures(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern) throws java.sql.SQLException
catalog
- schemaPattern
- procedureNamePattern
- java.sql.SQLException
private java.sql.ResultSet getProcedureColumnsODBC(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern, java.lang.String columnNamePattern) throws java.sql.SQLException
catalog
- schemaPattern
- procedureNamePattern
- columnNamePattern
- java.sql.SQLException
private java.sql.ResultSet[] getProcedureColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern, java.lang.String columnNamePattern) throws java.sql.SQLException
catalog
- schemaPattern
- procedureNamePattern
- columnNamePattern
- java.sql.SQLException
public void testGetFunctionColumns() throws java.lang.Exception
java.lang.Exception
private static java.lang.Integer i(int i)
int
to a java.lang.Integer
.i
- public void test_jdbc4_1() throws java.lang.Exception
java.lang.Exception
public void test_jdbc4_2() throws java.lang.Exception
java.lang.Exception
public void testBugFixes() throws java.sql.SQLException
java.sql.SQLException
public static void isro() throws java.sql.SQLException
java.sql.SQLException
public void testGetColumns_DERBY5274() throws java.sql.SQLException
java.sql.SQLException
public static byte[] getpc(java.lang.String a, java.math.BigDecimal b, short c, byte d, short e, int f, long g, float h, double i, byte[] j, java.sql.Date k, java.sql.Time l, java.sql.Timestamp T)
a
- b
- k
- c
- e
- d
- f
- g
- j
- i
- l
- h
- T
- j
byte arraypublic static void getpc(int a, long[] b)
a
- b
- private static void getpc(int a, long b)
a
- b
- public void getpc(java.lang.String a, java.lang.String b)
a
- b
- public static void getpc4a()
public static int getpc4b()
public void testDMDconnClosed() throws java.sql.SQLException
java.sql.SQLException
private Version getDataVersion(java.sql.Connection conn) throws java.lang.Exception
Get the version of the data in the database.
conn
- the current connectionjava.lang.Exception
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.