public class SqlUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.List<java.lang.String> |
JAILER_MH_TABLES
List of all jailer tables (upper case).
|
static java.util.List<java.lang.String> |
JAILER_TABLES
List of all jailer tables (upper case).
|
static java.lang.String |
LETTERS_AND_DIGITS |
static java.util.Map<java.lang.Integer,java.lang.String> |
SQL_TYPE
Maps SQL types from
Types to clear text types. |
Constructor and Description |
---|
SqlUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
columnLabel(Quoting quoting,
Session session,
DBMS targetDBMSConfiguration,
Table table,
java.lang.String columnLabel) |
static int |
getColumnType(java.sql.ResultSet resultSet,
java.sql.ResultSetMetaData resultSetMetaData,
int i,
java.util.Map<java.lang.Integer,java.lang.Integer> typeCache)
Gets type of column from result-set.
|
static int |
getColumnType(java.sql.ResultSet resultSet,
java.sql.ResultSetMetaData resultSetMetaData,
java.lang.String columnName,
java.util.Map<java.lang.String,java.lang.Integer> typeCache)
Gets type of column from result-set.
|
static java.lang.String |
mappedSchema(java.util.Map<java.lang.String,java.lang.String> schemaMapping,
java.lang.String tableName)
Replaces schema of qualified table name according to a schema-map.
|
static java.lang.String |
normalizeRestrictionCondition(java.lang.String cond) |
static java.util.Set<Table> |
readTableList(CsvFile tableFile,
DataModel dataModel,
java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping)
Reads a table-list from CSV-file.
|
static java.lang.String |
removeNonMeaningfulFragments(java.lang.String sqlStatement)
Removes all non-meaningful fragments of an SQL statement
that might interfere with the SQL parser.
|
static java.lang.String |
replaceAlias(java.lang.String condition,
java.lang.String alias)
Replaces the alias T with given alias in a SQL-condition.
|
static java.lang.String |
replaceAliases(java.lang.String condition,
java.lang.String aliasA,
java.lang.String aliasB)
Replaces the aliases A and B with given aliases in a SQL-condition.
|
static java.lang.String |
resolvePseudoColumns(java.lang.String condition,
int today,
int birthdayOfSubject,
boolean reversed,
boolean inDeleteMode)
Resolves the pseudo-columns in a restriction condition.
|
static java.lang.String |
resolvePseudoColumns(java.lang.String condition,
java.lang.String entityAAlias,
java.lang.String entityBAlias,
int today,
int birthdayOfSubject,
boolean inDeleteMode)
Resolves the pseudo-columns in a restriction condition.
|
static java.lang.String |
resolvePseudoColumns(java.lang.String condition,
java.lang.String entityAAlias,
java.lang.String entityBAlias,
int today,
int birthdayOfSubject,
java.lang.String birthdayColumnName,
java.lang.Boolean inDeleteMode)
Resolves the pseudo-columns in a restriction condition.
|
static java.lang.String |
reversRestrictionCondition(java.lang.String condition)
Change alias A to B and B to A in a SQL-condition.
|
static java.lang.String |
splitDMLStatement(java.lang.String sql,
int maxLength)
Splits a DML statement into several lines with limited length.
|
static java.lang.String |
toString(java.math.BigDecimal content) |
static java.lang.String |
toString(java.lang.Double content) |
public static final java.util.List<java.lang.String> JAILER_TABLES
public static final java.util.List<java.lang.String> JAILER_MH_TABLES
public static final java.lang.String LETTERS_AND_DIGITS
public static final java.util.Map<java.lang.Integer,java.lang.String> SQL_TYPE
Types
to clear text types.public static java.lang.String reversRestrictionCondition(java.lang.String condition)
condition
- the conditionpublic static java.lang.String replaceAliases(java.lang.String condition, java.lang.String aliasA, java.lang.String aliasB)
condition
- the conditionaliasA
- alias for AaliasB
- alias for Bpublic static java.lang.String replaceAlias(java.lang.String condition, java.lang.String alias)
condition
- the conditionalias
- alias for Tpublic static java.lang.String resolvePseudoColumns(java.lang.String condition, java.lang.String entityAAlias, java.lang.String entityBAlias, int today, int birthdayOfSubject, boolean inDeleteMode)
condition
- the conditionentityAAlias
- alias for entity table joined with AentityBAlias
- alias for entity table joined with BbirthdayOfSubject
- birthday of subjecttoday
- todayinDeleteMode
- public static java.lang.String resolvePseudoColumns(java.lang.String condition, java.lang.String entityAAlias, java.lang.String entityBAlias, int today, int birthdayOfSubject, java.lang.String birthdayColumnName, java.lang.Boolean inDeleteMode)
condition
- the conditionentityAAlias
- alias for entity table joined with AentityBAlias
- alias for entity table joined with BbirthdayOfSubject
- birthday of subjecttoday
- todaybirthdayColumnName
- name of the column which holds the birthday of an entity ('birthday' or 'orig_birthday')inDeleteMode
- public static java.lang.String resolvePseudoColumns(java.lang.String condition, int today, int birthdayOfSubject, boolean reversed, boolean inDeleteMode)
condition
- the conditionbirthdayOfSubject
- birthday of subjecttoday
- todayreversed
- inDeleteMode
- public static java.util.Set<Table> readTableList(CsvFile tableFile, DataModel dataModel, java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping)
dataModel
- to get tables fromtableFile
- the file containing the listpublic static java.lang.String mappedSchema(java.util.Map<java.lang.String,java.lang.String> schemaMapping, java.lang.String tableName)
schemaMapping
- the mappingtableName
- the table namepublic static int getColumnType(java.sql.ResultSet resultSet, java.sql.ResultSetMetaData resultSetMetaData, int i, java.util.Map<java.lang.Integer,java.lang.Integer> typeCache) throws java.sql.SQLException
resultSet
- result-seti
- column indextypeCache
- for caching typesTypes
java.sql.SQLException
public static int getColumnType(java.sql.ResultSet resultSet, java.sql.ResultSetMetaData resultSetMetaData, java.lang.String columnName, java.util.Map<java.lang.String,java.lang.Integer> typeCache) throws java.sql.SQLException
resultSet
- result-setcolumnName
- column nametypeCache
- for caching typesjava.sql.SQLException
public static java.lang.String splitDMLStatement(java.lang.String sql, int maxLength)
sql
- the DML statementmaxLength
- maximum line lengthpublic static java.lang.String toString(java.lang.Double content)
public static java.lang.String toString(java.math.BigDecimal content)
public static java.lang.String normalizeRestrictionCondition(java.lang.String cond)
public static java.lang.String removeNonMeaningfulFragments(java.lang.String sqlStatement)
sqlStatement
-