de.fuberlin.wiwiss.d2rq.sql.vendor
Class Oracle

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.sql.vendor.SQL92
      extended by de.fuberlin.wiwiss.d2rq.sql.vendor.Oracle
All Implemented Interfaces:
Vendor

public class Oracle
extends SQL92

This syntax class implements MySQL-compatible SQL syntax.

Author:
Richard Cyganiak (richard@cyganiak.de)

Nested Class Summary
static class Oracle.OracleCompatibilityTimeZoneDataType
           
static class Oracle.OracleCompatibilityTimeZoneLocalDataType
          getString() doesn't really work for TIMESTAMP WITH LOCAL TIME ZONE, we have to use getTimestamp() and format the resulting Timestamp object according to the session's time zone.
 
Field Summary
 
Fields inherited from interface de.fuberlin.wiwiss.d2rq.sql.vendor.Vendor
HSQLDB, InterbaseOrFirebird, MSAccess, MySQL, Oracle, PostgreSQL, SQL92, SQLServer
 
Constructor Summary
Oracle()
           
 
Method Summary
 Expression booleanExpressionToSimpleExpression(Expression expression)
          Oracle doesn't actually support booolean expressions, except in a few places.
 DataType getDataType(int jdbcType, String name, int size)
          Returns a DataType corresponding to a JDBC type.
 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).
 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 quoteBinaryLiteral(String hexString)
           
 
Methods inherited from class de.fuberlin.wiwiss.d2rq.sql.vendor.SQL92
getConcatenationExpression, getDefaultConnectionProperties, getRelationNameAliasExpression, getRowNumLimitAsSelectModifier, quoteAttribute, quoteDateLiteral, quoteIdentifier, quoteRelationName, quoteStringLiteral, quoteTimeLiteral, quoteTimestampLiteral
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Oracle

public Oracle()
Method Detail

getRowNumLimitAsExpression

public Expression getRowNumLimitAsExpression(int limit)
Description copied from interface: Vendor
Returns an expression for limiting the number of returned rows for engines that support this (ROWNUM <= n)

Specified by:
getRowNumLimitAsExpression in interface Vendor
Overrides:
getRowNumLimitAsExpression in class SQL92
Parameters:
limit - A maximum number of rows, or Database.NO_LIMIT
Returns:
An expression that limits the number of rows, or Expression.TRUE if not supported by the engine

getRowNumLimitAsQueryAppendage

public String getRowNumLimitAsQueryAppendage(int limit)
Description copied from class: SQL92
Technically speaking, SQL 92 supports NO way of limiting result sets (ROW_NUMBER appeared in SQL 2003). We will just use MySQL's LIMIT as it appears to be widely implemented.

Specified by:
getRowNumLimitAsQueryAppendage in interface Vendor
Overrides:
getRowNumLimitAsQueryAppendage in class SQL92
Parameters:
limit - A maximum number of rows, or Database.NO_LIMIT
Returns:
A SQL fragment, or the empty string if unsupported/unnecessary

quoteBinaryLiteral

public String quoteBinaryLiteral(String hexString)
Specified by:
quoteBinaryLiteral in interface Vendor
Overrides:
quoteBinaryLiteral in class SQL92

getDataType

public DataType getDataType(int jdbcType,
                            String name,
                            int size)
Description copied from interface: Vendor
Returns a 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.

Specified by:
getDataType in interface Vendor
Overrides:
getDataType in class SQL92
Parameters:
jdbcType - A java.sql.Types constant
name - The type name, as reported by java.sql metadata methods, normalized to uppercase
size - Character size of the type, or 0 if not applicable
Returns:
A compatible D2RQ DataType instance, or null if the vendor code is broken

initializeConnection

public void initializeConnection(Connection connection)
                          throws SQLException
Description copied from interface: Vendor
Vendor-specific initialization for a database connection.

Specified by:
initializeConnection in interface Vendor
Overrides:
initializeConnection in class SQL92
Throws:
SQLException

booleanExpressionToSimpleExpression

public Expression booleanExpressionToSimpleExpression(Expression expression)
Oracle doesn't actually support booolean expressions, except in a few places. Turn the boolean into an int using a CASE statement

Specified by:
booleanExpressionToSimpleExpression in interface Vendor
Overrides:
booleanExpressionToSimpleExpression in class SQL92
Parameters:
expression - A boolean expression
Returns:
A simple expression returning an equivalent value, e.g., INT 0 and 1

isIgnoredTable

public boolean isIgnoredTable(String schema,
                              String table)
Description copied from interface: Vendor
TODO Use the Filter interface for this

Specified by:
isIgnoredTable in interface Vendor
Overrides:
isIgnoredTable in class SQL92
Parameters:
schema - A schema name, or null for the connection's default schema
table - A table name
Returns:
true if this is a system table that doesn't contain user/application data