PrologDatabase::PrologDatabase

void PrologDatabase(proioErrorHandler handler = 0)

Construct a new, unhashed database, with an optional error handler. The error handler must be a function returning a Bool and taking an integer and a string argument. When an error occurs when reading or writing a database, this function is called. The error is given as the first argument (currently one of PROIO_ERROR_GENERAL, PROIO_ERROR_SYNTAX) and an error message is given as the second argument. If FALSE is returned by the error handler, processing of the PROLOGIO operation stops.

Another way of handling errors is simply to call GetErrorCount after the operation, to check whether errors have occurred, instead of installing an error handler. If the error count is more than zero, WriteProlog and ReadProlog will return FALSE to the application.

For example:

Bool myErrorHandler(int err, chat *msg)
{
  if (err == PROIO_ERROR_SYNTAX)
  {
    wxMessageBox(msg, "Syntax error");
  }
  return FALSE;
}

PrologDatabase database(myErrorHandler);

void PrologDatabase(PrologType type, char *attribute, int size = 500, proioErrorHandler handler = 0)

Construct a new database hashed on a combination of the clause functor and a named attribute (often an integer identification).

See above for an explanation of the error handler.

void ~PrologDatabase(void)

Delete the database and contents.