Provide configuration keywords
You can provide configuration keywords that the access method interrogates to tailor its behavior.
The user specifies one or more parameter choices in the USING clause of the CREATE TABLE statement. The access method calls the mi_tab_amparam() accessor function to retrieve the configuration keywords and values.
In the following example,
the access method checks the keyword value to determine if the user
wants mode set to the number of rows to store in a shared memory buffer.
The CREATE TABLE statement specifies the configuration keyword and
value between parentheses.
CREATE TABLE ...
IN sbspace
USING sbspace_access_method ("setbuffer=10")
In
the preceding statement, the mi_tab_amparam() function
returns setbuffer=10. The following figure shows
how the access method determines the value that the user specifies
and applies it to create the sbspace.
Figure 1. Checking a configuration parameter
value
mi_integer my_beginscan (sd)
MI_AM_SCAN_DESC *sd;
{
MI_AM_TABLE_DESC *td;
mi_integer nrows;
...
td=mi_scan_table(sd); /*Get table descriptor. */
/*Check for parameter.
** Do what the user specifies. */
if (mi_tab_amparam(td) != NULL)
{
/* Extract number of rows from string.
** Set nrows to that number. (not shown.)
*/
mi_tab_setniorows(nrows);
}
...
}
Important: If the access method accepts parameters,
describe them in the user guide for the access method. For example,
a description of the action in Figure 1 would explain how to
set a value in the parameter string "setbuffer=" and
describe how a buffer might improve performance.
A user
can specify multiple configuration parameters separated by commas,
as the following syntax shows:
CREATE TABLE ...
...
USING access_method_name (keyword='string', keyword='string' ...)