Schnittstelle Platform
- Alle bekannten Implementierungsklassen:
PlatformDefaultImpl
,PlatformDerbyImpl
,PlatformHsqldbImpl
,PlatformMssqlImpl
,PlatformMysqlImpl
,PlatformOracleImpl
,PlatformPostgresqlImpl
public interface Platform
Interface for RDBMS platform specific behaviour.
Which platform actually is used, is determined here:
PlatformFactory.getPlatformFor(String)
.- Version:
- $Id: Platform.java 1917240 2024-04-21 13:22:54Z tv $
- Autor:
- Martin Poeschl
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
Returns whether the "not null part" of the definition of a column should be generated before the "autoincrement part" in a "create table" statement.getDateString
(Date date) Formats the given date as date string which is parseable by the database.getNullString
(boolean notNull) getSizeSuffix
(String sqlType) Returns a possible SQL suffix for column definitions of certain SQL Types, e.g. for Oracle VARCHAR2 columns, it typically makes sense to use 'XXX CHAR' instead of 'XXX' as size.getSqlTypeForSchemaType
(SchemaType schemaType) Returns the db specific SQL type for a Torque type.getTimestampString
(Date date) Formats the given date as timestamp string which is parseable by the database.getTimeString
(Date date) Formats the given date as time string which is parseable by the database.boolean
Returns if the RDBMS-specific SQL type has a scale attribute.boolean
Returns if the RDBMS-specific SQL type has a size attribute.boolean
Returns whether the database has schema support unique constraint for columns with sizequoteAndEscape
(String value) Quotes and escapes a string such that it can be used as literal String value in SQL.boolean
Returns whether the database has schema support where a schema is not tied to a user (oracle) or database (mysql), but can be created separately.
-
Methodendetails
-
getSqlTypeForSchemaType
Returns the db specific SQL type for a Torque type.- Parameter:
schemaType
- the Torque type, not null.- Gibt zurück:
- the db specific SQL type, or null if no SQL type is defined for the given Torque type.
-
getNullString
- Parameter:
notNull
- flag for not null- Gibt zurück:
- The RDBMS-specific SQL fragment for
NULL
orNOT NULL
.
-
getAutoIncrement
String getAutoIncrement()- Gibt zurück:
- The RDBMS-specific SQL fragment for autoincrement.
-
hasSize
Returns if the RDBMS-specific SQL type has a size attribute.- Parameter:
sqlType
- the SQL type- Gibt zurück:
- true if the type has a size attribute
-
hasScale
Returns if the RDBMS-specific SQL type has a scale attribute.- Parameter:
sqlType
- the SQL type- Gibt zurück:
- true if the type has a scale attribute
-
getSizeSuffix
Returns a possible SQL suffix for column definitions of certain SQL Types, e.g. for Oracle VARCHAR2 columns, it typically makes sense to use 'XXX CHAR' instead of 'XXX' as size.- Parameter:
sqlType
- the SQL type to determine the suffix for.- Gibt zurück:
- the size suffix, not null, may be empty.
-
createNotNullBeforeAutoincrement
boolean createNotNullBeforeAutoincrement()Returns whether the "not null part" of the definition of a column should be generated before the "autoincrement part" in a "create table" statement.- Gibt zurück:
- true if the "not null part" should be first, false if the "autoincrement part" should be first in a "create table" statement.
-
quoteAndEscape
Quotes and escapes a string such that it can be used as literal String value in SQL.- Parameter:
value
- The string to escape, or null.- Gibt zurück:
- the escaped String, not null.
-
getDateString
Formats the given date as date string which is parseable by the database.- Parameter:
date
- the date to format.- Gibt zurück:
- the date string, inclusive string escaping.
-
getTimeString
Formats the given date as time string which is parseable by the database.- Parameter:
date
- the date to format.- Gibt zurück:
- the time string, inclusive string escaping.
-
getTimestampString
Formats the given date as timestamp string which is parseable by the database.- Parameter:
date
- the date to format.- Gibt zurück:
- the timestamp string, inclusive string escaping.
-
usesStandaloneSchema
boolean usesStandaloneSchema()Returns whether the database has schema support where a schema is not tied to a user (oracle) or database (mysql), but can be created separately.- Gibt zurück:
- true if separate schema creation is possible, false if not.
-
hasUniqueConstraintSize
boolean hasUniqueConstraintSize()Returns whether the database has schema support unique constraint for columns with size- Gibt zurück:
- true if unique column constraint has size
-