|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.manifoldcf.core.database.BaseTable
public class BaseTable
This class is a base class that provides a common foundation for table managers for various different tables in the system.
| Field Summary | |
|---|---|
static java.lang.String |
_rcsid
|
protected IDBInterface |
dbInterface
|
protected java.lang.String |
tableName
|
| Constructor Summary | |
|---|---|
BaseTable(IDBInterface dbInterface,
java.lang.String tableName)
|
|
| Method Summary | |
|---|---|
protected void |
addTableIndex(boolean unique,
java.util.ArrayList columnList)
Add an index to a table. |
protected void |
analyzeTable()
Analyze this table. |
protected void |
beginTransaction()
Begin a database transaction. |
java.lang.String |
constructDistinctOnClause(java.util.ArrayList outputParameters,
java.lang.String baseQuery,
java.util.ArrayList baseParameters,
java.lang.String[] distinctFields,
java.util.Map otherFields)
Construct a 'distinct on (x)' filter. |
java.lang.String |
constructOffsetLimitClause(int offset,
int limit)
Construct an offset/limit clause. |
java.lang.String |
constructRegexpClause(java.lang.String column,
java.lang.String regularExpression,
boolean caseInsensitive)
Construct a regular-expression match clause. |
java.lang.String |
constructSubstringClause(java.lang.String column,
java.lang.String regularExpression,
boolean caseInsensitive)
Construct a regular-expression substring clause. |
protected void |
endTransaction()
End a database transaction, either performing a commit or a rollback (depending on whether signalRollback() was called within the transaction). |
java.lang.String |
getDatabaseCacheKey()
|
protected IDBInterface |
getDBInterface()
|
protected int |
getMaxInClause()
Obtain the maximum number of individual items that should be present in an IN clause. |
protected int |
getMaxOrClause()
Obtain the maximum number of individual clauses that should be present in a sequence of OR clauses. |
protected java.util.Map |
getTableIndexes(StringSet invalidateKeys,
java.lang.String queryClass)
Get a table's indexes. |
java.lang.String |
getTableName()
|
protected java.util.Map |
getTableSchema(StringSet invalidateKeys,
java.lang.String queryClass)
Get the current table schema. |
java.lang.String |
getTransactionID()
|
java.lang.String |
makeTableKey()
Construct a key that is database specific, and applies to queries made against a specific table name. |
void |
noteModifications(int insertCount,
int modifyCount,
int deleteCount)
Note a number of inserts, modifications, or deletions to a specific table. |
protected void |
performAddIndex(java.lang.String indexName,
IndexDescription description)
Add an index to a table. |
void |
performAlter(java.util.Map columnMap,
java.util.Map columnModifyMap,
java.util.ArrayList columnDeleteList,
StringSet invalidateKeys)
Perform a table alter operation. |
protected void |
performCreate(java.util.Map columnMap,
StringSet invalidateKeys)
Perform a table creation operation. |
protected void |
performDelete(java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
Perform a delete operation. |
protected void |
performDrop(StringSet invalidateKeys)
Perform a table drop operation. |
protected void |
performInsert(java.util.Map parameterMap,
StringSet invalidateKeys)
Perform an insert operation. |
protected void |
performLock()
Perform a table lock operation. |
protected void |
performModification(java.lang.String query,
java.util.ArrayList params,
StringSet invalidateKeys)
Perform a general database modification query. |
protected IResultSet |
performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass)
Perform a general "data fetch" query. |
protected IResultSet |
performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass,
int resultLimit)
Perform a general "data fetch" query, with the ability to provide a limit. |
void |
performRemoveIndex(java.lang.String indexName)
Remove an index. |
protected void |
performUpdate(java.util.Map parameterMap,
java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
Perform an update operation. |
static java.util.Map |
prepareRowForSave(BaseObject object,
StringSet fieldSet)
Read the specified fields from the specified object, and build a Map, which can be used to write the data to the database. |
static void |
readRow(BaseObject object,
IResultRow resultRow)
Set up a base object from a database row. |
protected void |
reindexTable()
Reindex this table. |
protected void |
signalRollback()
Signal that a rollback should occur on the next endTransaction(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String _rcsid
protected IDBInterface dbInterface
protected java.lang.String tableName
| Constructor Detail |
|---|
public BaseTable(IDBInterface dbInterface,
java.lang.String tableName)
| Method Detail |
|---|
protected IDBInterface getDBInterface()
public java.lang.String getTableName()
public java.lang.String getDatabaseCacheKey()
public java.lang.String getTransactionID()
protected void performLock()
throws ManifoldCFException
ManifoldCFException
protected void performInsert(java.util.Map parameterMap,
StringSet invalidateKeys)
throws ManifoldCFException
invalidateKeys - are the cache keys that should be
invalidated.parameterMap - is the map of column name/values to write.
ManifoldCFException
protected void performUpdate(java.util.Map parameterMap,
java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
throws ManifoldCFException
invalidateKeys - are the cache keys that should be invalidated.parameterMap - is the map of column name/values to write.whereClause - is the where clause describing the match (including the WHERE), or null if none.whereParameters - are the parameters that come with the where clause, if any.
ManifoldCFException
protected void performDelete(java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
throws ManifoldCFException
invalidateKeys - are the cache keys that should be invalidated.whereClause - is the where clause describing the match (including the WHERE), or null if none.whereParameters - are the parameters that come with the where clause, if any.
ManifoldCFException
protected void performCreate(java.util.Map columnMap,
StringSet invalidateKeys)
throws ManifoldCFException
columnMap - is the map describing the columns and types. NOTE that these are abstract
types, which will be mapped to the proper types for the actual database inside this
layer.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFException
public void performAlter(java.util.Map columnMap,
java.util.Map columnModifyMap,
java.util.ArrayList columnDeleteList,
StringSet invalidateKeys)
throws ManifoldCFException
columnMap - is the map describing the columns and types to add. These
are in the same form as for performCreate.columnModifyMap - is the map describing the columns to modify. These
are in the same form as for performCreate.columnDeleteList - is the list of column names to delete.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFException
protected void addTableIndex(boolean unique,
java.util.ArrayList columnList)
throws ManifoldCFException
unique - is a boolean that if true describes a unique index.columnList - is the list of columns that need to be included
in the index, in order.
ManifoldCFException
protected void performAddIndex(java.lang.String indexName,
IndexDescription description)
throws ManifoldCFException
indexName - is the optional name of the table index. If null, a name will be chosen automatically.description - is the index description.
ManifoldCFException
public void performRemoveIndex(java.lang.String indexName)
throws ManifoldCFException
indexName - is the name of the index to remove.
ManifoldCFException
protected void analyzeTable()
throws ManifoldCFException
ManifoldCFException
protected void reindexTable()
throws ManifoldCFException
ManifoldCFException
protected void performDrop(StringSet invalidateKeys)
throws ManifoldCFException
invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFException
protected java.util.Map getTableSchema(StringSet invalidateKeys,
java.lang.String queryClass)
throws ManifoldCFException
invalidateKeys - are the cache keys, if needed (null if no cache desired).queryClass - is the LRU class name against which this query would be cached,
or null if no LRU behavior desired.
ManifoldCFException
protected java.util.Map getTableIndexes(StringSet invalidateKeys,
java.lang.String queryClass)
throws ManifoldCFException
invalidateKeys - are the keys against which to cache the query, or null.queryClass - is the name of the query class, or null.
ManifoldCFException
protected void performModification(java.lang.String query,
java.util.ArrayList params,
StringSet invalidateKeys)
throws ManifoldCFException
query - is the query string.params - are the parameterized values, if needed.invalidateKeys - are the cache keys to invalidate.
ManifoldCFException
protected IResultSet performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass)
throws ManifoldCFException
query - is the query string.params - are the parameterized values, if needed.cacheKeys - are the cache keys, if needed (null if no cache desired).queryClass - is the LRU class name against which this query would be cached,
or null if no LRU behavior desired.
ManifoldCFException
protected IResultSet performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass,
int resultLimit)
throws ManifoldCFException
query - is the query string.params - are the parameterized values, if needed.cacheKeys - are the cache keys, if needed (null if no cache desired).queryClass - is the LRU class name against which this query would be cached,
or null if no LRU behavior desired.resultLimit - is the maximum number of results desired.
ManifoldCFException
protected void beginTransaction()
throws ManifoldCFException
ManifoldCFExceptionprotected void signalRollback()
protected void endTransaction()
throws ManifoldCFException
ManifoldCFException
public void noteModifications(int insertCount,
int modifyCount,
int deleteCount)
throws ManifoldCFException
tableName - is the name of the table being modified.insertCount - is the number of inserts.modifyCount - is the number of updates.deleteCount - is the number of deletions.
ManifoldCFExceptionpublic java.lang.String makeTableKey()
public java.lang.String constructRegexpClause(java.lang.String column,
java.lang.String regularExpression,
boolean caseInsensitive)
column - is the column specifier string.regularExpression - is the properly-quoted regular expression string, or "?" if a parameterized value is to be used.caseInsensitive - is true of the regular expression match is to be case insensitive.
public java.lang.String constructSubstringClause(java.lang.String column,
java.lang.String regularExpression,
boolean caseInsensitive)
column - is the column specifier string.regularExpression - is the properly-quoted regular expression string, or "?" if a parameterized value is to be used.caseInsensitive - is true if the regular expression match is to be case insensitive.
public java.lang.String constructOffsetLimitClause(int offset,
int limit)
offset - is the starting offset number.limit - is the limit of result rows to return.
public java.lang.String constructDistinctOnClause(java.util.ArrayList outputParameters,
java.lang.String baseQuery,
java.util.ArrayList baseParameters,
java.lang.String[] distinctFields,
java.util.Map otherFields)
outputParameters - is a blank arraylist into which to put parameters. Null may be used if the baseParameters parameter is null.baseQuery - is the base query, which can either be tables and where clause, or can be another SELECT in parens,
e.g. "(SELECT ...) t3"baseParameters - are the parameters corresponding to the baseQuery.distinctFields - are the fields to consider to be distinct.otherFields - are the rest of the fields to return, keyed by the AS name, value being the column value, e.g. "value AS key"
protected int getMaxInClause()
protected int getMaxOrClause()
public static void readRow(BaseObject object,
IResultRow resultRow)
object - is the object to read into.resultRow - is the row to use to initialize the object.
public static java.util.Map prepareRowForSave(BaseObject object,
StringSet fieldSet)
fieldSet - is the set of fields.object - is the BaseObject to get the data from.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||