By default, the database server places one entry in shared memory per call to the am_insert() purpose function for a CREATE INDEX statement. The purpose function inserts the single entry and then returns control to the database server, which executes am_insert again until no more entries remain to insert.
Figure 8 shows how the am_insert purpose function writes multiple new index entries.
mi_integer my_am_open(MI_AM_TABLE_DESC *td)
{
...
mi_tab_setniorows(td, 512);
}
mi_integer my_am_insert(MI_AM_TABLE_DESC *td, MI_ROW *newrow,
MI_AM_ROWID_DESC *rid)
{
mi_integernrows;
mi_integerrowid;
mi_integerfragid;
nrows = mi_tab_niorows(td);
if (nrows > 0)
{
for (row = 0; row < nrows; ++row)
{
mi_tab_nextrow(td, &newrow, &rowid, &fragid)
/*Write new entry. (Not shown.)*/
} /* End get new entries from shared memory */
}
else
{/* Shared memory contains only one entry per call to am_insert.*/
rowid = mi_id_rowid(rid);
fragid = mi_id_fragid(rid);
/*Write new entry. (Not shown.)*/
}/* End write one index entry. */
/* Return either MI_OK or MI_ERROR, as required.
** (This example does not show error or exception-processing.) */
}In Figure 8, the access method performs the following steps:
The number of rows that shared memory actually contains might not equal the number of rows that mi_tab_setniorows() set.
For more information about mi_tab_setniorows(), mi_tab_niorows(), and mi_tab_nextrow(), refer to Descriptor Function Reference.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]