An SQL dialect for MySQL (prior to 5.x).
areStringComparisonsCaseInsensitive
public boolean areStringComparisonsCaseInsensitive()
Are string comparisons implicitly case insensitive.
In other words, does [where 'XYZ' = 'xyz'] resolve to true?
- areStringComparisonsCaseInsensitive in interface Dialect
- True if comparisons are case insensitive.
closeQuote
public char closeQuote()
The character specific to this dialect used to close a quoted identifier.
- closeQuote in interface Dialect
- The dialect's specific close quote character.
getAddColumnString
public String getAddColumnString()
The syntax used to add a column to a table (optional).
- getAddColumnString in interface Dialect
- The "add column" fragment.
getAddForeignKeyConstraintString
public String getAddForeignKeyConstraintString(String constraintName,
String[] foreignKey,
String referencedTable,
String[] primaryKey,
boolean referencesPrimaryKey)
The syntax used to add a foreign key constraint to a table.
- getAddForeignKeyConstraintString in interface Dialect
constraintName
- The FK constraint name.foreignKey
- The names of the columns comprising the FKreferencedTable
- The table referenced by the FKprimaryKey
- The explicit columns in the referencedTable referenced
by this FK.referencesPrimaryKey
- if false, constraint should be
explicit about which column names the constraint refers to
getCastTypeName
public String getCastTypeName(int code)
Get the name of the database type appropriate for casting operations
(via the CAST() SQL function) for the given java.sql.Types
typecode.
- getCastTypeName in interface Dialect
code
- The java.sql.Types
typecode
getCreateTemporaryTableString
public String getCreateTemporaryTableString()
Command used to create a temporary table.
- getCreateTemporaryTableString in interface Dialect
- The command used to create a temporary table.
getCurrentTimestampSelectString
public String getCurrentTimestampSelectString()
Retrieve the command used to retrieve the current timestammp from the
database.
- getCurrentTimestampSelectString in interface Dialect
getIdentityColumnString
public String getIdentityColumnString()
The syntax used during DDL to define a column as being an IDENTITY.
- getIdentityColumnString in interface Dialect
- The appropriate DDL fragment.
getIdentitySelectString
public String getIdentitySelectString()
Get the select command to use to retrieve the last generated IDENTITY
value.
- getIdentitySelectString in interface Dialect
- The appropriate select command
getLimitString
public String getLimitString(String sql,
boolean hasOffset)
Apply s limit clause to the query.
Typically dialects utilize
variable
limit caluses when they support limits. Thus, when building the
select command we do not actually need to know the limit or the offest
since we will just be using placeholders.
Here we do still pass along whether or not an offset was specified
so that dialects not supporting offsets can generate proper exceptions.
In general, dialects will override one or the other of this method and
Dialect.getLimitString(String,int,int)
.
- getLimitString in interface Dialect
hasOffset
- Is the query requesting an offset?
getResultSet
public ResultSet getResultSet(CallableStatement ps)
throws SQLException
- getResultSet in interface Dialect
- The extracted result set.
getSelectGUIDString
public String getSelectGUIDString()
Get the command used to select a GUID from the underlying database.
Optional operation.
- getSelectGUIDString in interface Dialect
openQuote
public char openQuote()
The character specific to this dialect used to begin a quoted identifier.
- openQuote in interface Dialect
- The dialect's specific open quote character.
performTemporaryTableDDLInIsolation
public Boolean performTemporaryTableDDLInIsolation()
Does the dialect require that temporary table DDL statements occur in
isolation from other statements? This would be the case if the creation
would cause any current transaction to get committed implicitly.
JDBC defines a standard way to query for this information via the
java.sql.DatabaseMetaData.dataDefinitionCausesTransactionCommit()
method. However, that does not distinguish between temporary table
DDL and other forms of DDL; MySQL, for example, reports DDL causing a
transaction commit via its driver, even though that is not the case for
temporary table DDL.
Possible return values and their meanings:
Boolean.TRUE
- Unequivocally, perform the temporary table DDL
in isolation.Boolean.FALSE
- Unequivocally, do not perform the
temporary table DDL in isolation.- null - defer to the JDBC driver response in regards to
java.sql.DatabaseMetaData.dataDefinitionCausesTransactionCommit()
- performTemporaryTableDDLInIsolation in interface Dialect
- see the result matrix above.
qualifyIndexName
public boolean qualifyIndexName()
Do we need to qualify index names with the schema name?
- qualifyIndexName in interface Dialect
registerResultSetOutParameter
public int registerResultSetOutParameter(CallableStatement statement,
int col)
throws SQLException
Registers an OUT parameter which will be returing a
java.sql.ResultSet
. How this is accomplished varies greatly
from DB to DB, hence its inclusion (along with
Dialect.getResultSet(CallableStatement)
) here.
- registerResultSetOutParameter in interface Dialect
statement
- The callable statement.
- The number of (contiguous) bind positions used.
registerVarcharTypes
protected void registerVarcharTypes()
supportsCurrentTimestampSelection
public boolean supportsCurrentTimestampSelection()
Does this dialect support a way to retrieve the database's current
timestamp value?
- supportsCurrentTimestampSelection in interface Dialect
- True if the current timestamp can be retrieved; false otherwise.
supportsEmptyInList
public boolean supportsEmptyInList()
Does this dialect support empty IN lists?
For example, is [where XYZ in ()] a supported construct?
- supportsEmptyInList in interface Dialect
- True if empty in lists are supported; false otherwise.
supportsIdentityColumns
public boolean supportsIdentityColumns()
Does this dialect support identity column key generation?
- supportsIdentityColumns in interface Dialect
- True if IDENTITY columns are supported; false otherwise.
supportsLimit
public boolean supportsLimit()
Does this dialect support some form of limiting query results
via a SQL clause?
- supportsLimit in interface Dialect
- True if this dialect supports some form of LIMIT.
supportsLobValueChangePropogation
public boolean supportsLobValueChangePropogation()
Does the dialect support propogating changes to LOB
values back to the database? Talking about mutating the
internal value of the locator as opposed to supplying a new
locator instance...
For BLOBs, the internal value might be changed by:
java.sql.Blob.setBinaryStream
,
java.sql.Blob.setBytes(long, byte[])
,
java.sql.Blob.setBytes(long, byte[], int, int)
,
or
java.sql.Blob.truncate(long)
.
For CLOBs, the internal value might be changed by:
java.sql.Clob.setAsciiStream(long)
,
java.sql.Clob.setCharacterStream(long)
,
java.sql.Clob.setString(long, String)
,
java.sql.Clob.setString(long, String, int, int)
,
or
java.sql.Clob.truncate(long)
.
NOTE : I do not know the correct answer currently for
databases which (1) are not part of the cruise control process
or (2) do not
Dialect.supportsExpectedLobUsagePattern()
.
- supportsLobValueChangePropogation in interface Dialect
- True if the changes are propogated back to the
database; false otherwise.
supportsRowValueConstructorSyntax
public boolean supportsRowValueConstructorSyntax()
Is this dialect known to support what ANSI-SQL terms "row value
constructor" syntax; sometimes called tuple syntax.
Basically, does it support syntax like
"... where (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...".
- supportsRowValueConstructorSyntax in interface Dialect
- True if this SQL dialect is known to support "row value
constructor" syntax; false otherwise.
supportsSubqueryOnMutatingTable
public boolean supportsSubqueryOnMutatingTable()
Does this dialect support referencing the table being mutated in
a subquery. The "table being mutated" is the table referenced in
an UPDATE or a DELETE query. And so can that table then be
referenced in a subquery of said UPDATE/DELETE query.
For example, would the following two syntaxes be supported:
- delete from TABLE_A where ID not in ( select ID from TABLE_A )
- update TABLE_A set NON_ID = 'something' where ID in ( select ID from TABLE_A)
- supportsSubqueryOnMutatingTable in interface Dialect
- True if this dialect allows references the mutating table from
a subquery.
supportsTemporaryTables
public boolean supportsTemporaryTables()
Does this dialect support temporary tables?
- supportsTemporaryTables in interface Dialect
- True if temp tables are supported; false otherwise.