Class SQLInfo
java.lang.Object
org.nuxeo.ecm.core.storage.sql.jdbc.SQLInfo
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
executeSQLStatements
(String category, String ddlMode, Connection connection, JDBCLogger logger, SQLStatement.ListCollector ddlCollector) Executes the SQL statements for the given category.int
getCopyHier
(boolean explicitName, boolean resetVersion) getCopyIdColumn
(String tableName) getCopySql
(String tableName) getDeleteSql
(String tableName) Returns the SQLDELETE
to delete a row.getDeleteSql
(String tableName, int n) Returns the SQLDELETE
to delete several rows.getIdEqualsClause
(String tableName) Returns the clause used to match a given row by id in the given table.getInsertColumns
(String tableName) Returns the list of columns to use for anINSERT
statementgetInsertSql(java.lang.String)
.getInsertSql
(String tableName) Returns the SQLINSERT
to add a row.int
Select all ancestors ids for several fragments.getSelectChildrenIdsAndTypesSql
(boolean excludeSpecialChildren, boolean excludeRegularChildren) getSelectChildrenNodeInfos
(int nids) Selects all children (not complex) for several parent ids.getSelectFragmentsByIds
(String tableName, int nids) Select by ids for all values of several fragments.getSelectFragmentsByIds
(String tableName, int nids, String[] orderBys, Set<String> skipColumns) Select by ids for all values of several fragments (maybe ordered along columns -- for collection fragments retrieval).getSelection
(SelectionType type) getSelectParentIds
(int nids) Select parentid by ids for all values of several fragments.Returns null orAND isdeleted IS NULL
if soft delete is activated.getSoftDeleteClause
(String tableName) ReturnsAND isdeleted IS NULL
if this is the hierarchy table and soft delete is activated.Returns the SQL to clean (hard-delete) soft-deleted rows.Returns the SQL to soft-delete several rows.getUpdateById
(String tableName, RowMapper.RowUpdate rowu) UPDATE tableName SET key1 = ?getUpdateByIdForKeys
(String tableName, List<String> keys) protected void
Creates the SQL for the table holding ancestors information.protected void
protected void
initFragmentSQL
(String tableName) Creates the SQL for one fragment (simple or collection).protected void
Creates the SQL for the table holding hierarchy information.protected void
Creates the SQL for the table holding global repository information.protected void
protected void
protected void
initSQL
(boolean requiresClusterSQL) Creates all the sql from the models.void
initSQLStatements
(Map<String, Serializable> testProps, List<String> sqlInitFiles) makeSelect
(Table table, String[] orderBys, String... freeColumns) Basic SELECT x, y, z FROM table WHERE a = ?makeSelect
(Table table, String from, List<String> clauses, String[] orderBys, String... freeColumns) Same as above but the FROM can be passed in, to allow JOINs.
-
Field Details
-
database
-
dialect
-
softDeleteEnabled
public final boolean softDeleteEnabled -
proxiesEnabled
public final boolean proxiesEnabled -
selectFragmentById
-
createClusterNodeSql
-
createClusterNodeColumns
-
deleteClusterNodeSql
-
deleteClusterNodeColumn
-
deleteClusterInvalsSql
-
deleteClusterInvalsColumn
-
clusterInvalidationsColumns
-
sqlStatements
-
sqlStatementsProperties
-
getBinariesSql
-
getBinariesColumns
-
-
Constructor Details
-
SQLInfo
- Parameters:
model
- the modeldialect
- the SQL dialect
-
-
Method Details
-
getDatabase
-
getSelectRootIdSql
-
getSelectRootIdWhatColumn
-
getInsertRootIdSql
-
getInsertRootIdColumns
-
getSelection
-
getSelectChildrenIdsAndTypesSql
public String getSelectChildrenIdsAndTypesSql(boolean excludeSpecialChildren, boolean excludeRegularChildren) -
getSelectChildrenIdsAndTypesWhatColumns
-
getSelectDescendantsInfoSql
-
getSelectDescendantsInfoWhatColumns
-
getCreateClusterNodeSql
-
getCreateClusterNodeColumns
-
getDeleteClusterNodeSql
-
getDeleteClusterNodeColumn
-
getDeleteClusterInvalsSql
-
getDeleteClusterInvalsColumn
-
getClusterNodeIdType
public int getClusterNodeIdType() -
getClusterInvalidationsColumns
-
getInsertSql
Returns the SQLINSERT
to add a row. The columns that represent sequences that are implicitly auto-incremented aren't included.- Parameters:
tableName
- the table name- Returns:
- the SQL
INSERT
statement
-
getInsertColumns
Returns the list of columns to use for anINSERT
statementgetInsertSql(java.lang.String)
.- Parameters:
tableName
- the table name- Returns:
- the list of columns
-
getIdEqualsClause
Returns the clause used to match a given row by id in the given table.Takes into account soft deletes.
- Parameters:
tableName
- the table name- Returns:
- the clause, like
table.id = ?
-
getSoftDeleteClause
ReturnsAND isdeleted IS NULL
if this is the hierarchy table and soft delete is activated.- Parameters:
tableName
- the table name- Returns:
- the clause
-
getSoftDeleteClause
Returns null orAND isdeleted IS NULL
if soft delete is activated.- Returns:
- the clause, or null
-
getUpdateById
UPDATE tableName SET key1 = ?, key2 = ?, ... WHERE id = ? AND condition1 = ? AND condition2 IS NULL ...
-
getUpdateByIdForKeys
-
getSelectFragmentsByIds
Select by ids for all values of several fragments. -
getSelectFragmentsByIds
public SQLInfo.SQLInfoSelect getSelectFragmentsByIds(String tableName, int nids, String[] orderBys, Set<String> skipColumns) Select by ids for all values of several fragments (maybe ordered along columns -- for collection fragments retrieval). -
getSelectAncestorsIds
Select all ancestors ids for several fragments.Fast alternative to the slowest iterative
getSelectParentIds(int)
.- Returns:
- null if it's not possible in one call in this dialect
-
getSelectParentIds
Select parentid by ids for all values of several fragments. -
getSelectChildrenNodeInfos
Selects all children (not complex) for several parent ids. -
getDeleteSql
Returns the SQLDELETE
to delete a row. The primary key columns are free parameters.- Parameters:
tableName
- the table name- Returns:
- the SQL
DELETE
statement
-
getDeleteSql
Returns the SQLDELETE
to delete several rows. The primary key columns are free parameters.- Parameters:
tableName
- the table namen
- the number of rows to delete- Returns:
- the SQL
DELETE
statement with aIN
for the keys
-
getSoftDeleteSql
Returns the SQL to soft-delete several rows. The array of ids and the time are free parameters.- Returns:
- the SQL statement
-
getSoftDeleteCleanupSql
Returns the SQL to clean (hard-delete) soft-deleted rows. The max and beforeTime are free parameters.- Returns:
- the SQL statement
-
getCopyHier
-
getCopySql
-
getCopyIdColumn
-
initSQL
protected void initSQL(boolean requiresClusterSQL) Creates all the sql from the models. -
initClusterSQL
protected void initClusterSQL() -
initRepositorySQL
protected void initRepositorySQL()Creates the SQL for the table holding global repository information. This includes the id of the hierarchy root node. -
initHierarchySQL
protected void initHierarchySQL()Creates the SQL for the table holding hierarchy information. -
initSelectDescendantsSQL
protected void initSelectDescendantsSQL() -
initAncestorsSQL
protected void initAncestorsSQL()Creates the SQL for the table holding ancestors information.This table holds trigger-updated information extracted from the recursive parent-child relationship in the hierarchy table.
-
initFragmentSQL
Creates the SQL for one fragment (simple or collection). -
initSelections
protected void initSelections() -
makeSelect
Basic SELECT x, y, z FROM table WHERE a = ? AND b = ?with optional ORDER BY x, y DESC
-
makeSelect
public SQLInfo.SQLInfoSelect makeSelect(Table table, String from, List<String> clauses, String[] orderBys, String... freeColumns) Same as above but the FROM can be passed in, to allow JOINs. -
initSQLStatements
public void initSQLStatements(Map<String, Serializable> testProps, List<String> sqlInitFiles) throws IOException- Throws:
IOException
-
executeSQLStatements
public void executeSQLStatements(String category, String ddlMode, Connection connection, JDBCLogger logger, SQLStatement.ListCollector ddlCollector) throws SQLException Executes the SQL statements for the given category.- Throws:
SQLException
-
getMaximumArgsForIn
public int getMaximumArgsForIn()
-