Klasse PlatformDefaultImpl
java.lang.Object
org.apache.torque.templates.platform.PlatformDefaultImpl
- Alle implementierten Schnittstellen:
Platform
- Bekannte direkte Unterklassen:
PlatformDerbyImpl
,PlatformHsqldbImpl
,PlatformMssqlImpl
,PlatformMysqlImpl
,PlatformOracleImpl
,PlatformPostgresqlImpl
Default implementation for the Platform interface.
- Version:
- $Id: PlatformDefaultImpl.java 1917240 2024-04-21 13:22:54Z tv $
- Autor:
- Martin Poeschl
-
Konstruktorübersicht
Konstruktoren -
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.protected boolean
Returns whether backslashes must be escaped in string literals.protected String
formatDateTimeString
(Date date, String format) Helper function to format date values to a platform-specific string.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 'x CHAR' instead of 'x' 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 text) Quotes and escapes a string such that it can be used as literal String value in SQL.protected void
setSchemaTypeToSqlTypeMapping
(SchemaType schemaType, SqlType sqlType) Adds a mapping to the torque schema type -> sql type map.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.
-
Konstruktordetails
-
PlatformDefaultImpl
public PlatformDefaultImpl()Default constructor.
-
-
Methodendetails
-
setSchemaTypeToSqlTypeMapping
Adds a mapping to the torque schema type -> sql type map.- Parameter:
schemaType
- the torque schema type which should be mapped, not null.sqlType
- the sql type for the torque schema type, not null.
-
formatDateTimeString
Helper function to format date values to a platform-specific string. setZoneId
to GMT timezone.- Parameter:
date
- the Date objectformat
- the format string- Gibt zurück:
- the formatted string
-
getSqlTypeForSchemaType
Beschreibung aus Schnittstelle kopiert:Platform
Returns the db specific SQL type for a Torque type.- Angegeben von:
getSqlTypeForSchemaType
in SchnittstellePlatform
- 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.
- Siehe auch:
-
getNullString
- Angegeben von:
getNullString
in SchnittstellePlatform
- Parameter:
notNull
- flag for not null- Gibt zurück:
- Only produces a SQL fragment if null values are disallowed.
- Siehe auch:
-
getAutoIncrement
- Angegeben von:
getAutoIncrement
in SchnittstellePlatform
- Gibt zurück:
- The RDBMS-specific SQL fragment for autoincrement.
- Siehe auch:
-
hasScale
Beschreibung aus Schnittstelle kopiert:Platform
Returns if the RDBMS-specific SQL type has a scale attribute. -
hasSize
Beschreibung aus Schnittstelle kopiert:Platform
Returns if the RDBMS-specific SQL type has a size 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 'x CHAR' instead of 'x' as size.- Angegeben von:
getSizeSuffix
in SchnittstellePlatform
- Parameter:
sqlType
- the SQL type to determine the suffix for.- Gibt zurück:
- The size suffix, not null. This implementation always returns the empty string.
-
createNotNullBeforeAutoincrement
public boolean createNotNullBeforeAutoincrement()Beschreibung aus Schnittstelle kopiert:Platform
Returns whether the "not null part" of the definition of a column should be generated before the "autoincrement part" in a "create table" statement.- Angegeben von:
createNotNullBeforeAutoincrement
in SchnittstellePlatform
- 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.
- Siehe auch:
-
quoteAndEscape
Beschreibung aus Schnittstelle kopiert:Platform
Quotes and escapes a string such that it can be used as literal String value in SQL.- Angegeben von:
quoteAndEscape
in SchnittstellePlatform
- Parameter:
text
- The string to escape, or null.- Gibt zurück:
- the escaped String, not null.
- Siehe auch:
-
escapeBackslashes
protected boolean escapeBackslashes()Returns whether backslashes must be escaped in string literals.- Gibt zurück:
- true if backslashes bust be escaped, false otherwise.
-
getDateString
Formats the given date as date string which is parseable by the database.- Angegeben von:
getDateString
in SchnittstellePlatform
- 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.- Angegeben von:
getTimeString
in SchnittstellePlatform
- 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.- Angegeben von:
getTimestampString
in SchnittstellePlatform
- Parameter:
date
- the date to format.- Gibt zurück:
- the timestamp string, inclusive string escaping.
-
usesStandaloneSchema
public 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.- Angegeben von:
usesStandaloneSchema
in SchnittstellePlatform
- Gibt zurück:
- this implementation returns false.
-
hasUniqueConstraintSize
public boolean hasUniqueConstraintSize()Beschreibung aus Schnittstelle kopiert:Platform
Returns whether the database has schema support unique constraint for columns with size- Angegeben von:
hasUniqueConstraintSize
in SchnittstellePlatform
- Gibt zurück:
- true if unique column constraint has size
-