Package org.apache.torque.templates.platform

# Klasse PlatformDefaultImpl

java.lang.Object
org.apache.torque.templates.platform.PlatformDefaultImpl

Alle implementierten Schnittstellen:
  `Platform`

Bekannte direkte Unterklassen:
  `PlatformDerbyImpl`, `PlatformHsqldbImpl`, `PlatformMssqlImpl`, `PlatformMysqlImpl`, `PlatformOracleImpl`, `PlatformPostgresqlImpl`

public class PlatformDefaultImpl extends Object implements Platform
Default implementation for the Platform interface.

Version:
  $Id: PlatformDefaultImpl.java 1917240 2024-04-21 13:22:54Z tv $
Autor:
  Martin Poeschl

- ## Konstruktorübersicht

  Konstruktoren
  Konstruktor
  Beschreibung
  `PlatformDefaultImpl()`
  Default constructor.

- ## Methodenübersicht

  Modifizierer und Typ
  Methode
  Beschreibung
  `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.
  `protected boolean`
  `escapeBackslashes()`
  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.
  `String`
  `getAutoIncrement()`
  `String`
  `getDateString(Date date)`
  Formats the given date as date string which is parseable by the database.
  `String`
  `getNullString(boolean notNull)`
  `String`
  `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.
  `SqlType`
  `getSqlTypeForSchemaType(SchemaType schemaType)`
  Returns the db specific SQL type for a Torque type.
  `String`
  `getTimestampString(Date date)`
  Formats the given date as timestamp string which is parseable by the database.
  `String`
  `getTimeString(Date date)`
  Formats the given date as time string which is parseable by the database.
  `boolean`
  `hasScale(String sqlType)`
  Returns if the RDBMS-specific SQL type has a scale attribute.
  `boolean`
  `hasSize(String sqlType)`
  Returns if the RDBMS-specific SQL type has a size attribute.
  `boolean`
  `hasUniqueConstraintSize()`
  Returns whether the database has schema support unique constraint for columns with size
  `String`
  `quoteAndEscape(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`
  `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.

  ### Von Klasse geerbte Methoden java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Konstruktordetails

  - ### PlatformDefaultImpl

    public PlatformDefaultImpl()
    Default constructor.

- ## Methodendetails

  - ### setSchemaTypeToSqlTypeMapping

    protected void setSchemaTypeToSqlTypeMapping(SchemaType schemaType, SqlType sqlType)
    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

    protected String formatDateTimeString(Date date, String format)
    Helper function to format date values to a platform-specific string. set `ZoneId` to GMT timezone.
    Parameter:
      `date` - the Date object
      `format` - the format string
    Gibt zurück:
      the formatted string

  - ### getSqlTypeForSchemaType

    public SqlType getSqlTypeForSchemaType(SchemaType schemaType)
    Beschreibung aus Schnittstelle kopiert: `Platform`
    Returns the db specific SQL type for a Torque type.
    Angegeben von:
      `getSqlTypeForSchemaType` in Schnittstelle `Platform`
    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:
      - `Platform.getSqlTypeForSchemaType(SchemaType)`

  - ### getNullString

    public String getNullString(boolean notNull)
    Angegeben von:
      `getNullString` in Schnittstelle `Platform`
    Parameter:
      `notNull` - flag for not null
    Gibt zurück:
      Only produces a SQL fragment if null values are disallowed.
    Siehe auch:
      - `Platform.getNullString(boolean)`

  - ### getAutoIncrement

    public String getAutoIncrement()
    Angegeben von:
      `getAutoIncrement` in Schnittstelle `Platform`
    Gibt zurück:
      The RDBMS-specific SQL fragment for autoincrement.
    Siehe auch:
      - `Platform.getAutoIncrement()`

  - ### hasScale

    public boolean hasScale(String sqlType)
    Beschreibung aus Schnittstelle kopiert: `Platform`
    Returns if the RDBMS-specific SQL type has a scale attribute.
    Angegeben von:
      `hasScale` in Schnittstelle `Platform`
    Parameter:
      `sqlType` - the SQL type
    Gibt zurück:
      true if the type has a scale attribute
    Siehe auch:
      - `TODO collect info for all platforms`

  - ### hasSize

    public boolean hasSize(String sqlType)
    Beschreibung aus Schnittstelle kopiert: `Platform`
    Returns if the RDBMS-specific SQL type has a size attribute.
    Angegeben von:
      `hasSize` in Schnittstelle `Platform`
    Parameter:
      `sqlType` - the SQL type
    Gibt zurück:
      true if the type has a size attribute
    Siehe auch:
      - `TODO collect info for all platforms`

  - ### getSizeSuffix

    public String 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.
    Angegeben von:
      `getSizeSuffix` in Schnittstelle `Platform`
    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 Schnittstelle `Platform`
    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:
      - `Platform.createNotNullBeforeAutoincrement()`

  - ### quoteAndEscape

    public String quoteAndEscape(String text)
    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 Schnittstelle `Platform`
    Parameter:
      `text` - The string to escape, or null.
    Gibt zurück:
      the escaped String, not null.
    Siehe auch:
      - `Platform.quoteAndEscape(String)`

  - ### 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

    public String getDateString(Date date)
    Formats the given date as date string which is parseable by the database.
    Angegeben von:
      `getDateString` in Schnittstelle `Platform`
    Parameter:
      `date` - the date to format.
    Gibt zurück:
      the date string, inclusive string escaping.

  - ### getTimeString

    public String getTimeString(Date date)
    Formats the given date as time string which is parseable by the database.
    Angegeben von:
      `getTimeString` in Schnittstelle `Platform`
    Parameter:
      `date` - the date to format.
    Gibt zurück:
      the time string, inclusive string escaping.

  - ### getTimestampString

    public String getTimestampString(Date date)
    Formats the given date as timestamp string which is parseable by the database.
    Angegeben von:
      `getTimestampString` in Schnittstelle `Platform`
    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 Schnittstelle `Platform`
    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 Schnittstelle `Platform`
    Gibt zurück:
      true if unique column constraint has size