Package com.mckoi.database

## Interface DatabaseProcedure

    public interface DatabaseProcedure

This interface represents a database procedure that is executed on the server side. It is used to perform database specific functions that can only be performed on the server.

A procedure must manage its own table locking.

Author:
  Tobias Downer

### Method Summary

All Methods Instance Methods Abstract Methods
`Table` `execute​(User user, java.lang.Object[] args)` Executes the procudure and returns the resultant table.
`int` `getLockingMode()` Returns the locking mode in which the database operates.
`DataTable[]` `getReadTables​(DatabaseConnection db)` This returns a DataTable[] array that lists the DataTables that are read during this procedure.
`DataTable[]` `getWriteTables​(DatabaseConnection db)` Returns a DataTable[] array that lists the DataTables that are written to during this procedure.
`void` `setLockHandle​(LockHandle lock_handle)` Sets the LockHandle object for this procedure.

### Method Detail

#### execute

    Table execute​(User user,
                  java.lang.Object[] args)
           throws DatabaseException

Executes the procudure and returns the resultant table. Note, the args have to be serializable. There may be only 0 to 16 arguments. The method may throw a 'DatabaseException' if the procedure failed.

Throws:
  `DatabaseException`

#### getReadTables

    DataTable[] getReadTables​(DatabaseConnection db)
                       throws DatabaseException

This returns a DataTable[] array that lists the DataTables that are read during this procedure.

Throws:
  `DatabaseException`

#### getWriteTables

    DataTable[] getWriteTables​(DatabaseConnection db)
                        throws DatabaseException

Returns a DataTable[] array that lists the DataTables that are written to during this procedure.

Throws:
  `DatabaseException`

#### getLockingMode

    int getLockingMode()

Returns the locking mode in which the database operates. This is either LockingMechanism.SHARED_MODE or LockingMechanism.EXCLUSIVE_MODE. In most cases this will be SHARED_MODE.

#### setLockHandle

    void setLockHandle​(LockHandle lock_handle)

Sets the LockHandle object for this procedure. This should be called after the tables that this procedure uses have been locked.