Cartridge API - Deferrred Error Handling¶
The scanctx_cache package¶
The functions/procedures of this package operate in the scope of searches started in the current database session. The scanctx_cache package can be used to query scan contexts, which are PL/SQL objects holding information on the context of executing a JCC operator during a SQL statement execution. They are defined as follows
The arguments attribute returns the SCAN_ARGUMENTS is defined as follows:
The execution of each JCC operator in a given SQL statement has its own scan context. A maximum of 200 scan contexts are cached by database sessions allowing for 200 JCC operators in a single SQL statement. The notion of scan context is extended here to mean both domain scan access and filtering/functional access by a JCC operator. The get_scanctxs function returns all cached scan contexts. The function get_scan_context(scanId number) returns a scan context having the specified scan id. The scan context cache can be cleared with clear().
Examples:
-
To return all cached scan contexts:
-
To return one particular scan context:
-
For the following SQL:
two scan contexts will be created. They will differ in
- the
baseTableNameattribute (it will be 'A' for one and 'B' for the other)
- the
indexNameattribute (assuming that the JChem indexes on both a.structure and b.structure were created in the same schema, in which case they will necessarily have to differ)
- the first element of the arguments attribute (one will be 'Brc1ccccc1', the other will be 'Clc1ccccc1').
- the
To retrieve the scan context id for the first operator an SQL similar to the following can be used:
The error_cache package¶
The functions/procedures of this package operate in the scope of searches started in the current database session.
The get_error_count function can be used to query the number of cached error records. Error records are PL/SQL objects holding information about an error. They are defined as follows:
Error records are cached until they are accessed or until clear() is called. Cached error records can be accessed through the t_get_errors(scanId number := null) function. Leaving the scanId parameter at its default value, all cached errors are returned (and removed from the cache). If the scanId parameter is specified, error records associated with the corresponding scan contexts are returned (and removed from the cache).
Example:
The following statement can be used to retrieve all attributes of all cached error records:
Error table during index creation and rebuild¶
During index creation and rebuild with haltOnError parameter set to "n" or "nf", the error messages can be logged into an error table. To do this, set the errorTableName parameter to the name of the error table. The columns of the error table are the following:
If the error table doesn't exist in case of an error, the table is created. If there is an error during inserting the error row into the error table for some reason, the table will NOT be dropped and no data will be lost, and the error still can be searched in the log. If there is a problem with the error table inserts (e.g. different table structure than expected), it will be added to the log file, but doesn't throw exception (to be in harmony with the haltOnError parameter).
Example: