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

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

public class SQLServer
extends SQL92

This syntax class implements SQL syntax for MS SQL Server and MS Access.

Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
 
Fields inherited from interface de.fuberlin.wiwiss.d2rq.sql.vendor.Vendor
HSQLDB, InterbaseOrFirebird, MSAccess, MySQL, Oracle, PostgreSQL, SQL92, SQLServer
 
Constructor Summary
SQLServer()
           
 
Method Summary
 DataType getDataType(int jdbcType, String name, int size)
          Returns a DataType corresponding to a JDBC type.
 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)
 boolean isIgnoredTable(String schema, String table)
          TODO Use the Filter interface for this
 String quoteBinaryLiteral(String hexString)
           
 String quoteDateLiteral(String date)
           
 String quoteTimeLiteral(String time)
           
 String quoteTimestampLiteral(String timestamp)
           
 
Methods inherited from class de.fuberlin.wiwiss.d2rq.sql.vendor.SQL92
booleanExpressionToSimpleExpression, getConcatenationExpression, getDefaultConnectionProperties, getRelationNameAliasExpression, getRowNumLimitAsExpression, initializeConnection, quoteAttribute, quoteIdentifier, quoteRelationName, quoteStringLiteral
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLServer

public SQLServer()
Method Detail

getRowNumLimitAsSelectModifier

public String getRowNumLimitAsSelectModifier(int limit)
Description copied from interface: Vendor
Returns a modifier for the SELECT keyword that adds a limit to the number of returned rows for engines that support this (TOP n)

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

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

quoteDateLiteral

public String quoteDateLiteral(String date)
Specified by:
quoteDateLiteral in interface Vendor
Overrides:
quoteDateLiteral in class SQL92

quoteTimeLiteral

public String quoteTimeLiteral(String time)
Specified by:
quoteTimeLiteral in interface Vendor
Overrides:
quoteTimeLiteral in class SQL92

quoteTimestampLiteral

public String quoteTimestampLiteral(String timestamp)
Specified by:
quoteTimestampLiteral in interface Vendor
Overrides:
quoteTimestampLiteral 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

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