|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.sql.SqlDialect
public class SqlDialect
SqlDialect
encapsulates the differences between dialects of SQL,
for the benefit of a SqlWriter
.
Field Summary | |
---|---|
(package private) String |
databaseProductName
|
(package private) String |
identifierQuoteString
|
Constructor Summary | |
---|---|
SqlDialect(DatabaseMetaData databaseMetaData)
Creates a SqlDialect |
Method Summary | |
---|---|
protected boolean |
allowsAs()
|
boolean |
identifierNeedsToBeQuoted(String val)
Returns whether a given identifier needs to be quoted. |
boolean |
isAccess()
|
boolean |
isOracle()
|
boolean |
isPostgres()
|
boolean |
isSqlServer()
|
String |
quoteIdentifier(String val)
Encloses an identifier in quotation marks appropriate for the current SQL dialect. |
StringBuilder |
quoteIdentifier(StringBuilder buf,
List<String> identifiers)
Quotes a multi-part identifier. |
StringBuilder |
quoteIdentifier(StringBuilder buf,
String val)
Encloses an identifier in quotation marks appropriate for the current SQL dialect, writing the result to a StringBuilder . |
String |
quoteStringLiteral(String val)
Converts a string into a string literal. |
protected boolean |
requiresAliasForFromItems()
|
String |
unquoteStringLiteral(String val)
Converts a string literal back into a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
String databaseProductName
String identifierQuoteString
Constructor Detail |
---|
public SqlDialect(DatabaseMetaData databaseMetaData)
SqlDialect
databaseMetaData
- used to determine which dialect of SQL to
generateMethod Detail |
---|
public boolean isAccess()
public boolean isOracle()
public boolean isPostgres()
public boolean isSqlServer()
public String quoteIdentifier(String val)
For example, quoteIdentifier("emp")
yields a string
containing "emp"
in Oracle, and a string containing
[emp]
in Access.
val
- Identifier to quote
public StringBuilder quoteIdentifier(StringBuilder buf, String val)
StringBuilder
.
For example, quoteIdentifier("emp")
yields a string
containing "emp"
in Oracle, and a string containing
[emp]
in Access.
buf
- Bufferval
- Identifier to quote
public StringBuilder quoteIdentifier(StringBuilder buf, List<String> identifiers)
buf
- Bufferidentifiers
- List of parts of the identifier to quote
public boolean identifierNeedsToBeQuoted(String val)
public String quoteStringLiteral(String val)
can't
run
becomes 'can''t run'
.
public String unquoteStringLiteral(String val)
'can''t
run'
becomes can't run
.
protected boolean allowsAs()
protected boolean requiresAliasForFromItems()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |