public class PlatformDefaultImpl extends Object implements Platform
Constructor and Description |
---|
PlatformDefaultImpl()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
protected void setSchemaTypeToSqlTypeMapping(SchemaType schemaType, SqlType sqlType)
schemaType
- the torque schema type which should be mapped,
not null.sqlType
- the sql type for the torque schema type, not null.protected String formatDateTimeString(Date date, String format)
date
- the Date objectformat
- the format stringpublic SqlType getSqlTypeForSchemaType(SchemaType schemaType)
Platform
getSqlTypeForSchemaType
in interface Platform
schemaType
- the Torque type, not null.Platform.getSqlTypeForSchemaType(SchemaType)
public String getNullString(boolean notNull)
getNullString
in interface Platform
notNull
- flag for not nullPlatform.getNullString(boolean)
public String getAutoIncrement()
getAutoIncrement
in interface Platform
Platform.getAutoIncrement()
public boolean hasScale(String sqlType)
Platform
hasScale
in interface Platform
sqlType
- the SQL typeTODO collect info for all platforms
public boolean hasSize(String sqlType)
Platform
hasSize
in interface Platform
sqlType
- the SQL typeTODO collect info for all platforms
public String getSizeSuffix(String sqlType)
getSizeSuffix
in interface Platform
sqlType
- the SQL type to determine the suffix for.public boolean createNotNullBeforeAutoincrement()
Platform
createNotNullBeforeAutoincrement
in interface Platform
Platform.createNotNullBeforeAutoincrement()
public String quoteAndEscape(String text)
Platform
quoteAndEscape
in interface Platform
text
- The string to escape, or null.Platform.quoteAndEscape(String)
protected boolean escapeBackslashes()
public String getDateString(Date date)
getDateString
in interface Platform
date
- the date to format.public String getTimeString(Date date)
getTimeString
in interface Platform
date
- the date to format.public String getTimestampString(Date date)
getTimestampString
in interface Platform
date
- the date to format.public boolean usesStandaloneSchema()
usesStandaloneSchema
in interface Platform
public boolean hasUniqueConstraintSize()
Platform
hasUniqueConstraintSize
in interface Platform
Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.