|
||||||||||
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 Vendor |
MSAccess
|
static Vendor |
MySQL
|
static Vendor |
Oracle
|
static Vendor |
PostgreSQL
|
static Vendor |
SQL92
|
static Vendor |
SQLServer
|
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 |
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)
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 ) |
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)
|
Field Detail |
---|
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 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 getRelationNameAliasExpression(RelationName relationName, RelationName aliasName)
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).
relationName
- The original table namealiasName
- The alias for the table name
String quoteAttribute(Attribute attribute)
attribute
- An attribute name (column name)
String quoteRelationName(RelationName relationName)
relationName
- A relation name (table name)
String quoteIdentifier(String identifier)
identifier
- An identifier, such as a table or 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 schema, String table)
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 datavoid initializeConnection(Connection connection) throws SQLException
connection
-
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |