01: /**
02: * com.mckoi.database.DatabaseProcedure 10 Aug 2000
03: *
04: * Mckoi SQL Database ( http://www.mckoi.com/database )
05: * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * Version 2 as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License Version 2 for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * Version 2 along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: *
20: * Change Log:
21: *
22: *
23: */package com.mckoi.database;
24:
25: /**
26: * This interface represents a database procedure that is executed on the
27: * server side. It is used to perform database specific functions that can
28: * only be performed on the server.
29: * <p>
30: * A procedure must manage its own table locking.
31: *
32: * @author Tobias Downer
33: */
34:
35: public interface DatabaseProcedure {
36:
37: /**
38: * Executes the procudure and returns the resultant table. Note, the
39: * args have to be serializable. There may be only 0 to 16 arguments.
40: * The method may throw a 'DatabaseException' if the procedure failed.
41: */
42: Table execute(User user, Object[] args) throws DatabaseException;
43:
44: /**
45: * This returns a DataTable[] array that lists the DataTables that are read
46: * during this procedure.
47: */
48: DataTable[] getReadTables(DatabaseConnection db)
49: throws DatabaseException;
50:
51: /**
52: * Returns a DataTable[] array that lists the DataTables that are written
53: * to during this procedure.
54: */
55: DataTable[] getWriteTables(DatabaseConnection db)
56: throws DatabaseException;
57:
58: /**
59: * Returns the locking mode in which the database operates. This is either
60: * LockingMechanism.SHARED_MODE or LockingMechanism.EXCLUSIVE_MODE. In most
61: * cases this will be SHARED_MODE.
62: */
63: int getLockingMode();
64:
65: /**
66: * Sets the LockHandle object for this procedure. This should be called
67: * after the tables that this procedure uses have been locked.
68: */
69: void setLockHandle(LockHandle lock_handle);
70:
71: }
|