001: package org.dbbrowser.db.engine.queryengine;
002:
003: import java.util.List;
004:
005: import org.dbbrowser.db.engine.exception.DBEngineException;
006: import org.dbbrowser.db.engine.model.DBTable;
007: import org.dbbrowser.db.engine.model.View;
008: import org.dbbrowser.db.engine.model.filter.Filter;
009:
010: /**
011: * The interface for the engine which runs the SQL queries
012: * @author amangat
013: *
014: */
015: public interface DBQueryEngine {
016: /**
017: * Returns a list of schemas in the Database. It is empty if there are no schemas for the database.
018: * @return - a list of Strings
019: * @throws DBEngineException
020: */
021: public List listSchemas() throws DBEngineException;
022:
023: /**
024: * Returns a list of views accessible to the user. It is empty if there are no views for the user.
025: * @return - a list of View objects
026: * @throws DBEngineException
027: */
028: public List listViews() throws DBEngineException;
029:
030: /**
031: * Lists the indexes
032: * @return
033: * @throws DBEngineException
034: */
035: public DBTable listIndexes() throws DBEngineException;
036:
037: /**
038: * Lists the constraints
039: * @return
040: * @throws DBEngineException
041: */
042: public DBTable listConstraints() throws DBEngineException;
043:
044: /**
045: * Returns the SQL used to create a view
046: * @return - a String
047: * @throws DBEngineException
048: */
049: public String getSQLForView(View view) throws DBEngineException;
050:
051: /**
052: * Returns a list of tables in the schema
053: * @param schemaName
054: * @return - a list of Strings
055: * @throws DBEngineException
056: */
057: public List listTablesInSchema(String schemaName)
058: throws DBEngineException;
059:
060: /**
061: * Returns a list of columns in the table
062: * @param schemaName
063: * @param tableName
064: * @return - a list of Strings
065: * @throws DBEngineException
066: */
067: public List listColumnsInATable(String schemaName, String tableName)
068: throws DBEngineException;
069:
070: /**
071: * Get all the data in a table
072: * @param schemaName
073: * @param tableName
074: * @return
075: * @throws DBEngineException
076: */
077: public DBTable getAllDataInATable(String schemaName,
078: String tableName, Integer offset,
079: Integer numberOfRowsToReturn) throws DBEngineException;
080:
081: /**
082: * Returns the filtered data in the table
083: * @param schemaName
084: * @param tableName
085: * @param filter
086: * @return
087: * @throws DBEngineException
088: */
089: public DBTable getFilteredDataInATable(String schemaName,
090: String tableName, Filter filter) throws DBEngineException;
091:
092: /**
093: * Returns the list of column names which are primary keys for the table
094: * @param schemaName
095: * @param tableName
096: * @return a list of strings - names of primary key columns
097: * @throws DBEngineException
098: */
099: public List getPrimaryKeyColumnNames(String schemaName,
100: String tableName) throws DBEngineException;
101:
102: /**
103: * Return the number of rows in a table
104: * @param schemaName
105: * @param tableName
106: * @return
107: * @throws DBEngineException
108: */
109: public Integer getRowCount(String schemaName, String tableName)
110: throws DBEngineException;
111: }
|