public class ConsistencyChecker
extends java.lang.Object
This class can only be used within an SQL-J statement, a Java procedure or a server side Java method.
This class can be accessed using the class alias CONSISTENCYCHECKER
in SQL-J statements.
Modifier | Constructor | Description |
---|---|---|
private |
ConsistencyChecker() |
no requirement for a constructor
|
Modifier and Type | Method | Description |
---|---|---|
static boolean |
checkTable(java.lang.String schemaName,
java.lang.String tableName) |
Check the named table, ensuring that all of its indexes are consistent
with the base table.
|
public static boolean checkTable(java.lang.String schemaName, java.lang.String tableName) throws java.sql.SQLException
When tables are consistent, the method returns true. Otherwise, the method throws an exception.
To check the consistency of a single table:
VALUES ConsistencyChecker::checkTable(SchemaName, TableName)
For example, to check the consistency of the table APP.Flights:
VALUES ConsistencyChecker::checkTable('APP', 'FLIGHTS')
To check the consistency of all of the tables in the 'APP' schema, stopping at the first failure:
SELECT tablename, ConsistencyChecker::checkTable(
'APP', tablename)
FROM sys.sysschemas s, sys.systables t
WHERE s.schemaname = 'APP' AND s.schemaid = t.schemaid
To check the consistency of an entire database, stopping at the first failure:
SELECT schemaname, tablename,
ConsistencyChecker::checkTable(schemaname, tablename)
FROM sys.sysschemas s, sys.systables t
WHERE s.schemaid = t.schemaid
schemaName
- The schema name of the table.tableName
- The name of the tablejava.sql.SQLException
- Thrown if some inconsistency
is found, or if some unexpected
exception is thrown..Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.