public class DatabasePlatform extends Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
blobDbType
The JDBC type to map Blob to.
|
protected int |
booleanDbType
The JDBC type to map booleans to (by default).
|
protected int |
clobDbType
The JDBC type to map Clob to.
|
protected String |
closeQuote
The close quote used by quoted identifiers.
|
protected DbDdlSyntax |
dbDdlSyntax
DB specific DDL syntax.
|
protected DbEncrypt |
dbEncrypt |
protected DbIdentity |
dbIdentity
Defines DB identity/sequence features.
|
protected DbTypeMap |
dbTypeMap
Mapping of JDBC to Database types.
|
protected boolean |
forwardOnlyHintOnFindIterate
If set then use the FORWARD ONLY hint when creating ResultSets for
findIterate() and findVisit().
|
protected boolean |
idInExpandedForm |
protected String |
name
The name.
|
protected String |
openQuote
The open quote used by quoted identifiers.
|
protected boolean |
selectCountWithAlias |
protected SqlLimiter |
sqlLimiter
For limit/offset, row_number etc limiting of SQL queries.
|
protected boolean |
treatEmptyStringsAsNull
For Oracle treat empty strings as null.
|
| Constructor and Description |
|---|
DatabasePlatform()
Instantiates a new database platform.
|
| Modifier and Type | Method and Description |
|---|---|
String |
completeSql(String sql,
Query<?> query) |
String |
convertQuotedIdentifiers(String dbName)
Convert backticks to the platform specific open quote and close quote
|
IdGenerator |
createSequenceIdGenerator(BackgroundExecutor be,
DataSource ds,
String seqName,
int batchSize)
Return a DB Sequence based IdGenerator.
|
int |
getBlobDbType()
Return the data type that should be used for Blob.
|
int |
getBooleanDbType()
Return the JDBC type used to store booleans.
|
int |
getClobDbType()
Return the data type that should be used for Clob.
|
String |
getCloseQuote()
Return the close quote for quoted identifiers.
|
DbDdlSyntax |
getDbDdlSyntax()
Return the DDL syntax for this platform.
|
DbEncrypt |
getDbEncrypt()
Return the DbEncrypt handler for this DB platform.
|
DbIdentity |
getDbIdentity()
Return the DB identity/sequence features for this platform.
|
DbTypeMap |
getDbTypeMap()
Return the mapping of JDBC to DB types.
|
String |
getName()
Return the name of the DatabasePlatform.
|
String |
getOpenQuote()
Return the open quote for quoted identifiers.
|
SqlLimiter |
getSqlLimiter()
Return the SqlLimiter used to apply additional sql around a query to limit
its results.
|
boolean |
isForwardOnlyHintOnFindIterate()
Return true if the ResultSet TYPE_FORWARD_ONLY Hint should be used on
findIterate() and findVisit() PreparedStatements.
|
boolean |
isIdInExpandedForm()
Return true if a compound ID in (...) type expression needs to be in
expanded form of (a=? and b=?) or (a=? and b=?) or ...
|
boolean |
isSelectCountWithAlias()
Set to true if select count against anonymous view requires an alias.
|
boolean |
isTreatEmptyStringsAsNull()
Return true if empty strings should be treated as null.
|
void |
setDbEncrypt(DbEncrypt dbEncrypt)
Set the DbEncrypt handler for this DB platform.
|
void |
setForwardOnlyHintOnFindIterate(boolean forwardOnlyHintOnFindIterate)
Set to true if the ResultSet TYPE_FORWARD_ONLY Hint should be used by default on findIterate PreparedStatements.
|
protected String |
withForUpdate(String sql) |
protected String openQuote
protected String closeQuote
protected SqlLimiter sqlLimiter
protected DbTypeMap dbTypeMap
protected DbDdlSyntax dbDdlSyntax
protected DbIdentity dbIdentity
protected int booleanDbType
protected int blobDbType
protected int clobDbType
protected boolean treatEmptyStringsAsNull
protected String name
protected DbEncrypt dbEncrypt
protected boolean idInExpandedForm
protected boolean selectCountWithAlias
protected boolean forwardOnlyHintOnFindIterate
public String getName()
"generic" is returned when no specific database platform has been set or found.
public IdGenerator createSequenceIdGenerator(BackgroundExecutor be, DataSource ds, String seqName, int batchSize)
be - the BackgroundExecutor that can be used to load the sequence if
desiredds - the DataSourceseqName - the name of the sequencebatchSize - the number of sequences that should be loadedpublic DbEncrypt getDbEncrypt()
public void setDbEncrypt(DbEncrypt dbEncrypt)
public DbTypeMap getDbTypeMap()
public DbDdlSyntax getDbDdlSyntax()
public String getCloseQuote()
public String getOpenQuote()
public int getBooleanDbType()
public int getBlobDbType()
This is typically Types.BLOB but for Postgres is Types.LONGVARBINARY for example.
public int getClobDbType()
This is typically Types.CLOB but for Postgres is Types.VARCHAR.
public boolean isTreatEmptyStringsAsNull()
public boolean isIdInExpandedForm()
public boolean isForwardOnlyHintOnFindIterate()
This specifically is required for MySql when processing large results.
public void setForwardOnlyHintOnFindIterate(boolean forwardOnlyHintOnFindIterate)
public DbIdentity getDbIdentity()
public SqlLimiter getSqlLimiter()
Basically add the clauses for limit/offset, rownum, row_number().
public String convertQuotedIdentifiers(String dbName)
Specific plugins may implement this method to cater for platform specific naming rules.
dbName - the db namepublic boolean isSelectCountWithAlias()
Copyright © 2014. All Rights Reserved.