Activate automatic controls in sbspaces

The following advantages apply to data that are in sbspaces:
  • A database server administrator can back up and restore sbspaces with standard HCL Informix® utilities.
  • The database server automatically provides for locking.
  • If a transaction fails, the database server automatically rolls back sbspace metadata activity.
If logging is turned on for the smart large object, the database server does the following:
  • Logs transaction activity
  • Rolls back uncommitted activity if a transaction fails
You can either advise the end user to set logging on with the onspaces utility or call the appropriate DataBlade® API functions to set logging.
Important: To provide transaction integrity, it is recommended that the access method require transaction logging in sbspaces. It is also recommended that the access method raise an error if an end user attempts to create a virtual index in an unlogged sbspace.

In the access-method user guide, provide the correct information to describe transaction logging using the access method. If the access method does not turn on transaction logging, the user guide should explain how to turn on logging for a virtual index in an sbspace.

To enable logging, the access method sets the MI_LO_ATTR_LOG create-time constant with the DataBlade API mi_lo_create() or mi_lo_alter() function. The following example attempts to set the constant that turns on logging and verifies that the setting succeeded:
mi_integer status;.
status = mi_lo_specset_flags(lo_spec_p, MI_LO_ATTR_LOG);
if(status == MI_ERROR)
{
   mi_db_error_raise(NULL,MI_EXCEPTION, 
      "Unable to activate transaction logging.");
   /* NOT REACHED */
   return MI_ERROR;
}
Tip: To save log space, temporarily turn off transaction logging at the start of the am_create purpose function. After the access method builds the index, turn logging on. The following statement explicitly turns off transaction logging:
mi_lo_specset_flags(lo_spec_p, MI_LO_ATTR_NO_LOG)

For more information about metadata logging, see the Informix Administrator's Guide.