|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.manifoldcf.core.database.Database
org.apache.manifoldcf.core.database.DBInterfaceMySQL
public class DBInterfaceMySQL
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.apache.manifoldcf.core.database.Database |
|---|
Database.ExecuteQueryThread, Database.QueryCacheExecutor |
| Field Summary | |
|---|---|
static java.lang.String |
_rcsid
|
protected java.lang.String |
cacheKey
|
protected IThreadContext |
context
|
| Fields inherited from class org.apache.manifoldcf.core.database.Database |
|---|
_TRANSACTION_, cacheManager, connection, databaseName, delayedTransactionDepth, doRollback, jdbcDriverClass, jdbcUrl, password, random, th, userName |
| Fields inherited from interface org.apache.manifoldcf.core.interfaces.IDBInterface |
|---|
TRANSACTION_ENCLOSING, TRANSACTION_READCOMMITTED, TRANSACTION_SERIALIZED |
| Constructor Summary | |
|---|---|
DBInterfaceMySQL(IThreadContext tc,
java.lang.String databaseName,
java.lang.String userName,
java.lang.String password)
|
|
| Method Summary | |
|---|---|
void |
addTableIndex(java.lang.String tableName,
boolean unique,
java.util.ArrayList columnList)
Add an index to a table. |
void |
analyzeTable(java.lang.String tableName)
Analyze a table. |
void |
beginTransaction()
Begin a database transaction. |
void |
beginTransaction(int transactionType)
Begin a database transaction. |
void |
closeDatabase()
Uninitialize. |
protected void |
commitCurrentTransaction()
Abstract method to commit a 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. |
void |
createUserAndDatabase(java.lang.String adminUserName,
java.lang.String adminPassword,
StringSet invalidateKeys)
Create user and database. |
void |
dropUserAndDatabase(java.lang.String adminUserName,
java.lang.String adminPassword,
StringSet invalidateKeys)
Drop user and database. |
StringSet |
getAllTables(StringSet cacheKeys,
java.lang.String queryClass)
Get a database's tables. |
java.lang.String |
getDatabaseCacheKey()
Get the database general cache key. |
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. |
java.util.Map |
getTableIndexes(java.lang.String tableName,
StringSet cacheKeys,
java.lang.String queryClass)
Get a table's indexes. |
java.util.Map |
getTableSchema(java.lang.String tableName,
StringSet cacheKeys,
java.lang.String queryClass)
Get a table's schema. |
void |
openDatabase()
Initialize. |
void |
performAddIndex(java.lang.String indexName,
java.lang.String tableName,
IndexDescription description)
Add an index to a table. |
void |
performAlter(java.lang.String tableName,
java.util.Map columnMap,
java.util.Map columnModifyMap,
java.util.ArrayList columnDeleteList,
StringSet invalidateKeys)
Perform a table alter operation. |
void |
performCreate(java.lang.String tableName,
java.util.Map columnMap,
StringSet invalidateKeys)
Perform a table creation operation. |
void |
performDelete(java.lang.String tableName,
java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
Perform a delete operation. |
void |
performDrop(java.lang.String tableName,
StringSet invalidateKeys)
Perform a table drop operation. |
void |
performInsert(java.lang.String tableName,
java.util.Map parameterMap,
StringSet invalidateKeys)
Perform an insert operation. |
void |
performLock(java.lang.String tableName)
Perform a table lock operation. |
void |
performModification(java.lang.String query,
java.util.ArrayList params,
StringSet invalidateKeys)
Perform a general database modification query. |
IResultSet |
performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass)
Perform a general "data fetch" query. |
IResultSet |
performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass,
int maxResults,
ILimitChecker returnLimit)
Perform a general "data fetch" query. |
IResultSet |
performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass,
int maxResults,
ResultSpecification resultSpec,
ILimitChecker returnLimit)
Perform a general "data fetch" query. |
void |
performRemoveIndex(java.lang.String indexName)
Remove an index. |
void |
performUpdate(java.lang.String tableName,
java.util.Map parameterMap,
java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
Perform an update operation. |
void |
reindexTable(java.lang.String tableName)
Reindex a table. |
protected void |
rollbackCurrentTransaction()
Abstract method to roll back a transaction |
protected void |
startATransaction()
Abstract method to start a transaction |
| Methods inherited from class org.apache.manifoldcf.core.database.Database |
|---|
cleanupParameters, endTransaction, execute, executeQuery, executeUncachedQuery, executeViaThread, explainQuery, findColumn, getBLOB, getCurrentTransactionType, getData, getDatabaseName, getObject, getSleepAmt, getTransactionID, internalTransactionBegin, isBinary, isBLOB, loadPS, mapColumnName, noteModifications, signalRollback, sleepFor, synchronizeTransactions |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.manifoldcf.core.interfaces.IDBInterface |
|---|
endTransaction, getDatabaseName, getSleepAmt, getTransactionID, noteModifications, signalRollback, sleepFor |
| Field Detail |
|---|
public static final java.lang.String _rcsid
protected IThreadContext context
protected java.lang.String cacheKey
| Constructor Detail |
|---|
public DBInterfaceMySQL(IThreadContext tc,
java.lang.String databaseName,
java.lang.String userName,
java.lang.String password)
throws ManifoldCFException
ManifoldCFException| Method Detail |
|---|
public void openDatabase()
throws ManifoldCFException
openDatabase in interface IDBInterfaceManifoldCFException
public void closeDatabase()
throws ManifoldCFException
closeDatabase in interface IDBInterfaceManifoldCFExceptionpublic java.lang.String getDatabaseCacheKey()
getDatabaseCacheKey in interface IDBInterface
public void performLock(java.lang.String tableName)
throws ManifoldCFException
performLock in interface IDBInterfacetableName - is the name of the table.
ManifoldCFException
public void performInsert(java.lang.String tableName,
java.util.Map parameterMap,
StringSet invalidateKeys)
throws ManifoldCFException
performInsert in interface IDBInterfacetableName - 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
public void performUpdate(java.lang.String tableName,
java.util.Map parameterMap,
java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
throws ManifoldCFException
performUpdate in interface IDBInterfacetableName - 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
public void performDelete(java.lang.String tableName,
java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
throws ManifoldCFException
performDelete in interface IDBInterfacetableName - 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
public void performCreate(java.lang.String tableName,
java.util.Map columnMap,
StringSet invalidateKeys)
throws ManifoldCFException
performCreate in interface IDBInterfacetableName - 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.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFException
public void performAlter(java.lang.String tableName,
java.util.Map columnMap,
java.util.Map columnModifyMap,
java.util.ArrayList columnDeleteList,
StringSet invalidateKeys)
throws ManifoldCFException
performAlter in interface IDBInterfacetableName - 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
public void addTableIndex(java.lang.String tableName,
boolean unique,
java.util.ArrayList columnList)
throws ManifoldCFException
addTableIndex in interface IDBInterfacetableName - 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
public void performAddIndex(java.lang.String indexName,
java.lang.String tableName,
IndexDescription description)
throws ManifoldCFException
performAddIndex in interface IDBInterfacetableName - 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
public void performRemoveIndex(java.lang.String indexName)
throws ManifoldCFException
performRemoveIndex in interface IDBInterfaceindexName - is the name of the index to remove.
ManifoldCFException
public void analyzeTable(java.lang.String tableName)
throws ManifoldCFException
analyzeTable in interface IDBInterfacetableName - is the name of the table to analyze/calculate statistics for.
ManifoldCFException
public void reindexTable(java.lang.String tableName)
throws ManifoldCFException
reindexTable in interface IDBInterfacetableName - is the name of the table to rebuild indexes for.
ManifoldCFException
public void performDrop(java.lang.String tableName,
StringSet invalidateKeys)
throws ManifoldCFException
performDrop in interface IDBInterfacetableName - is the name of the table to drop.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFException
public void createUserAndDatabase(java.lang.String adminUserName,
java.lang.String adminPassword,
StringSet invalidateKeys)
throws ManifoldCFException
createUserAndDatabase in interface IDBInterfaceadminUserName - is the admin user name.adminPassword - is the admin password.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFException
public void dropUserAndDatabase(java.lang.String adminUserName,
java.lang.String adminPassword,
StringSet invalidateKeys)
throws ManifoldCFException
dropUserAndDatabase in interface IDBInterfaceadminUserName - is the admin user name.adminPassword - is the admin password.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFException
public void performModification(java.lang.String query,
java.util.ArrayList params,
StringSet invalidateKeys)
throws ManifoldCFException
performModification in interface IDBInterfacequery - is the query string.params - are the parameterized values, if needed.invalidateKeys - are the cache keys to invalidate.
ManifoldCFException
public java.util.Map getTableSchema(java.lang.String tableName,
StringSet cacheKeys,
java.lang.String queryClass)
throws ManifoldCFException
getTableSchema in interface IDBInterfacetableName - 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
public java.util.Map getTableIndexes(java.lang.String tableName,
StringSet cacheKeys,
java.lang.String queryClass)
throws ManifoldCFException
getTableIndexes in interface IDBInterfacetableName - 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
public StringSet getAllTables(StringSet cacheKeys,
java.lang.String queryClass)
throws ManifoldCFException
getAllTables in interface IDBInterfacecacheKeys - are the cache keys for the query, or null.queryClass - is the name of the query class, or null.
ManifoldCFException
public IResultSet performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass)
throws ManifoldCFException
performQuery in interface IDBInterfacequery - 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
public IResultSet performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass,
int maxResults,
ILimitChecker returnLimit)
throws ManifoldCFException
performQuery in interface IDBInterfacequery - 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
public IResultSet performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass,
int maxResults,
ResultSpecification resultSpec,
ILimitChecker returnLimit)
throws ManifoldCFException
performQuery in interface IDBInterfacequery - 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
public java.lang.String constructRegexpClause(java.lang.String column,
java.lang.String regularExpression,
boolean caseInsensitive)
constructRegexpClause in interface IDBInterfacecolumn - 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)
constructSubstringClause in interface IDBInterfacecolumn - 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)
constructOffsetLimitClause in interface IDBInterfaceoffset - 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)
constructDistinctOnClause in interface IDBInterfaceoutputParameters - 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 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.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"
public int getMaxInClause()
getMaxInClause in interface IDBInterfacepublic int getMaxOrClause()
getMaxOrClause in interface IDBInterface
public void beginTransaction()
throws ManifoldCFException
beginTransaction in interface IDBInterfaceManifoldCFException
public void beginTransaction(int transactionType)
throws ManifoldCFException
beginTransaction in interface IDBInterfacebeginTransaction in class DatabasetransactionType - is the kind of transaction desired.
ManifoldCFException
protected void startATransaction()
throws ManifoldCFException
startATransaction in class DatabaseManifoldCFException
protected void commitCurrentTransaction()
throws ManifoldCFException
commitCurrentTransaction in class DatabaseManifoldCFException
protected void rollbackCurrentTransaction()
throws ManifoldCFException
rollbackCurrentTransaction in class DatabaseManifoldCFException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||