The am_check purpose function

If a user executes the oncheck utility for a virtual table, the database server calls am_check.

Syntax

mi_integer am_check(MI_AM_TABLE_DESC *tableDesc,
   mi_integer option)
tableDesc
Points to the table descriptor of the table that the current oncheck command specifies.
option
Contains an encoded version of the current command-line option string for the oncheck utility.

Usage

A user, generally a system administrator or operator, runs the oncheck utility to verify physical data structures. The options that follow the oncheck command indicate the kind of checking to perform.

In response to an oncheck command, the database server calls the am_check purpose function, which checks the internal consistency of the table and returns a success or failure indicator. If appropriate, am_check can call the am_open and am_close purpose functions.

To determine the exact contents of the command line, pass the option argument to the following Virtual-Table Interface (VTI) macros. Each macro returns a value of MI_TRUE if the option includes the particular -c or -p qualifier that the following table shows.
Table 1. Virtual-Table Interface (VTI) macros

This table lists macros, -c or -p qualifiers, and an explanation of the resulting oncheck command action.

Macro Option oncheck action
MI_CHECK_DATA() MI_DISPLAY_DATA() -cd -pd Checks and displays data rows, but not simple or smart large objects
MI_CHECK_DATA_BLOBS() MI_DISPLAY_DATA_BLOBS() -cD -pD Checks and displays data rows, simple large objects, and smart-large-object metadata
MI_CHECK_EXTENTS() MI_DISPLAY_EXTENTS() -ce -pe Checks and displays chunks and extents, including sbspaces
MI_DISPLAY_TPAGES() -pp Checks and displays pages by table or fragment
MI_DISPLAY_CPAGES() -pP Checks and displays pages by chunk
MI_DISPLAY_SPACE() -pt Checks and displays space usage
The am_check purpose function executes each macro that it needs until one of them returns MI_TRUE. For example, the following syntax tests for oncheck option -cD demonstrate:
if (MI_CHECK_EXTENTS(option) == MI_TRUE)
{
   /* Check rows and smart-large-object metadata 
    * If problem exists, issue message.      */
}

Check and display table state

The access method can call accessor function mi_tab_spacetype() to determine whether the specified table resides in an sbspace or extspace. If the data resides in an sbspace, the am_check purpose function can duplicate the expected behavior of the oncheck utility.

For an extspace, such as a file that the operating system manages, am_check performs tasks that correspond to the command-line option.

To provide detailed information about the state of the table, am_check can call the mi_tab_check_msg() function.

Return values

MI_OK
Validates the table structure as error free.
MI_ERROR
Indicates the access method could not validate the table structure as error free.