T - the type parameterS - the type parameterpublic abstract class BaseTransactionalExecutor<T,S extends Statement> extends Object implements Executor<T>
| Modifier and Type | Field and Description |
|---|---|
protected SQLRecognizer |
sqlRecognizer
The Sql recognizer.
|
protected List<SQLRecognizer> |
sqlRecognizers
The Sql recognizer.
|
protected StatementCallback<T,S> |
statementCallback
The Statement callback.
|
protected StatementProxy<S> |
statementProxy
The Statement proxy.
|
| Constructor and Description |
|---|
BaseTransactionalExecutor(StatementProxy<S> statementProxy,
StatementCallback<T,S> statementCallback,
List<SQLRecognizer> sqlRecognizers)
Instantiates a new Base transactional executor.
|
BaseTransactionalExecutor(StatementProxy<S> statementProxy,
StatementCallback<T,S> statementCallback,
SQLRecognizer sqlRecognizer)
Instantiates a new Base transactional executor.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildLimitCondition(WhereRecognizer recognizer,
ArrayList<List<Object>> paramAppenderList)
build buildLimitCondition
|
protected String |
buildLockKey(TableRecords rowsIncludingPK)
build lockKey
|
protected String |
buildOrderCondition(WhereRecognizer recognizer,
ArrayList<List<Object>> paramAppenderList)
build buildOrderCondition
|
protected TableRecords |
buildTableRecords(Map<String,List<Object>> pkValuesMap)
build TableRecords
|
protected TableRecords |
buildTableRecords(TableMeta tableMeta,
String selectSQL,
ArrayList<List<Object>> paramAppenderList)
build a BeforeImage
|
protected SQLUndoLog |
buildUndoItem(TableRecords beforeImage,
TableRecords afterImage)
build a SQLUndoLog
|
protected String |
buildWhereCondition(WhereRecognizer recognizer,
ArrayList<List<Object>> paramAppenderList)
build buildWhereCondition
|
protected boolean |
containPK(String columnName)
compare column name and primary key name
|
protected boolean |
containsPK(List<String> columns)
the columns contains table meta pk
|
protected boolean |
containsPK(String tableName,
List<String> columns)
the columns contains table meta pk
|
protected abstract T |
doExecute(Object... args)
Do execute object.
|
T |
execute(Object... args)
Execute t.
|
protected String |
getColumnNameInSQL(String columnName)
Gets column name in sql.
|
protected String |
getColumnNamesInSQL(List<String> columnNameList)
Gets several column name in sql.
|
protected List<String> |
getColumnNamesInSQLList(List<String> columnNames)
Gets column names in sql.
|
protected String |
getColumnNamesWithTablePrefix(String table,
String tableAlias,
List<String> columnNameList)
Gets several column name in sql.
|
protected List<String> |
getColumnNamesWithTablePrefixList(String table,
String tableAlias,
List<String> columnNames)
Gets column name with table prefix
|
protected String |
getColumnNameWithTablePrefix(String table,
String tableAlias,
String columnName)
Gets column name with table prefix
|
protected String |
getDbType()
get db type
|
protected String |
getFromTableInSQL()
Gets from table in sql.
|
protected List<String> |
getNeedColumns(String table,
String tableAlias,
List<String> unescapeColumns) |
protected String |
getStandardPkColumnName(String userColumnName)
get standard pk column name from user sql column name
|
protected TableMeta |
getTableMeta()
Gets table meta.
|
protected TableMeta |
getTableMeta(String tableName)
Gets table meta.
|
protected void |
prepareUndoLog(TableRecords beforeImage,
TableRecords afterImage)
prepare undo log.
|
protected void |
validPk(String pkVal)
validate that the primary key is free of illegal characters
|
protected StatementProxy<S extends Statement> statementProxy
protected StatementCallback<T,S extends Statement> statementCallback
protected SQLRecognizer sqlRecognizer
protected List<SQLRecognizer> sqlRecognizers
public BaseTransactionalExecutor(StatementProxy<S> statementProxy, StatementCallback<T,S> statementCallback, SQLRecognizer sqlRecognizer)
statementProxy - the statement proxystatementCallback - the statement callbacksqlRecognizer - the sql recognizerpublic BaseTransactionalExecutor(StatementProxy<S> statementProxy, StatementCallback<T,S> statementCallback, List<SQLRecognizer> sqlRecognizers)
statementProxy - the statement proxystatementCallback - the statement callbacksqlRecognizers - the multi sql recognizerpublic T execute(Object... args) throws Throwable
Executorprotected abstract T doExecute(Object... args) throws Throwable
args - the argsThrowable - the throwableprotected String buildWhereCondition(WhereRecognizer recognizer, ArrayList<List<Object>> paramAppenderList)
recognizer - the recognizerparamAppenderList - the param paramAppender listprotected String buildOrderCondition(WhereRecognizer recognizer, ArrayList<List<Object>> paramAppenderList)
recognizer - paramAppenderList - protected String buildLimitCondition(WhereRecognizer recognizer, ArrayList<List<Object>> paramAppenderList)
recognizer - paramAppenderList - protected String getColumnNameWithTablePrefix(String table, String tableAlias, String columnName)
table - the table nametableAlias - the tableAliascolumnName - the column nameprotected List<String> getColumnNamesWithTablePrefixList(String table, String tableAlias, List<String> columnNames)
table - the table nametableAlias - the tableAliascolumnNames - the column namesprotected String getColumnNamesWithTablePrefix(String table, String tableAlias, List<String> columnNameList)
table - the tabletableAlias - the table aliascolumnNameList - the column nameprotected String getColumnNameInSQL(String columnName)
columnName - the column nameprotected List<String> getColumnNamesInSQLList(List<String> columnNames)
columnNames - the column namesprotected String getColumnNamesInSQL(List<String> columnNameList)
columnNameList - the column nameprotected String getFromTableInSQL()
protected TableMeta getTableMeta()
protected TableMeta getTableMeta(String tableName)
tableName - the table nameprotected boolean containsPK(List<String> columns)
columns - the column name listprotected boolean containsPK(String tableName, List<String> columns)
tableName - the tableNamecolumns - the column name listprotected boolean containPK(String columnName)
columnName - the primary key column nameprotected String getStandardPkColumnName(String userColumnName)
userColumnName - the user column nameprotected void prepareUndoLog(TableRecords beforeImage, TableRecords afterImage) throws SQLException
beforeImage - the before imageafterImage - the after imageSQLException - the sql exceptionprotected void validPk(String pkVal)
pkVal - primary key valueprotected String buildLockKey(TableRecords rowsIncludingPK)
rowsIncludingPK - the recordsprotected SQLUndoLog buildUndoItem(TableRecords beforeImage, TableRecords afterImage)
beforeImage - the before imageafterImage - the after imageprotected TableRecords buildTableRecords(TableMeta tableMeta, String selectSQL, ArrayList<List<Object>> paramAppenderList) throws SQLException
tableMeta - the tableMetaselectSQL - the selectSQLparamAppenderList - the paramAppender listSQLException - the sql exceptionprotected TableRecords buildTableRecords(Map<String,List<Object>> pkValuesMap) throws SQLException
pkValuesMap - the pkValuesMapSQLException - the sql exceptionprotected List<String> getNeedColumns(String table, String tableAlias, List<String> unescapeColumns)
protected String getDbType()
Copyright © 2024 Apache. All rights reserved.