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

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

public class MySQL
extends SQL92

This syntax class implements MySQL-compatible SQL syntax.

Author:
Richard Cyganiak (richard@cyganiak.de)

Nested Class Summary
static class MySQL.MySQLCompatibilityBitDataType
           
static class MySQL.MySQLCompatibilityDateDataType
           
static class MySQL.MySQLCompatibilityTimeDataType
           
static class MySQL.MySQLCompatibilityTimestampDataType
           
 
Field Summary
 
Fields inherited from interface de.fuberlin.wiwiss.d2rq.sql.vendor.Vendor
HSQLDB, InterbaseOrFirebird, MSAccess, MySQL, Oracle, PostgreSQL, SQL92, SQLServer
 
Constructor Summary
MySQL()
           
 
Method Summary
 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 quoteIdentifier(String identifier)
          Handles special characters in identifiers.
 String quoteStringLiteral(String s)
          Handles special characters in strings.
 
Methods inherited from class de.fuberlin.wiwiss.d2rq.sql.vendor.SQL92
booleanExpressionToSimpleExpression, getRelationNameAliasExpression, getRowNumLimitAsExpression, getRowNumLimitAsQueryAppendage, getRowNumLimitAsSelectModifier, initializeConnection, isIgnoredTable, quoteAttribute, quoteBinaryLiteral, quoteDateLiteral, quoteRelationName, quoteTimeLiteral, quoteTimestampLiteral
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySQL

public MySQL()
Method Detail

getConcatenationExpression

public String getConcatenationExpression(String[] sqlFragments)
Description copied from interface: Vendor
Concatenation of a and b is "a || b" in standard SQL, but CONCAT(a, b) in MySQL.

Specified by:
getConcatenationExpression in interface Vendor
Overrides:
getConcatenationExpression in class SQL92
Parameters:
sqlFragments - An array of SQL expressions to be concatenated
Returns:
A SQL expression that concatenates the arguments

quoteIdentifier

public String quoteIdentifier(String identifier)
Description copied from interface: Vendor
Handles special characters in identifiers. SQL 92 puts identifiers in double quotes, but MySQL uses backticks.

Specified by:
quoteIdentifier in interface Vendor
Overrides:
quoteIdentifier in class SQL92
Parameters:
identifier - An identifier, such as a table or column name
Returns:
Quoted form of the identifier for use in SQL statements

quoteStringLiteral

public String quoteStringLiteral(String s)
Description copied from interface: Vendor
Handles special characters in strings. Most databases wrap the string in single quotes, and escape single quotes by doubling them. Some databases also require doubling of backslashes.

Specified by:
quoteStringLiteral in interface Vendor
Overrides:
quoteStringLiteral in class SQL92
Parameters:
s - An arbitrary character string
Returns:
A quoted and escaped version safe for use in SQL statements

getDefaultConnectionProperties

public Properties getDefaultConnectionProperties()
Description copied from interface: Vendor
Returns a set of default connection properties to be used when connecting to this database engine type

Specified by:
getDefaultConnectionProperties in interface Vendor
Overrides:
getDefaultConnectionProperties in class SQL92
Returns:
A collection of properties

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