|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Vendor
Encapsulates differences in SQL syntax between database engines. Methods only exists for SQL features where at least one engine requires custom syntax differing from SQL-92.
Field Summary | |
---|---|
static Vendor |
HSQLDB
|
static Vendor |
InterbaseOrFirebird
|
static org.apache.commons.logging.Log |
log
|
static Vendor |
MSAccess
|
static Vendor |
MySQL
|
static Vendor |
Oracle
|
static Vendor |
PostgreSQL
|
static Vendor |
SQL92
|
static Vendor |
SQLServer
|
static Vendor |
Sybase
|
Method Summary | |
---|---|
Expression |
booleanExpressionToSimpleExpression(Expression expression)
Turns a BOOLEAN expression into an expression that is guaranteed to be usable in any place where an expression is allowed. |
String |
getAliasOperator()
An alias declaration for use in FROM clauses. |
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 |
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)
Returns a fragment to be appended to a SQL query in order to add a limit to the number of returned rows for engines that support this ( LIMIT n ) |
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 ) |
String |
getTrueTable()
For databases that support SQL queries without a FROM
clause, (SELECT 1+1 ), this should return null . |
void |
initializeConnection(Connection connection)
Vendor-specific initialization for a database connection. |
boolean |
isIgnoredTable(String catalog,
String schema,
String table)
TODO Use the Filter interface for this |
Identifier[] |
parseIdentifiers(String s,
int minParts,
int maxParts)
Parses SQL identifiers, such as column names and table names. |
String |
quoteBinaryLiteral(String hexString)
|
String |
quoteDateLiteral(String date)
|
String |
quoteStringLiteral(String s)
Handles special characters in strings. |
String |
quoteTimeLiteral(String time)
|
String |
quoteTimestampLiteral(String timestamp)
|
TableName |
toQualifiedTableName(String catalog,
String schema,
String table)
Returns a qualified table name from catalog/schema/table strings as reported from JDBC metadata. |
String |
toString(ColumnName column)
Handles special characters in qualified column names. |
String |
toString(Identifier identifier)
Handles special characters in identifiers. |
String |
toString(TableName table)
Handles special characters in qualified table names. |
Field Detail |
---|
static final org.apache.commons.logging.Log log
static final Vendor SQL92
static final Vendor MySQL
static final Vendor PostgreSQL
static final Vendor InterbaseOrFirebird
static final Vendor Oracle
static final Vendor SQLServer
static final Vendor MSAccess
static final Vendor Sybase
static final Vendor HSQLDB
Method Detail |
---|
String getConcatenationExpression(String[] sqlFragments)
a
and b
is
"a || b
" in standard SQL, but CONCAT(a, b)
in MySQL.
sqlFragments
- An array of SQL expressions to be concatenated
String getAliasOperator()
FROM
clauses.
Would return AS
for SQL 92, and a single space
for Oracle (the AS is optional in SQL 92, but some engines require
it, while others don't understand it).
String getTrueTable()
FROM
clause, (SELECT 1+1
), this should return null
.
For databases that require some sort of dummy table (e.g., Oracle:
SELECT 1+1 FROM DUAL
), this should return the name of
that table.
Identifier[] parseIdentifiers(String s, int minParts, int maxParts) throws Identifier.IdentifierParseException
MYCATALOG.MYSCHEMA."Table 1".ID
s
- The input stringminParts
- Minimum required identifiers, e.g., 1 for an unqualified identifiermaxParts
- Maximum required identifiers, e.g., 4 for a fully qualified column name
Identifier.IdentifierParseException
- on invalid syntaxString toString(Identifier identifier)
identifier
- An identifier, such as an unqualified table or column name
String toString(TableName table)
table
- A qualified table name
String toString(ColumnName column)
column
- A qualified column name
String quoteStringLiteral(String s)
s
- An arbitrary character string
String quoteBinaryLiteral(String hexString)
String quoteDateLiteral(String date)
String quoteTimeLiteral(String time)
String quoteTimestampLiteral(String timestamp)
Expression getRowNumLimitAsExpression(int limit)
ROWNUM <= n
)
limit
- A maximum number of rows, or Database.NO_LIMIT
Expression.TRUE
if not supported by the engineString getRowNumLimitAsSelectModifier(int limit)
TOP n
)
limit
- A maximum number of rows, or Database.NO_LIMIT
String getRowNumLimitAsQueryAppendage(int limit)
LIMIT n
)
limit
- A maximum number of rows, or Database.NO_LIMIT
Properties getDefaultConnectionProperties()
DataType getDataType(int jdbcType, String name, int size)
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.
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 brokenExpression booleanExpressionToSimpleExpression(Expression expression)
expression
- A boolean expression
boolean isIgnoredTable(String catalog, String schema, String table)
catalog
- A catalog name, or null
for the connection's default schemaschema
- 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 dataTableName toQualifiedTableName(String catalog, String schema, String table)
catalog
- A catalog name, or null
for the connection's default schemaschema
- A schema name, or null
for the connection's default schematable
- A table name
void initializeConnection(Connection connection) throws SQLException
connection
-
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |