import java.sql.Statement;
import java.util.List;
import java.util.Map;
+import java.io.InputStream;
import mir.entity.Entity;
import mir.entity.EntityList;
-
/**
- * Implementiert Interface f?r die Speicherschicht.
- * Bislang gibt es in der Bibliothek nur die M?glichkeit
- * in einer Datenbank zu speichern.
- * @author RK
- * @version 29.6.1999
+ * Interface for low-level database actions.
*/
+
public interface StorageObject {
- /**
- * Dokumentation siehe Database.java
- * @param id
- * @return Entity
- * @exception StorageObjectException
- */
- abstract public Entity selectById(String id) throws StorageObjectExc;
+ public Entity selectById(String id) throws StorageObjectExc;
- /**
- * Dokumentation siehe Database.java
- * @param aField
- * @param aValue
- * @return EntityList
- * @exception StorageObjectException
- */
- abstract public EntityList selectByFieldValue(String aField, String aValue)
- throws StorageObjectFailure;
+ public EntityList selectByFieldValue(String aField, String aValue) throws StorageObjectFailure;
- /**
- * Dokumentation siehe Database.java
- * @param whereClause
- * @return EntityList
- * @exception StorageObjectException
- */
- abstract public EntityList selectByWhereClause(String whereClause)
- throws StorageObjectFailure;
+ public EntityList selectByWhereClause(String whereClause) throws StorageObjectFailure;
- /**
- * Dokumentation siehe Database.java
- * @param whereClause
- * @param offset
- * @return EntityList
- * @exception StorageObjectException
- */
- abstract public EntityList selectByWhereClause(String whereClause, int offset)
- throws StorageObjectFailure;
+ public EntityList selectByWhereClause(String whereClause, int offset) throws StorageObjectFailure;
- /**
- * Dokumentation siehe Database.java
- * @param whereClause
- * @param orderBy
- * @param offset
- * @return EntityList
- * @exception StorageObjectException
- */
- abstract public EntityList selectByWhereClause(String whereClause,
- String orderBy, int offset) throws StorageObjectFailure;
+ public EntityList selectByWhereClause(String whereClause, String orderBy, int offset) throws StorageObjectFailure;
- /**
- * Dokumentation siehe Database.java
- * @param whereClause
- * @param orderBy
- * @param offset
- * @param limit
- * @return EntityList
- * @exception StorageObjectException
- */
- abstract public EntityList selectByWhereClause(String whereClause,
- String orderBy, int offset, int limit) throws StorageObjectFailure;
+ public EntityList selectByWhereClause(String whereClause, String orderBy, int offset, int limit) throws StorageObjectFailure;
- /**
- * Dokumentation siehe Database.java
- * @param id
- * @return boolen
- * @exception StorageObjectException
- */
- abstract public boolean delete(String id) throws StorageObjectFailure;
+ public EntityList selectByWhereClause(String mainTablePrefix, List extraTables, String aWhereClause, String anOrderByClause, int offset, int limit) throws StorageObjectFailure;
+
+ public boolean delete(String id) throws StorageObjectFailure;
/**
* Deletes entities based on a where clause
- *
- * @param aWhereClause
- * @return
- * @throws StorageObjectFailure
*/
public int deleteByWhereClause(String aWhereClause) throws StorageObjectFailure;
- /**
- * Dokumentation siehe Database.java
- * @return ArrayList
- * @exception StorageObjectException
- */
- abstract public List getFields() throws StorageObjectFailure;
-
- /**
- * Dokumentation siehe Database.java
- * @return int[]
- * @exception StorageObjectException
- */
- abstract public int[] getTypes() throws StorageObjectFailure;
-
- /**
- * Dokumentation siehe Database.java
- * @return ArrayList
- * @exception StorageObjectException
- */
- abstract public List getLabels() throws StorageObjectFailure;
+ public List getFields() throws StorageObjectFailure;
- /**
- * Dokumentation siehe Database.java
- * @param a
- * @exception StorageObjectException
- */
- abstract public void update(Entity a) throws StorageObjectFailure;
+ public void update(Entity a) throws StorageObjectFailure;
- /**
- * Dokumentation siehe Database.java
- * @param a
- * @return String id
- * @exception StorageObjectException
- */
- abstract public String insert(Entity a) throws StorageObjectFailure;
+ public String insert(Entity a) throws StorageObjectFailure;
- /**
- * Dokumentation siehe Database.java
- * @return Class Klasse der Entity
- */
- abstract public Class getEntityClass();
+ public Class getEntityClass();
- /**
- * put your documentation comment here
- * @return
- */
- abstract public String getIdName();
+ public String getIdName();
- /**
- * Dokumentation siehe Database.java
- * @return String
- */
- abstract public String getTableName();
+ public String getTableName();
- /**
- * Dokumentation siehe Database.java
- * @return Connection
- * @exception StorageObjectException
- */
- abstract public Connection getPooledCon() throws StorageObjectFailure;
+ public Connection obtainConnection() throws StorageObjectFailure;
- /**
- *
- * @param a
- * @param sql
- * @return
- * @throws StorageObjectFailure
- * @throws SQLException
- */
- abstract public ResultSet executeSql(Statement a, String sql) throws StorageObjectFailure, SQLException;
+ public ResultSet executeSql(Statement a, String sql) throws StorageObjectFailure, SQLException;
/**
- * Executes 1 sql statement and returns the results as a <code>List</code> of <code>Map</code>s
- *
- * @param sql
- * @return
- * @throws StorageObjectFailure
- * @throws StorageObjectExc
+ * Executes 1 sql statement and returns the results as a <code>List</code> of
+ * <code>Map</code>s
*/
- abstract public List executeFreeSql(String sql, int aLimit) throws StorageObjectFailure, StorageObjectExc;
+ public List executeFreeSql(String sql, int aLimit) throws StorageObjectFailure, StorageObjectExc;
/**
* Executes 1 sql statement and returns the first result row as a <<code>Map</code>s
* (<code>null</code> if there wasn't any row)
- *
- * @param sql
- * @return
- * @throws StorageObjectFailure
- * @throws StorageObjectExc
*/
- abstract public Map executeFreeSingleRowSql(String sql) throws StorageObjectFailure, StorageObjectExc ;
+ public Map executeFreeSingleRowSql(String sql) throws StorageObjectFailure, StorageObjectExc ;
/**
* Executes 1 sql statement and returns the first column of the first result row as a <<code>String</code>s
* (<code>null</code> if there wasn't any row)
- *
- * @param sql
- * @return
- * @throws StorageObjectFailure
- * @throws StorageObjectExc
*/
- abstract public String executeFreeSingleValueSql(String sql) throws StorageObjectFailure, StorageObjectExc ;
+ public String executeFreeSingleValueSql(String sql) throws StorageObjectFailure, StorageObjectExc ;
- /**
- * @param con
- * @param stmt
- */
- abstract public void freeConnection(Connection con, Statement stmt) throws StorageObjectFailure;
+ public void freeConnection(Connection con, Statement stmt) throws StorageObjectFailure;
+
+ public int executeUpdate(Statement a, String sql) throws StorageObjectFailure, SQLException;
+
+ public int executeUpdate(String sql) throws StorageObjectFailure, SQLException;
+
+ public int getSize(String where) throws SQLException, StorageObjectFailure;
- abstract public int executeUpdate(Statement a, String sql) throws StorageObjectFailure, SQLException;
+ public int getSize(String mainTablePrefix, List extraTables, String where) throws SQLException, StorageObjectFailure;
- abstract public int executeUpdate(String sql) throws StorageObjectFailure, SQLException;
+ public InputStream getBinaryField(String aQuery) throws SQLException, StorageObjectFailure;
- abstract public int getSize(String where) throws SQLException, StorageObjectFailure;
+ public void setBinaryField(String aQuery, byte aData[]) throws StorageObjectFailure, SQLException;
}