Top Description Constructors Methods
org.apache.derby.iapi.db

public Class ConsistencyChecker

extends Object
Class Inheritance
Imports
org.apache.derby.shared.common.error.StandardException, .PublicAPI, org.apache.derby.iapi.security.Securable, .SecurityUtil, org.apache.derby.iapi.sql.dictionary.DataDictionary, .SchemaDescriptor, .TableDescriptor, .ColumnDescriptor, .ColumnDescriptorList, .ConstraintDescriptor, .ConstraintDescriptorList, .ConglomerateDescriptor, org.apache.derby.iapi.sql.execute.ExecRow, .ExecutionFactory, org.apache.derby.iapi.types.DataValueDescriptor, .DataValueFactory, .RowLocation, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, .ConnectionUtil, org.apache.derby.iapi.store.access.TransactionController, .ScanController, .ConglomerateController, .RowUtil, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.io.FormatableBitSet, java.sql.SQLException

The ConsistencyChecker class provides static methods for verifying the consistency of the data stored within a database.

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.

Constructor Summary

AccessConstructor and Description
private
ConsistencyChecker()

no requirement for a constructor

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true, if the table is consistent, exception thrown if inconsistent
checkTable
(String
The schema name of the table.
schemaName
,
String
The name of the table
tableName
)

Check the named table, ensuring that all of its indexes are consistent with the base table.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConsistencyCheckerback to summary
private ConsistencyChecker()

no requirement for a constructor

Method Detail

checkTableback to summary
public static boolean checkTable(String schemaName, String tableName) throws SQLException

Check the named table, ensuring that all of its indexes are consistent with the base table. Use this method only within an SQL-J statement; do not call it directly.

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

Parameters
schemaName:String

The schema name of the table.

tableName:String

The name of the table

Returns:boolean

true, if the table is consistent, exception thrown if inconsistent

Exceptions
SQLException:
Thrown if some inconsistency is found, or if some unexpected exception is thrown..