|
Nuxeo Enterprise Platform 5.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.nuxeo.ecm.core.storage.sql.jdbc.dialect.Dialect
public abstract class Dialect
A Dialect encapsulates knowledge about database-specific behavior.
Nested Class Summary | |
---|---|
static class |
Dialect.FulltextMatchInfo
Information needed to express fulltext search with scoring. |
static class |
Dialect.FulltextQuery
Structured fulltext query. |
static class |
Dialect.FulltextQueryAnalyzer
|
static class |
Dialect.JDBCInfo
|
Constructor Summary | |
---|---|
Dialect(java.sql.DatabaseMetaData metadata,
BinaryManager binaryManager,
RepositoryDescriptor repositoryDescriptor)
|
Method Summary | |
---|---|
static Dialect.FulltextQuery |
analyzeFulltextQuery(java.lang.String query)
Analyzes a fulltext query into a generic datastructure that can be used for each specific database. |
char |
closeQuote()
|
boolean |
connectionClosedByException(java.lang.Throwable t)
Checks if an exception received means that the low level connection has been trashed and must be reset. |
java.sql.Array |
createArrayOf(int type,
java.lang.Object[] elements,
java.sql.Connection connection)
Factory method for creating Array objects, suitable for passing to PreparedStatement.setArray(int, java.sql.Array) . |
static Dialect |
createDialect(java.sql.Connection connection,
BinaryManager binaryManager,
RepositoryDescriptor repositoryDescriptor)
Creates a Dialect by connecting to the datasource to check what
database is used. |
abstract boolean |
doesUpdateFromRepeatSelf()
When doing an UPDATE t SET ... |
void |
existingTableDetected(java.sql.Connection connection,
Table table,
Model model,
Database database)
Called after an existing table has been detected in the database. |
static boolean |
fulltextHasPhrase(Dialect.FulltextQuery ft)
Checks if a fulltext search has a phrase in it. |
java.lang.String |
getAddColumnString()
|
java.lang.String |
getAddForeignKeyConstraintString(java.lang.String constraintName,
java.lang.String[] foreignKeys,
java.lang.String referencedTable,
java.lang.String[] primaryKeys,
boolean referencesPrimaryKey)
|
java.lang.String |
getAddPrimaryKeyConstraintString(java.lang.String constraintName)
|
BinaryManager |
getBinaryManager()
|
java.lang.String |
getCascadeDropConstraintsString()
|
java.lang.String |
getClobCast(boolean inOrderBy)
When using a CLOB field in an expression, is some casting required and with what pattern? |
java.lang.String |
getClusterDeleteInvalidations()
Gets the SQL to delete invalidations for this cluster node. |
java.lang.String |
getClusterGetInvalidations()
Gets the SQL to query invalidations for this cluster node. |
java.lang.String |
getClusterInsertInvalidations()
Gets the SQL to send an invalidation to the cluster. |
java.lang.String |
getConnectionSchema(java.sql.Connection connection)
Gets the schema to use to query metadata about existing tables. |
abstract java.lang.String |
getCreateFulltextIndexSql(java.lang.String indexName,
java.lang.String quotedIndexName,
Table table,
java.util.List<Column> columns,
Model model)
Gets a CREATE INDEX statement for a fulltext index. |
java.lang.String |
getCreateIndexSql(java.lang.String indexName,
java.lang.String tableName,
java.util.List<java.lang.String> columnNames)
Gets a CREATE INDEX statement for a normal index. |
abstract java.lang.String |
getDialectFulltextQuery(java.lang.String query)
Get the dialect-specific version of a fulltext query. |
java.lang.String |
getForeignKeyConstraintName(java.lang.String tableName,
java.lang.String foreignColumnName,
java.lang.String foreignTableName)
|
java.lang.String |
getFreeVariableSetterForType(ColumnType type)
Gets the JDBC expression setting a free value for this column type. |
abstract java.io.Serializable |
getFromResultSet(java.sql.ResultSet rs,
int index,
Column column)
|
abstract int |
getFulltextIndexedColumns()
Specifies what columns of the fulltext table have to be indexed. |
abstract Dialect.FulltextMatchInfo |
getFulltextScoredMatchInfo(java.lang.String fulltextQuery,
java.lang.String indexName,
int nthMatch,
Column mainColumn,
Model model,
Database database)
Gets the SQL information needed to do a a fulltext match, either with a direct expression in the WHERE clause, or using a join with an additional table. |
int |
getFulltextType()
Gets the type of a fulltext column has known by JDBC. |
java.lang.String |
getIndexName(java.lang.String tableName,
java.util.List<java.lang.String> columnNames)
|
abstract java.lang.String |
getInTreeSql(java.lang.String idColumnName)
Gets the expression to use to check tree membership. |
abstract Dialect.JDBCInfo |
getJDBCTypeAndString(ColumnType type)
Gets the JDBC type and string from Nuxeo's type abstraction. |
abstract boolean |
getMaterializeFulltextSyntheticColumn()
Does the fulltext synthetic column have to be materialized. |
java.lang.String |
getNoColumnsInsertString()
|
java.lang.String |
getNullColumnString()
|
java.lang.String |
getPagingClause(long limit,
long offset)
Gets paging clause to be appended at the end of select statement |
java.util.List<java.lang.String> |
getPostCreateTableSqls(Table table,
Model model,
Database database)
Gets the sql statements to call after a table has been created. |
java.lang.String |
getReadAclsCheckSql(java.lang.String idColumnName)
Gets the expression to check if access is allowed using read acl the dialect must suppportsReadAcl |
java.lang.String |
getRebuildReadAclsSql()
Gets the statement to rebuild the wall read acls |
abstract java.lang.String |
getSecurityCheckSql(java.lang.String idColumnName)
Gets the expression to use to check security. |
abstract java.lang.String |
getSQLStatementsFilename()
Gets the name of the file containing the SQL statements. |
abstract java.util.Map<java.lang.String,java.io.Serializable> |
getSQLStatementsProperties(Model model,
Database database)
Gets the properties to use with the SQL statements. |
java.lang.String |
getTableTypeString(Table table)
|
abstract java.lang.String |
getTestSQLStatementsFilename()
|
java.lang.String |
getUpdateReadAclsSql()
Gets the statement to update the read acls |
boolean |
isAllowedConversion(int expected,
int actual,
java.lang.String actualName,
int actualSize)
Check mismatches between expected and actual JDBC types read from database introspection. |
boolean |
isClusteringDeleteNeeded()
Does clustering fetch of invalidations ( getClusterGetInvalidations() ) need a separate delete for them (
getClusterDeleteInvalidations() ). |
boolean |
isClusteringSupported()
Checks that clustering is supported. |
Dialect.JDBCInfo |
jdbcInfo(java.lang.String string,
int jdbcType)
|
boolean |
needsAliasForDerivedTable()
Whether a derived table (subselect in a FROM statement) needs an alias. |
boolean |
needsOracleJoins()
Whether implicit Oracle joins (instead of explicit ANSI joins) are needed. |
boolean |
needsOrderByKeysAfterDistinct()
When doing a SELECT DISTINCT that uses a ORDER BY, do the keys along which we order have to be mentioned in the DISTINCT clause? |
boolean |
needsOriginalColumnInGroupBy()
Whether a GROUP BY can only be used with the original column name and not an alias. |
char |
openQuote()
|
void |
performAdditionalStatements(java.sql.Connection connection)
Let the dialect processes additional statements after tables creation and conditional statements. |
boolean |
preCreateTable(java.sql.Connection connection,
Table table,
Model model,
Database database)
Called before a table is created, when it's been determined that it doesn't exist yet. |
boolean |
qualifyIndexName()
|
abstract void |
setToPreparedStatement(java.sql.PreparedStatement ps,
int index,
java.io.Serializable value,
Column column)
|
boolean |
storesUpperCaseIdentifiers()
|
boolean |
supportsAncestorsTable()
Checks if the dialect supports an ancestors table. |
boolean |
supportsArrays()
Does the dialect support passing ARRAY values (to stored procedures mostly). |
boolean |
supportsCircularCascadeDeleteConstraints()
|
boolean |
supportsIfExistsAfterTableName()
|
boolean |
supportsIfExistsBeforeTableName()
|
boolean |
supportsIlike()
Does the dialect support ILIKE operator |
boolean |
supportsMultipleFulltextIndexes()
SQL Server supports only one fulltext index. |
boolean |
supportsPaging()
Indicates if dialect supports paging |
boolean |
supportsReadAcl()
Does the dialect support an optimized read security checks |
abstract boolean |
supportsUpdateFrom()
Does the dialect support UPDATE t SET ... |
boolean |
supportsWith()
Does the dialect support SQL-99 WITH common table expressions. |
java.lang.String |
toBooleanValueString(boolean bool)
|
static java.lang.String |
toHexString(byte[] bytes)
|
static java.lang.String |
translateFulltext(Dialect.FulltextQuery ft,
java.lang.String or,
java.lang.String and,
java.lang.String andNot,
java.lang.String phraseQuote)
Translate fulltext into a common pattern used by many servers. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Dialect(java.sql.DatabaseMetaData metadata, BinaryManager binaryManager, RepositoryDescriptor repositoryDescriptor) throws StorageException
StorageException
Method Detail |
---|
public Dialect.JDBCInfo jdbcInfo(java.lang.String string, int jdbcType)
public static Dialect createDialect(java.sql.Connection connection, BinaryManager binaryManager, RepositoryDescriptor repositoryDescriptor) throws StorageException
Dialect
by connecting to the datasource to check what
database is used.
StorageException
- if a SQL connection problem occurspublic BinaryManager getBinaryManager()
public java.lang.String getConnectionSchema(java.sql.Connection connection) throws java.sql.SQLException
java.sql.SQLException
public abstract Dialect.JDBCInfo getJDBCTypeAndString(ColumnType type)
public boolean isAllowedConversion(int expected, int actual, java.lang.String actualName, int actualSize)
public abstract void setToPreparedStatement(java.sql.PreparedStatement ps, int index, java.io.Serializable value, Column column) throws java.sql.SQLException
java.sql.SQLException
public abstract java.io.Serializable getFromResultSet(java.sql.ResultSet rs, int index, Column column) throws java.sql.SQLException
java.sql.SQLException
public boolean storesUpperCaseIdentifiers()
public char openQuote()
public char closeQuote()
public java.lang.String toBooleanValueString(boolean bool)
public static java.lang.String toHexString(byte[] bytes)
public java.lang.String getForeignKeyConstraintName(java.lang.String tableName, java.lang.String foreignColumnName, java.lang.String foreignTableName)
public java.lang.String getIndexName(java.lang.String tableName, java.util.List<java.lang.String> columnNames)
public java.lang.String getCreateIndexSql(java.lang.String indexName, java.lang.String tableName, java.util.List<java.lang.String> columnNames)
public abstract int getFulltextIndexedColumns()
public boolean supportsMultipleFulltextIndexes()
public abstract boolean getMaterializeFulltextSyntheticColumn()
public abstract java.lang.String getCreateFulltextIndexSql(java.lang.String indexName, java.lang.String quotedIndexName, Table table, java.util.List<Column> columns, Model model)
public static Dialect.FulltextQuery analyzeFulltextQuery(java.lang.String query)
List of terms containing only negative words are suppressed. Otherwise negative words are put at the end of the lists of terms.
public static java.lang.String translateFulltext(Dialect.FulltextQuery ft, java.lang.String or, java.lang.String and, java.lang.String andNot, java.lang.String phraseQuote)
public static boolean fulltextHasPhrase(Dialect.FulltextQuery ft)
public abstract java.lang.String getDialectFulltextQuery(java.lang.String query)
query
- the CMIS-syntax-based fulltext query string
public abstract Dialect.FulltextMatchInfo getFulltextScoredMatchInfo(java.lang.String fulltextQuery, java.lang.String indexName, int nthMatch, Column mainColumn, Model model, Database database)
public boolean supportsPaging()
public java.lang.String getPagingClause(long limit, long offset)
public int getFulltextType()
This is used for setNull.
public java.lang.String getFreeVariableSetterForType(ColumnType type)
Needed for columns that need an expression around the value being set,
usually for conversion (this is the case for PostgreSQL fulltext
TSVECTOR
columns for instance).
type
- the column type
public java.lang.String getNoColumnsInsertString()
public java.lang.String getNullColumnString()
public java.lang.String getTableTypeString(Table table)
public java.lang.String getAddPrimaryKeyConstraintString(java.lang.String constraintName)
public java.lang.String getAddForeignKeyConstraintString(java.lang.String constraintName, java.lang.String[] foreignKeys, java.lang.String referencedTable, java.lang.String[] primaryKeys, boolean referencesPrimaryKey)
public boolean qualifyIndexName()
public boolean supportsIfExistsBeforeTableName()
public boolean supportsIfExistsAfterTableName()
public java.lang.String getCascadeDropConstraintsString()
public boolean supportsCircularCascadeDeleteConstraints()
public java.lang.String getAddColumnString()
public abstract boolean supportsUpdateFrom()
public abstract boolean doesUpdateFromRepeatSelf()
public boolean needsOrderByKeysAfterDistinct()
public boolean needsAliasForDerivedTable()
public boolean needsOriginalColumnInGroupBy()
public boolean needsOracleJoins()
public java.lang.String getClobCast(boolean inOrderBy)
Needed for Derby and H2.
inOrderBy
- true
if the expression is for an ORDER BY column
null
if no cast is
requiredpublic abstract java.lang.String getSecurityCheckSql(java.lang.String idColumnName)
idColumnName
- the quoted name of the id column to use
public boolean supportsAncestorsTable()
public abstract java.lang.String getInTreeSql(java.lang.String idColumnName)
idColumnName
- the quoted name of the id column to use
public boolean supportsArrays()
If not, we'll simulate them using a string and a separator.
public java.sql.Array createArrayOf(int type, java.lang.Object[] elements, java.sql.Connection connection) throws java.sql.SQLException
PreparedStatement.setArray(int, java.sql.Array)
.
(An equivalent method is defined by JDBC4 on the Connection
class.)
type
- the SQL type of the elementselements
- the elements of the arrayconnection
- the connection
java.sql.SQLException
public abstract java.lang.String getSQLStatementsFilename()
public abstract java.lang.String getTestSQLStatementsFilename()
public abstract java.util.Map<java.lang.String,java.io.Serializable> getSQLStatementsProperties(Model model, Database database)
public boolean isClusteringSupported()
public boolean isClusteringDeleteNeeded()
getClusterGetInvalidations()
) need a separate delete for them (
getClusterDeleteInvalidations()
).
public java.lang.String getClusterInsertInvalidations()
public java.lang.String getClusterGetInvalidations()
public java.lang.String getClusterDeleteInvalidations()
public boolean supportsIlike()
public boolean supportsReadAcl()
public boolean supportsWith()
public java.lang.String getUpdateReadAclsSql()
public java.lang.String getRebuildReadAclsSql()
public java.lang.String getReadAclsCheckSql(java.lang.String idColumnName)
idColumnName
- the quoted name of the read acl_id column to use
public boolean preCreateTable(java.sql.Connection connection, Table table, Model model, Database database) throws java.sql.SQLException
false
if the table must actually not be created
java.sql.SQLException
public java.util.List<java.lang.String> getPostCreateTableSqls(Table table, Model model, Database database)
Used for migrations/upgrades.
public void existingTableDetected(java.sql.Connection connection, Table table, Model model, Database database) throws java.sql.SQLException
Used for migrations/upgrades.
java.sql.SQLException
public boolean connectionClosedByException(java.lang.Throwable t)
public void performAdditionalStatements(java.sql.Connection connection) throws java.sql.SQLException
connection
-
java.sql.SQLException
|
Nuxeo Enterprise Platform 5.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |