|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fuberlin.wiwiss.d2rq.sql.vendor.SQL92
public class SQL92
This base class implements SQL-92 compatible syntax. Subclasses can override individual methods to implement different syntax.
Field Summary |
---|
Fields inherited from interface de.fuberlin.wiwiss.d2rq.sql.vendor.Vendor |
---|
HSQLDB, InterbaseOrFirebird, MSAccess, MySQL, Oracle, PostgreSQL, SQL92, SQLServer |
Constructor Summary | |
---|---|
SQL92(boolean useAS)
Initializes a new instance. |
Method Summary | |
---|---|
Expression |
booleanExpressionToSimpleExpression(Expression expression)
In most databases, we don't have to do anything because boolean expressions are allowed anywhere. |
String |
getConcatenationExpression(String[] sqlFragments)
Concatenation of a and b is
"a || b " in standard SQL, but CONCAT(a, b)
in MySQL. |
DataType |
getDataType(int jdbcType,
String name,
int size)
Returns a DataType corresponding to a JDBC type. |
Properties |
getDefaultConnectionProperties()
Returns a set of default connection properties to be used when connecting to this database engine type |
String |
getRelationNameAliasExpression(RelationName relationName,
RelationName aliasName)
A relation name with an alias name for use in FROM
clauses. |
Expression |
getRowNumLimitAsExpression(int limit)
Returns an expression for limiting the number of returned rows for engines that support this ( ROWNUM <= n ) |
String |
getRowNumLimitAsQueryAppendage(int limit)
Technically speaking, SQL 92 supports NO way of limiting result sets (ROW_NUMBER appeared in SQL 2003). |
String |
getRowNumLimitAsSelectModifier(int limit)
Returns a modifier for the SELECT keyword that adds a limit to the number of returned rows for engines that support this ( TOP n ) |
void |
initializeConnection(Connection connection)
Vendor-specific initialization for a database connection. |
boolean |
isIgnoredTable(String schema,
String table)
TODO Use the Filter interface for this |
String |
quoteAttribute(Attribute attribute)
Handles special characters in attribute names. |
String |
quoteBinaryLiteral(String hexString)
|
String |
quoteDateLiteral(String date)
|
String |
quoteIdentifier(String identifier)
Handles special characters in identifiers. |
String |
quoteRelationName(RelationName relationName)
Handles special characters in relation names. |
String |
quoteStringLiteral(String s)
Handles special characters in strings. |
String |
quoteTimeLiteral(String time)
|
String |
quoteTimestampLiteral(String timestamp)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SQL92(boolean useAS)
useAS
- Use "Table AS Alias" or "Table Alias" in FROM clauses? In standard SQL, either is fine.Method Detail |
---|
public String getConcatenationExpression(String[] sqlFragments)
Vendor
a
and b
is
"a || b
" in standard SQL, but CONCAT(a, b)
in MySQL.
getConcatenationExpression
in interface Vendor
sqlFragments
- An array of SQL expressions to be concatenated
public String getRelationNameAliasExpression(RelationName relationName, RelationName aliasName)
Vendor
FROM
clauses. Would return relation AS alias
for
SQL 92 (the AS is optional in SQL 92, but some engines require
it, while others don't understand it).
getRelationNameAliasExpression
in interface Vendor
relationName
- The original table namealiasName
- The alias for the table name
public String quoteAttribute(Attribute attribute)
Vendor
quoteAttribute
in interface Vendor
attribute
- An attribute name (column name)
public String quoteRelationName(RelationName relationName)
Vendor
quoteRelationName
in interface Vendor
relationName
- A relation name (table name)
public String quoteIdentifier(String identifier)
Vendor
quoteIdentifier
in interface Vendor
identifier
- An identifier, such as a table or column name
public String quoteStringLiteral(String s)
Vendor
quoteStringLiteral
in interface Vendor
s
- An arbitrary character string
public String quoteBinaryLiteral(String hexString)
quoteBinaryLiteral
in interface Vendor
public String quoteDateLiteral(String date)
quoteDateLiteral
in interface Vendor
public String quoteTimeLiteral(String time)
quoteTimeLiteral
in interface Vendor
public String quoteTimestampLiteral(String timestamp)
quoteTimestampLiteral
in interface Vendor
public Expression getRowNumLimitAsExpression(int limit)
Vendor
ROWNUM <= n
)
getRowNumLimitAsExpression
in interface Vendor
limit
- A maximum number of rows, or Database.NO_LIMIT
Expression.TRUE
if not supported by the enginepublic String getRowNumLimitAsQueryAppendage(int limit)
getRowNumLimitAsQueryAppendage
in interface Vendor
limit
- A maximum number of rows, or Database.NO_LIMIT
public String getRowNumLimitAsSelectModifier(int limit)
Vendor
TOP n
)
getRowNumLimitAsSelectModifier
in interface Vendor
limit
- A maximum number of rows, or Database.NO_LIMIT
public Properties getDefaultConnectionProperties()
Vendor
getDefaultConnectionProperties
in interface Vendor
public DataType getDataType(int jdbcType, String name, int size)
Vendor
DataType
corresponding to a JDBC type. This may be
an unsupported datatype; in this case, its DataType.isUnsupported()
method will return true. null
will be returned if the vendor
code doesn't handle this datatype at all; that should generally be
considered a bug.
getDataType
in interface Vendor
jdbcType
- A java.sql.Types
constantname
- The type name, as reported by java.sql
metadata methods, normalized to uppercasesize
- Character size of the type, or 0 if not applicable
null
if the vendor code is brokenpublic Expression booleanExpressionToSimpleExpression(Expression expression)
booleanExpressionToSimpleExpression
in interface Vendor
expression
- A boolean expression
public boolean isIgnoredTable(String schema, String table)
Vendor
isIgnoredTable
in interface Vendor
schema
- A schema name, or null
for the connection's default schematable
- A table name
true
if this is a system table that doesn't contain user/application datapublic void initializeConnection(Connection connection) throws SQLException
Vendor
initializeConnection
in interface Vendor
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |