public class MariaDbLenientDialect extends Dialect
Dialect for an MariaDb/MySql backend. This is a lenient implementation and not all
4GL features are supported. The customer which uses this is responsible for any unexpected results of
processing his data in lenient (non-strict) mode.Dialect.WeightAggregator| Modifier and Type | Field and Description |
|---|---|
private static int |
BPC
The number of bytes per character in the used text encoding (assuming utf8mb4 / utf32) used when
computing the space requirements.
|
static java.lang.String |
DIALECT_ID
The id of this dialect variant as a string.
|
protected static java.util.Map<java.lang.String,java.lang.String> |
fwd2sql
Mapping between the FWD possible field/column types and their SQL counterparts.
|
protected static java.sql.Date |
highDate
Highest date supported by MariaDb (?)
|
private static int |
INDEX_MAX_KEY_SIZE
The maximum key size in a MariaDb index.
|
private static boolean |
inlineRangeParms
Flag indicating whether range parameters should be inlined
|
private static CentralLogger |
LOG
Logger
|
protected static java.sql.Date |
lowDate
Lowest date supported by MariaDb (?)
|
protected static int |
MAX_VARCHAR_SIZE
The maximum size of a character / VARCHAR field in MariaDb.
|
protected static int |
MIN_TEXT_SIZE
The limit at which VARCHAR columns are converted to TEXT columns in MariaDb.
|
protected static java.util.regex.Pattern |
UDF_ERROR_MESSAGE
Regex Pattern for parsing message cased by error raised by UDF.
|
private static boolean |
udf4contains |
CASE_TYPE_TOK, DEFAULT_MAX_WIDTH, SCALE_TOK| Constructor and Description |
|---|
MariaDbLenientDialect() |
| Modifier and Type | Method and Description |
|---|---|
void |
activateErrorHandler(java.sql.Connection conn)
Activate error handler at the database side.
|
void |
addRtrimmedExpression(java.lang.String expr,
java.lang.StringBuilder sb)
Composes a
rtrim equivalent call for a specified expression. |
java.sql.Blob |
blobCreator(java.sql.Connection conn,
byte[] bytes)
Create a
Blob instance from the specified bytes. |
java.lang.String |
buildRemoteURL(java.lang.String url,
Database database)
Build the URL to be used for a remote connection, based on the given URL and database.
|
java.lang.String |
checkErrorFn()
Get name of the checkError UDF.
|
void |
checkIndexConstraints(P2JIndex p2JIndex,
java.util.Map<java.lang.String,P2JField> fields)
This dialect has a constraints of 3KiB on the index key size.
|
java.sql.Clob |
clobCreator(java.sql.Connection conn,
java.lang.String value)
Create a
Clob instance from the specified value. |
java.lang.Class<? extends com.mchange.v2.c3p0.AbstractConnectionCustomizer> |
connectionCustomizer(DatabaseConfig cfg)
Get c3p0 ConnectionCustomizer class for the dialect.
|
SequenceHandler |
createSequenceHandler(java.lang.String ldbName)
Creates and returns a
SequenceHandler for a database. |
ErrorManager.ErrorEntry |
errorEntry(java.lang.String message)
Create the error descriptor from the
SQLException message |
boolean |
explicitSetCollation()
Check if the dialect needs to set an explicit collation during schema DDL generation.
|
java.lang.String |
extractColumnName(java.lang.String expr)
Given a column expression as queried from database metadata, extract the root name of a column.
|
java.lang.String |
formatDate(date d)
Format a date object as a string which is appropriate for use in an SQL statement.
|
void |
generateWordTablesDDLImpl(java.lang.String dbName,
java.io.PrintStream out,
java.lang.String eoln,
java.util.Collection<WordTable> wordTables)
Worker method for
generateTriggerDDLs(). |
java.lang.String |
getAddForeignKeyConstraintString(java.lang.String table,
java.lang.String fkName,
java.lang.String fkFields,
java.lang.String refTable,
java.lang.String refFields,
java.lang.String indent,
java.lang.String eoln)
Creates and returns a string which represent the
alter table statement for adding a new
foreign key constraint. |
java.lang.String |
getAnalyzeString(java.lang.String table)
Construct and return a string which represents the
analyze or similar statements for this
dialect. |
java.lang.String |
getCatalogPattern(Database database)
Provides catalog matching pattern to load data correctly from JDBC.
|
java.lang.String |
getCodepage(java.sql.Connection conn)
Use the provided database connection to extract the codepage/CharSet used by the database and report it
back to the caller.
|
java.lang.String |
getCollation(java.sql.Connection conn)
Use the provided database connection to extract the collation used by the database and report it
back to the caller.
|
java.lang.String |
getComputedColumnFormula(java.lang.String colName,
boolean ignoreCase)
Returns the formula for character computed columns.
|
java.lang.String |
getComputedColumnPrefix(boolean caseSensitive)
Get the prefix, if any, which should be prepended to computed column and/or property names.
|
java.lang.String |
getCreateSequenceString(java.lang.String name)
Generate a DDL string which will create a global sequence with the given starting value.
|
java.lang.String |
getCreateSequenceString(java.lang.String name,
long start)
Generate a DDL string which will create a global sequence with the given starting value.
|
java.lang.String |
getCreateSequenceString(java.lang.String name,
java.lang.Long init,
java.lang.Long increment,
java.lang.Long minVal,
java.lang.Long maxVal,
java.lang.Boolean cycle)
Generate a DDL string which will create a sequence with given properties.
|
java.lang.String |
getCreateTemporaryTablePostfix(boolean noUndo)
Return the ending of the DDL statement that creates a temporary table.
|
java.lang.String |
getCreateTemporaryTableString(boolean ifNotExist)
Return the beginning of the DDL statement that creates a temporary table.
|
java.lang.String |
getDelimiter()
Get the statement delimiter for this dialect.
|
java.lang.String |
getDriverClassName()
Get the name of the JDBC driver class associated with this dialect.
|
java.lang.String |
getDropIndexString(boolean ifExists,
java.lang.String idxName,
java.lang.String tableName)
Obtain a DDL statement which drops a SQL index.
|
java.lang.String |
getDropIndexString(P2JIndex index)
Build the DDL to drop an index based upon the specified definition.
|
java.lang.String |
getDropSequenceString(java.lang.String name)
Generate a DDL string which will drop a sequence.
|
java.lang.String |
getDropTableString(boolean ifExists,
java.lang.String tableName)
Obtain a DDL statement which drops a SQL table.
|
java.lang.String |
getJdbcDatabaseType()
Get the name of the JDBC database type (as in JBC URL).
|
protected CentralLogger |
getLog()
Get the logger specific to this MariaDb dialect variant.
|
java.lang.String |
getProcessedCharacterColumnName(java.lang.String name,
boolean ignoreCase)
Adjust a character column name appropriate to this dialect, such that it can be inserted into an index.
|
static java.util.List<java.lang.String> |
getReservedKeywords()
Get a collection of reserved keywords specific to this dialect.
|
java.lang.String |
getSchemaPattern(Database database)
Provides schema matching pattern to load data correctly from JDBC.
|
ScriptRunner |
getScriptRunner()
Get a ScriptRunner instance for the dialect.
|
java.lang.String |
getSequenceCurrValString(java.lang.String sequenceName)
Generate the appropriate select statement to retrieve the current value of a sequence.
|
java.lang.String |
getSequenceNextValString(java.lang.String sequenceName)
Generate the appropriate select statement to retrieve the next value of a sequence.
|
java.lang.String |
getSequencePrefetchString(java.lang.String sequenceName)
Generate the appropriate select statement to pre-fetch multiple, ascending values from a sequence.
|
java.lang.String |
getSequenceSetValString()
Generate the appropriate select statement to reset the value of a sequence.
|
java.lang.String |
getSequenceSetValString(java.lang.String sequenceName)
Generate the appropriate select statement to reset the value of a sequence.
|
java.lang.String |
getSequenceSetValString(java.lang.String sequenceName,
long newVal)
Generate the appropriate select statement to reset the value of a sequence.
|
java.lang.String |
getSequenceSQL(Database database)
Provides SQL to load sequences.
|
java.lang.String |
getSpecificTypeAsString(FqlType type)
Converts and return the specified
FqlType to a string representation which can be used in a
SQL query (cast or other construct). |
java.lang.String |
getSqlMappedType(java.lang.String fwdType,
int scale,
java.lang.Boolean caseSensitive)
Get the SQL mapping for a specific FWD data type.
|
int |
getSyntheticIndexSize(boolean unique)
Returns the size of the synthetic part of the index.
|
java.util.regex.Pattern |
getUdfErrorMessagePattern()
Get regex Pattern for parsing message cased by error raised by UDF.
|
boolean |
hasFullSequenceSupport()
Returns
true if this dialect fully support the sequences as 4GL language (most important:
bounded values, cycle). |
java.lang.String |
id()
Get dialect id.
|
java.lang.String |
initErrorFn()
Get name of the initError UDF.
|
boolean |
injectComputedColumns()
This MariaDb dialect variant does NOT honour the "nulls last" feature of 4GL.
|
void |
inlineLimit(boolean on)
Enable/disable limit clause inlining.
|
boolean |
isAutoCi()
Returns
true if the dialect handles case-insensitive compare
operations for case-insensitive character columns |
boolean |
isAutoRtrim()
Returns
true if the dialect handles automatically rtrimming for
character columns. |
boolean |
isCaseInsensitiveColumn(java.lang.String name)
Report whether the given column name represents an alias or an expression which indicates the column is
case-insensitive.
|
boolean |
isComputedColumn(java.lang.String name)
Report whether the given column name represents an alias or an expression which indicates the column is
computed.
|
boolean |
isConnectionError(java.lang.Exception exc)
Given an exception, this method will check if it indicates a database connectivity error.
|
boolean |
isMetadataSortAsc(java.lang.String value)
Check if the given value is a descending clause for a column index.
|
boolean |
isMetadataSortDesc(java.lang.String value)
Check if the given value is an ascending clause for a column index.
|
boolean |
isNativeUDFsSupported()
Check if native UDFs are supported for the dialect.
|
boolean |
isQueryRangeParameterInlined()
Indicate whether a query parameter which is part of a range check should
be inlined into the where clause, or whether it should be substituted
into a prepared statement.
|
boolean |
isUdfOriginatedError(java.sql.SQLException e)
Check if the exception was caused by an error in UDF.
|
boolean |
isUdfOriginatedWarning(java.sql.SQLException e)
Check if the exception was caused by a warning in UDF.
|
boolean |
isUniqueConstraintViolation(java.sql.SQLException sqle)
Checks if the SQLState of the SQLException matches the dialect specific UNIQUE_VIOLATION
code for MariaDB (23000).
|
private static java.lang.String |
mapCollation(java.lang.String collation)
Maps the MariaDb specific collation names to 4GL collation names.
|
private static java.lang.String |
mapCP(java.lang.String collation)
Maps/extract from the MariaDb specific charset names to 4GL codepage names.
|
boolean |
needsComputedColumns()
Indicate whether this dialect requires computed columns to participate
within index definitions, instead of embedded expressions.
|
java.lang.String |
prepareMetadataParameter(java.lang.String param)
Prepare the given metadata query parameter.
|
void |
preparePermanentDatabase(Database db)
Prepare the specified database by creating all necessary function aliases and setting global parameters.
|
java.lang.String |
processMetadataResult(java.lang.String value)
Process the given metadata query result.
|
boolean |
requiresExplicitCastInsideTernary()
Determines whether substitution parameters should be explicitly cast to their datatypes inside
"then ? else ?" statement. |
void |
resetErrorHandler(java.sql.Connection conn)
Reset error handler at the database side.
|
ScriptSplitter |
scriptSplitter()
Get a new instance of a splitter for DDL scripts.
|
boolean |
supportsBooleanDatatype()
Indicates whether this dialect supports boolean datatype.
|
boolean |
supportsFunctionOverloading()
Indicate whether this dialect natively supports the overloading of user defined functions by parameter
number and data type.
|
ParmType |
translateToParmType(java.lang.String type,
java.lang.String comment)
Translation from database column type to
ParmType. |
boolean |
useUdf4Contains()
Check if UDF should be used for converted CONTAINS operator.
|
boolean |
useWordTables()
Check if word tables should be used for converted CONTAINS operator.
|
allowBindParamsInRecursiveCTE, allowDBUniqueCheck, allowSelectWildcard, beforeDriverLoad, computeIndexKeySize, containsUdfName, createContext, dialects, getComputedColumnString, getCreateIndexString, getCreateIndexString, getCreateIndexString, getCreateSequenceString, getCreateTableString, getDatabasePrepareStatements, getDecimals, getDialect, getDialect, getDialect, getHighDate, getIndexLengthLimit, getInvisibleSpecificator, getLimitString, getLowDate, getMaxEntriesInSelect, getMaxParameterCount, getSequenceCurrValString, getSqlIndexName, getSqlMappedType, isUdfContains, orderByNulls, postTransaction, preferDisjunctiveForm, quote, resolveBooleanConstant, supportsLazyQueryResultsMode, supportsVariableLimit, udfSchema, useCTE4Contains, useMixedNode4Contains, useNullEquality, weightAggregatorpublic static final java.lang.String DIALECT_ID
protected static final int MAX_VARCHAR_SIZE
protected static final int MIN_TEXT_SIZE
private static final int INDEX_MAX_KEY_SIZE
private static final int BPC
protected static final java.util.regex.Pattern UDF_ERROR_MESSAGE
protected static final java.sql.Date lowDate
protected static final java.sql.Date highDate
protected static final java.util.Map<java.lang.String,java.lang.String> fwd2sql
private static final CentralLogger LOG
private static boolean inlineRangeParms
private static boolean udf4contains
public static java.util.List<java.lang.String> getReservedKeywords()
The NameConverter uses thes list to create an exclusion
list of names so there will not be schema collisions with identifiers (tables, fields) from
the generated schema.
public java.lang.String id()
public java.lang.String getJdbcDatabaseType()
getJdbcDatabaseType in class Dialectpublic java.lang.String getDriverClassName()
getDriverClassName in class Dialectpublic java.lang.Class<? extends com.mchange.v2.c3p0.AbstractConnectionCustomizer> connectionCustomizer(DatabaseConfig cfg)
connectionCustomizer in class Dialectcfg - Database configuration.public void activateErrorHandler(java.sql.Connection conn)
throws java.sql.SQLException
activateErrorHandler in class Dialectconn - Database connectionjava.sql.SQLException - on error.public void resetErrorHandler(java.sql.Connection conn)
throws java.sql.SQLException
resetErrorHandler in class Dialectconn - Database connectionjava.sql.SQLException - on error.public ScriptSplitter scriptSplitter()
scriptSplitter in class Dialectpublic ScriptRunner getScriptRunner()
getScriptRunner in class Dialectpublic java.sql.Blob blobCreator(java.sql.Connection conn,
byte[] bytes)
Blob instance from the specified bytes.blobCreator in class Dialectconn - The JDBC connection.bytes - The blob data.public java.sql.Clob clobCreator(java.sql.Connection conn,
java.lang.String value)
Clob instance from the specified value.clobCreator in class Dialectconn - The JDBC connection.value - The clob data.public boolean useUdf4Contains()
useUdf4Contains in class Dialecttrue if UDF should be used for converted CONTAINS operator.public boolean useWordTables()
useWordTables in class Dialecttrue if tables should be used for converted CONTAINS operator.public boolean isNativeUDFsSupported()
isNativeUDFsSupported in class Dialecttrue since we want tho TEST this NEW feature.public java.lang.String checkErrorFn()
checkErrorFn in class Dialectpublic java.lang.String initErrorFn()
initErrorFn in class Dialectpublic boolean isUdfOriginatedError(java.sql.SQLException e)
isUdfOriginatedError in class Dialecte - The exception in question.true if the exception was caused by error in UDF.public java.util.regex.Pattern getUdfErrorMessagePattern()
public boolean isUdfOriginatedWarning(java.sql.SQLException e)
isUdfOriginatedWarning in class Dialecte - The exception in question.true if the exception was caused by error in UDF.public ErrorManager.ErrorEntry errorEntry(java.lang.String message)
SQLException messageerrorEntry in class Dialectmessage - SQLException messagepublic void generateWordTablesDDLImpl(java.lang.String dbName,
java.io.PrintStream out,
java.lang.String eoln,
java.util.Collection<WordTable> wordTables)
generateTriggerDDLs(). It generates the DDLs needed to create all
triggers in a database with a specific schema and using a certain dialect.generateWordTablesDDLImpl in class DialectdbName - The target schema.out - The PrintStream used for output.eoln - OS-specific end of line terminator.wordTables - The collection of word tables, ordered by name.public java.lang.String formatDate(date d)
YYYY-MM-DD.formatDate in class Dialectd - Date to be formatted as a string.public java.lang.String extractColumnName(java.lang.String expr)
Since the VARCHAR(n) datatype does not require the column to be processed in any way before
being added to an index, this method returns the parameter unchanged.
extractColumnName in class Dialectexpr - Expression containing column name as natively represented by the database dialect.public java.lang.String getProcessedCharacterColumnName(java.lang.String name,
boolean ignoreCase)
getProcessedCharacterColumnName in class Dialectname - Base column name.ignoreCase - true to cause case to be ignored, else false.public boolean isCaseInsensitiveColumn(java.lang.String name)
name is already determined to be the
appropriate data type for textual data.isCaseInsensitiveColumn in class Dialectname - Column name, alias, or expression.true if name represents case-insensitive data.public boolean needsComputedColumns()
needsComputedColumns in class Dialecttrue to indicate computed columns are required;
false if the backing database can embed an expression within an index definition.public boolean isAutoRtrim()
true if the dialect handles automatically rtrimming for
character columns.isAutoRtrim in class Dialectpublic boolean isAutoCi()
true if the dialect handles case-insensitive compare
operations for case-insensitive character columnspublic java.lang.String getComputedColumnPrefix(boolean caseSensitive)
getComputedColumnPrefix in class DialectcaseSensitive - true if this is a character field was declared with CASE-SENSITIVE attribute.
In each case the column name will be name-decorated differently.null if the backing database does not use computed
columns.needsComputedColumns()public java.lang.String getComputedColumnFormula(java.lang.String colName,
boolean ignoreCase)
binary
token.getComputedColumnFormula in class DialectcolName - The base column name.ignoreCase - true if this is a char field which has the "ignore case" flag set.public boolean isComputedColumn(java.lang.String name)
name is already determined to be the appropriate data
type for textual data.isComputedColumn in class Dialectname - Column name, alias, or expression.false.public boolean supportsFunctionOverloading()
supportsFunctionOverloading in class Dialectfalse since the backing database does not support overloading natively.public boolean supportsBooleanDatatype()
true and false literals;
supportsBooleanDatatype in class Dialecttrue if the above-mentioned items are supported or false if they are handled by
a replacement datatype (integer).public java.lang.String getCreateSequenceString(java.lang.String name)
getCreateSequenceString in class Dialectname - Sequence name.null if not supported.public java.lang.String getCreateSequenceString(java.lang.String name,
long start)
getCreateSequenceString in class Dialectname - Sequence name.start - Sequence starting value.null if not supported.public java.lang.String getCreateSequenceString(java.lang.String name,
java.lang.Long init,
java.lang.Long increment,
java.lang.Long minVal,
java.lang.Long maxVal,
java.lang.Boolean cycle)
getCreateSequenceString in class Dialectname - Sequence name. Mandatory not null.init - Sequence starting value. Mandatory(not null).increment - Sequence incrementing value. Mandatory(not null).minVal - Sequence minimum value. Optional (may be null).maxVal - Sequence maximum value. Optional (may be null).cycle - Sequence cycling property. Optional, if missing assumed not cycling.null if not supported.public java.lang.String getDropSequenceString(java.lang.String name)
getDropSequenceString in class Dialectname - The name of the sequence to be dropped.null if not supported.public java.lang.String getSequenceSetValString(java.lang.String sequenceName,
long newVal)
getSequenceSetValString in class DialectsequenceName - The name of the sequence.newVal - The new value to be set.null
if not supported.public java.lang.String getSequenceSetValString(java.lang.String sequenceName)
getSequenceSetValString in class DialectsequenceName - The name of the sequence.null
if not supported.public java.lang.String getSequenceSetValString()
getSequenceSetValString in class Dialectnull
if not supported.public java.lang.String getSequenceNextValString(java.lang.String sequenceName)
getSequenceNextValString in class DialectsequenceName - The name of the sequence to be queried.null if not supported.public java.lang.String getSequenceCurrValString(java.lang.String sequenceName)
getSequenceCurrValString in class DialectsequenceName - The name of the sequence to be queried.null if not supported.public boolean hasFullSequenceSupport()
true if this dialect fully support the sequences as 4GL language (most important:
bounded values, cycle). If not fully supported, additional code is needed in P2J sequence class
implementation to fix this.hasFullSequenceSupport in class Dialecttrue if this dialect fully support 4GL sequencespublic java.lang.String getSequencePrefetchString(java.lang.String sequenceName)
getSequencePrefetchString in class DialectsequenceName - The name of the sequence from which the values are to be retrieved.null.public boolean isConnectionError(java.lang.Exception exc)
isConnectionError in class Dialectexc - The exception to be checked.true if the exception indicates a database connectivity error.public boolean isQueryRangeParameterInlined()
where value ≥ ? and id = ?
along with respective substitution parameters of 45 and 100, the
inlined version would read:
where value ≥ 45 and id = ?
Only the id substitution parameter of 100 would be
substituted into the prepared statement.
Inlining in such a way can give some database dialects the opportunity to choose a better query plan, than if the parameter being tested with a range check were to be substituted at statement execution time.
Note: this serves as a hint which may be overridden by runtime logic or other configuration settings.
isQueryRangeParameterInlined in class Dialecttrue to inline range check parameters;
false to use normal parameter substitution.public void inlineLimit(boolean on)
Dialects are free to treat this method as a hint.
inlineLimit in class Dialecton - true to enable inlining; false to disable it.public boolean requiresExplicitCastInsideTernary()
"then ? else ?" statement.requiresExplicitCastInsideTernary in class Dialecttrue: this dialect requires casting in this case.public java.lang.String getDropIndexString(P2JIndex index)
getDropIndexString in class Dialectindex - Definition of the index to be dropped.public java.lang.String prepareMetadataParameter(java.lang.String param)
prepareMetadataParameter in class Dialectparam - The metadata query parameter.public java.lang.String processMetadataResult(java.lang.String value)
processMetadataResult in class Dialectvalue - The metadata query result.public boolean isMetadataSortDesc(java.lang.String value)
isMetadataSortDesc in class Dialectvalue - The value to be checked.true if the value is the "ascending" clause.public boolean isMetadataSortAsc(java.lang.String value)
isMetadataSortAsc in class Dialectvalue - The value to be checked.true if the value is the "descending" clause.public boolean explicitSetCollation()
explicitSetCollation in class Dialecttrue if the collation needs to be explicitly set.public java.lang.String getDelimiter()
getDelimiter in class Dialectpublic java.lang.String buildRemoteURL(java.lang.String url,
Database database)
throws PersistenceException
buildRemoteURL in class Dialecturl - The URL as received from the remote server.database - The database to which this URL belongs.PersistenceException - if the specified connection URL is invalid.public SequenceHandler createSequenceHandler(java.lang.String ldbName)
SequenceHandler for a database.createSequenceHandler in class DialectldbName - The logical name of the database to create the SequenceHandler for.SequenceHandler for respective database.public boolean injectComputedColumns()
injectComputedColumns in class Dialectfalse.public boolean isUniqueConstraintViolation(java.sql.SQLException sqle)
isUniqueConstraintViolation in class Dialectsqle - The SQLException that is causing the unique constraint violation.true if the SQLState matches the dialect specific code for
UNIQUE_VIOLATION, false otherwise.public int getSyntheticIndexSize(boolean unique)
id of the record
may be additionally added to an index to add custom properties (eg uniqueness) but other fields could be
added. This part of the index is not visible using index reflection routines from IndexHelper.
The synthetic components may differ between unique and non-unique indexes.getSyntheticIndexSize in class Dialectunique - true if the index is uniquepublic void addRtrimmedExpression(java.lang.String expr,
java.lang.StringBuilder sb)
rtrim equivalent call for a specified expression. This is dialect specific. Usually
the returned value looks like:
rtrim(expr)
The rtrim-med expression is appended to the string builder. The return value (the number of
occurrences of the initial expr added to sb) should be use by caller to count the number
of possible parameters from a query.addRtrimmedExpression in class Dialectexpr - The expression to be rtrim-med. It's up to the caller if it is a qualified field or not
or any other kind of character-type expression.sb - The StringBuilder to append the trimmed field to.public java.lang.String getCreateTemporaryTableString(boolean ifNotExist)
getCreateTemporaryTableString in class DialectifNotExist - If true a dialect-specific, optional if not exist clause is added.public java.lang.String getCreateTemporaryTablePostfix(boolean noUndo)
getCreateTemporaryTablePostfix in class DialectnoUndo - This parameter is not used at the moment. The intention was to generate a keyword for
no-undo tables. Only P2JH2Dialect benefits from this parameter.public java.lang.String getAddForeignKeyConstraintString(java.lang.String table,
java.lang.String fkName,
java.lang.String fkFields,
java.lang.String refTable,
java.lang.String refFields,
java.lang.String indent,
java.lang.String eoln)
alter table statement for adding a new
foreign key constraint.getAddForeignKeyConstraintString in class Dialecttable - The table to be altered.fkName - The name of the constraint.fkFields - Comma separated names of the fields which make the reference to parent table.refTable - The parent / referred table.refFields - Comma separated names of the fields which uniquely identify the record in parent table.indent - The indentation for pretty print the result.eoln - OS-specific end of line terminator (if the result is a multiline).public java.lang.String getCatalogPattern(Database database)
getCatalogPattern in class Dialectdatabase - database objectpublic java.lang.String getSchemaPattern(Database database)
getSchemaPattern in class Dialectdatabase - database objectpublic java.lang.String getSequenceSQL(Database database)
getSequenceSQL in class Dialectdatabase - database objectpublic java.lang.String getDropIndexString(boolean ifExists,
java.lang.String idxName,
java.lang.String tableName)
getDropIndexString in class DialectifExists - Flag that requires that the DDL include an optional IF EXIST clause.idxName - The name of the index to be dropped by this DDL.tableName - The name of the table to which the index belongs to. (Optional, is needed by the dialect).public java.lang.String getDropTableString(boolean ifExists,
java.lang.String tableName)
getDropTableString in class DialectifExists - Flag that requires that the DDL include an optional IF EXIST clause.tableName - The name of the table to be dropped by this DDL.public java.lang.String getAnalyzeString(java.lang.String table)
analyze or similar statements for this
dialect. If the table is not null the statement will analyze only the respective table.
Otherwise, all the tables are analyzed.getAnalyzeString in class Dialecttable - The name of the table to be analyzed. If null, all tables from the database will be
analyzed, if possible.ANALYZE
statement in the form requested null is returned.public java.lang.String getSpecificTypeAsString(FqlType type)
FqlType to a string representation which can be used in a
SQL query (cast or other construct).getSpecificTypeAsString in class Dialecttype - The type to be converted to string.public ParmType translateToParmType(java.lang.String type, java.lang.String comment)
ParmType.translateToParmType in class Dialecttype - Column type.comment - comment with optional specification of typejava.lang.IllegalArgumentException - for unsupported types.public java.lang.String getSqlMappedType(java.lang.String fwdType,
int scale,
java.lang.Boolean caseSensitive)
getSqlMappedType in class DialectfwdType - The FWD type.scale - Optional scale parameter (for decimal data type).fwdType.public void checkIndexConstraints(P2JIndex p2JIndex, java.util.Map<java.lang.String,P2JField> fields)
checkIndexConstraints in class Dialectp2JIndex - The index to be processed.fields - All table fields, mapped by their legacy name.public void preparePermanentDatabase(Database db) throws PersistenceException
preparePermanentDatabase in class Dialectdb - Database to prepare.PersistenceException - if there is any error executing DDL.public java.lang.String getCodepage(java.sql.Connection conn)
getCodepage in class Dialectconn - The JDBC database connection to be used.public java.lang.String getCollation(java.sql.Connection conn)
getCollation in class Dialectconn - The JDBC database connection to be used.protected CentralLogger getLog()
private static java.lang.String mapCP(java.lang.String collation)
collation - A MariaDb specific collation name. (Ex: "latin1_swedish_ci", "cp1250_polish_ci")h2Charset.private static java.lang.String mapCollation(java.lang.String collation)
collation - A MariaDb specific collation name. (Ex: "latin1_swedish_ci", "cp1250_polish_ci")h2Charset.