public interface IDBInterface
Modifier and Type | Field and Description |
---|---|
static String |
_rcsid |
static int |
TRANSACTION_ENCLOSING |
static int |
TRANSACTION_READCOMMITTED |
static int |
TRANSACTION_REPEATABLEREAD |
static int |
TRANSACTION_SERIALIZED |
Modifier and Type | Method and Description |
---|---|
void |
addTableIndex(String tableName,
boolean unique,
List<String> columnList)
Add an index to a table.
|
void |
analyzeTable(String tableName)
Analyze a table.
|
void |
beginTransaction()
Begin a database transaction.
|
void |
beginTransaction(int transactionType)
Begin a database transaction.
|
String |
buildConjunctionClause(List outputParameters,
ClauseDescription[] clauseDescriptions) |
void |
closeDatabase()
Uninitialize.
|
String |
constructCountClause(String column)
Construct a count clause.
|
String |
constructDistinctOnClause(List outputParameters,
String baseQuery,
List baseParameters,
String[] distinctFields,
String[] orderFields,
boolean[] orderFieldsAscending,
Map<String,String> otherFields)
Construct a 'distinct on (x)' filter.
|
String |
constructDoubleCastClause(String value)
Construct a cast to a double value.
|
String |
constructIndexHintClause(String tableName,
IndexDescription description)
Construct index hint clause.
|
String |
constructIndexOrderByClause(String[] fieldNames,
boolean direction)
Construct ORDER-BY clause meant for reading from an index.
|
String |
constructOffsetLimitClause(int offset,
int limit)
Construct an offset/limit clause.
|
String |
constructOffsetLimitClause(int offset,
int limit,
boolean afterOrderBy)
Construct an offset/limit clause.
|
String |
constructRegexpClause(String column,
String regularExpression,
boolean caseInsensitive)
Construct a regular-expression match clause.
|
String |
constructSubstringClause(String column,
String regularExpression,
boolean caseInsensitive)
Construct a regular-expression substring clause.
|
void |
createUserAndDatabase(String adminUserName,
String adminPassword,
StringSet invalidateKeys)
Create user and database.
|
void |
dropUserAndDatabase(String adminUserName,
String adminPassword,
StringSet invalidateKeys)
Drop user and database.
|
void |
endTransaction()
End a database transaction, either performing a commit or a rollback or nothing (depending on whether
signalRollback() was called within the transaction or performCommit() or none of the above).
|
int |
findConjunctionClauseMax(ClauseDescription[] otherClauseDescriptions) |
StringSet |
getAllTables(StringSet cacheKeys,
String queryClass)
Get a database's tables.
|
String |
getDatabaseCacheKey()
Get the database general cache key.
|
String |
getDatabaseName()
Get the database name.
|
int |
getMaxInClause()
Obtain the maximum number of individual items that should be
present in an IN clause.
|
int |
getMaxOrClause()
Obtain the maximum number of individual clauses that should be
present in a sequence of OR clauses.
|
long |
getSleepAmt()
Get a random time, in milliseconds, for backoff from deadlock.
|
Map<String,IndexDescription> |
getTableIndexes(String tableName,
StringSet cacheKeys,
String queryClass)
Get a table's indexes.
|
Map<String,ColumnDescription> |
getTableSchema(String tableName,
StringSet cacheKeys,
String queryClass)
Get a table's schema.
|
String |
getTransactionID()
Get the current transaction id.
|
int |
getWindowedReportMaxRows()
For windowed report queries, e.g.
|
void |
noteModifications(String tableName,
int insertCount,
int modifyCount,
int deleteCount)
Note a number of inserts, modifications, or deletions to a specific table.
|
void |
openDatabase()
Initialize.
|
void |
performAddIndex(String indexName,
String tableName,
IndexDescription description)
Add an index to a table.
|
void |
performAlter(String tableName,
Map<String,ColumnDescription> columnMap,
Map<String,ColumnDescription> columnModifyMap,
List<String> columnDeleteList,
StringSet invalidateKeys)
Perform a table alter operation.
|
void |
performCommit()
Perform the transaction commit.
|
void |
performCreate(String tableName,
Map<String,ColumnDescription> columnMap,
StringSet invalidateKeys)
Perform a table creation operation.
|
void |
performDelete(String tableName,
String whereClause,
List whereParameters,
StringSet invalidateKeys)
Perform a delete operation.
|
void |
performDrop(String tableName,
StringSet invalidateKeys)
Perform a table drop operation.
|
void |
performInsert(String tableName,
Map<String,Object> parameterMap,
StringSet invalidateKeys)
Perform an insert operation.
|
void |
performModification(String query,
List params,
StringSet invalidateKeys)
Perform a general database modification query.
|
IResultSet |
performQuery(String query,
List params,
StringSet cacheKeys,
String queryClass)
Perform a general "data fetch" query.
|
IResultSet |
performQuery(String query,
List params,
StringSet cacheKeys,
String queryClass,
int maxResults,
ILimitChecker returnLimit)
Perform a general "data fetch" query.
|
IResultSet |
performQuery(String query,
List params,
StringSet cacheKeys,
String queryClass,
int maxResults,
ResultSpecification resultSpec,
ILimitChecker returnLimit)
Perform a general "data fetch" query.
|
void |
performRemoveIndex(String indexName,
String tableName)
Remove an index.
|
void |
performUpdate(String tableName,
Map<String,Object> parameterMap,
String whereClause,
List whereParameters,
StringSet invalidateKeys)
Perform an update operation.
|
void |
reindexTable(String tableName)
Reindex a table.
|
void |
signalRollback()
Signal that a rollback should occur on the next endTransaction().
|
void |
sleepFor(long time)
Sleep for a specified time, as part of backoff from deadlock.
|
static final String _rcsid
static final int TRANSACTION_ENCLOSING
static final int TRANSACTION_READCOMMITTED
static final int TRANSACTION_SERIALIZED
static final int TRANSACTION_REPEATABLEREAD
void openDatabase() throws ManifoldCFException
ManifoldCFException
void closeDatabase() throws ManifoldCFException
ManifoldCFException
String getDatabaseName()
String getTransactionID()
String getDatabaseCacheKey()
void performInsert(String tableName, Map<String,Object> parameterMap, StringSet invalidateKeys) throws ManifoldCFException
tableName
- is the name of the table.invalidateKeys
- are the cache keys that should be
invalidated.parameterMap
- is the map of column name/values to write.ManifoldCFException
void performUpdate(String tableName, Map<String,Object> parameterMap, String whereClause, List whereParameters, StringSet invalidateKeys) throws ManifoldCFException
tableName
- is the name of the table.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
void performDelete(String tableName, String whereClause, List whereParameters, StringSet invalidateKeys) throws ManifoldCFException
tableName
- is the name of the table to delete from.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
void performCreate(String tableName, Map<String,ColumnDescription> columnMap, StringSet invalidateKeys) throws ManifoldCFException
tableName
- is the name of the table to create.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. The types are ColumnDefinition objects.invalidateKeys
- are the cache keys that should be invalidated, if any.ManifoldCFException
void performAlter(String tableName, Map<String,ColumnDescription> columnMap, Map<String,ColumnDescription> columnModifyMap, List<String> columnDeleteList, StringSet invalidateKeys) throws ManifoldCFException
tableName
- is the name of the table to alter.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 be changed. The key is the
existing column name, and the value is the new type of the column. Data will be copied from
the old column to the new.columnDeleteList
- is the list of column names to delete.invalidateKeys
- are the cache keys that should be invalidated, if any.ManifoldCFException
void addTableIndex(String tableName, boolean unique, List<String> columnList) throws ManifoldCFException
tableName
- is the name of the table to add the index for.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
void performAddIndex(String indexName, String tableName, IndexDescription description) throws ManifoldCFException
tableName
- is the name of the table to add the index for.indexName
- is the optional name of the table index. If null, a name will be chosen automatically.description
- is the index description.ManifoldCFException
void performRemoveIndex(String indexName, String tableName) throws ManifoldCFException
indexName
- is the name of the index to remove.tableName
- is the table the index belongs to.ManifoldCFException
void analyzeTable(String tableName) throws ManifoldCFException
tableName
- is the name of the table to analyze/calculate statistics for.ManifoldCFException
void reindexTable(String tableName) throws ManifoldCFException
tableName
- is the name of the table to rebuild indexes for.ManifoldCFException
void performDrop(String tableName, StringSet invalidateKeys) throws ManifoldCFException
tableName
- is the name of the table to drop.invalidateKeys
- are the cache keys that should be invalidated, if any.ManifoldCFException
void createUserAndDatabase(String adminUserName, String adminPassword, StringSet invalidateKeys) throws ManifoldCFException
adminUserName
- is the admin user name.adminPassword
- is the admin password.invalidateKeys
- are the cache keys that should be invalidated, if any.ManifoldCFException
void dropUserAndDatabase(String adminUserName, String adminPassword, StringSet invalidateKeys) throws ManifoldCFException
adminUserName
- is the admin user name.adminPassword
- is the admin password.invalidateKeys
- are the cache keys that should be invalidated, if any.ManifoldCFException
Map<String,ColumnDescription> getTableSchema(String tableName, StringSet cacheKeys, String queryClass) throws ManifoldCFException
tableName
- is the name of the table.cacheKeys
- are the keys against which to cache the query, or null.queryClass
- is the name of the query class, or null.ManifoldCFException
Map<String,IndexDescription> getTableIndexes(String tableName, StringSet cacheKeys, String queryClass) throws ManifoldCFException
tableName
- is the name of the table.cacheKeys
- are the keys against which to cache the query, or null.queryClass
- is the name of the query class, or null.ManifoldCFException
StringSet getAllTables(StringSet cacheKeys, String queryClass) throws ManifoldCFException
cacheKeys
- are the cache keys for the query, or null.queryClass
- is the name of the query class, or null.ManifoldCFException
void performModification(String query, List 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
IResultSet performQuery(String query, List params, StringSet cacheKeys, 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
IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass, int maxResults, ILimitChecker returnLimit) 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.maxResults
- is the maximum number of results returned (-1 for all).returnLimit
- is a description of how to limit the return result, or null if no limit.ManifoldCFException
IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass, int maxResults, ResultSpecification resultSpec, ILimitChecker returnLimit) 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.maxResults
- is the maximum number of results returned (-1 for all).resultSpec
- is a result specification, or null for the standard treatment.returnLimit
- is a description of how to limit the return result, or null if no limit.ManifoldCFException
String constructIndexHintClause(String tableName, IndexDescription description) throws ManifoldCFException
tableName
- is the table the index is from.description
- is the description of an index, which is expected to exist.ManifoldCFException
String constructIndexOrderByClause(String[] fieldNames, boolean direction)
fieldNames
- are the names of the fields in the index that is to be used.direction
- is a boolean describing the sorting order of the first term.String constructDoubleCastClause(String value)
value
- is the value to be cast.String constructCountClause(String column)
column
- is the column string to be counted.String constructRegexpClause(String column, 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.String constructSubstringClause(String column, 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.String constructOffsetLimitClause(int offset, int limit, boolean afterOrderBy)
offset
- is the starting offset number.limit
- is the limit of result rows to return.afterOrderBy
- is true if this offset/limit comes after an ORDER BY.String constructOffsetLimitClause(int offset, int limit)
offset
- is the starting offset number.limit
- is the limit of result rows to return.String constructDistinctOnClause(List outputParameters, String baseQuery, List baseParameters, String[] distinctFields, String[] orderFields, boolean[] orderFieldsAscending, Map<String,String> otherFields)
outputParameters
- is a blank list into which to put parameters. Null may be used if the baseParameters parameter is null.baseQuery
- is the base query, which is another SELECT statement, without parens,
e.g. "SELECT ..."baseParameters
- are the parameters corresponding to the baseQuery.distinctFields
- are the fields to consider to be distinct. These should all be keys in otherFields below.orderFields
- are the otherfield keys that determine the ordering.orderFieldsAscending
- are true for orderFields that are ordered as ASC, false for DESC.otherFields
- are the rest of the fields to return, keyed by the AS name, value being the base query column value, e.g. "value AS key"int findConjunctionClauseMax(ClauseDescription[] otherClauseDescriptions)
String buildConjunctionClause(List outputParameters, ClauseDescription[] clauseDescriptions)
int getMaxInClause()
int getMaxOrClause()
int getWindowedReportMaxRows()
void beginTransaction() throws ManifoldCFException
ManifoldCFException
void beginTransaction(int transactionType) throws ManifoldCFException
transactionType
- is the kind of transaction desired.ManifoldCFException
void performCommit() throws ManifoldCFException
ManifoldCFException
void signalRollback()
void endTransaction() throws ManifoldCFException
ManifoldCFException
void noteModifications(String tableName, 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.ManifoldCFException
long getSleepAmt()
void sleepFor(long time) throws ManifoldCFException
time
- is the amount to sleep.ManifoldCFException