|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.jdbw.server.DefaultSQLDialect
public class DefaultSQLDialect
A default implementation of SQLDialect providing some functionality
which is common to most database servers.
| Constructor Summary | |
|---|---|
DefaultSQLDialect()
|
|
| Method Summary | |
|---|---|
protected Object |
createExampleObject(int sqlType)
|
String |
escapeIdentifier(String identifier)
Takes the name of a database object (table, column, etc) and returns the name wrapped in characters that marks it's an identifier. |
String |
escapeString(String string)
Returns a string with all special characters replaced with their proper escape sequences. |
protected String |
formatBinary(Object value)
|
protected String |
formatBoolean(Object value)
|
String |
formatDate(Date date)
Formats a java Date into the preferred date string format for this database server type, probably YYYY-MM-DD |
protected String |
formatDate(Object value)
|
String |
formatDateTime(Date date)
Formats a java Date into the preferred date time string format for this database server type, probably YYYY-MM-DD HH:MM:SS.ZZZ |
protected String |
formatDatetime(Object value)
|
protected String |
formatDecimal(Object value)
|
protected String |
formatFloatingPoint(Object value)
|
protected String |
formatInteger(Object value)
|
protected String |
formatString(Object value)
|
String |
formatTime(Date date)
Formats a java Date into the preferred time string format for this database server type, probably HH:MM:SS.ZZZ |
protected String |
formatTime(Object value)
|
String |
formatValue(Object value,
int targetType)
Formats a generic object into a String that can be inserted into a dynamically constructed SQL statement. |
String[] |
getCreateTableStatement(String schemaName,
String name,
List<Column> columns,
List<Index> indexes)
|
String |
getDropTableStatement(String catalog,
String schema,
String tableName)
|
String |
getSingleLineCommentPrefix()
|
static boolean |
isBigDecimal(int sqlType)
|
static boolean |
isBinary(int sqlType)
|
static boolean |
isBoolean(int sqlType)
|
boolean |
isCompatible(int fromSqlType,
int toSqlType)
|
static boolean |
isDate(int sqlType)
|
static boolean |
isDatetime(int sqlType)
|
static boolean |
isFloatingPoint(int sqlType)
|
static boolean |
isInteger(int sqlType)
|
static boolean |
isString(int sqlType)
|
static boolean |
isTime(int sqlType)
|
Object |
safeType(Column targetColumn,
Object object)
Attempts to convert a particular value to an acceptable format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultSQLDialect()
| Method Detail |
|---|
public String escapeString(String string)
SQLDialect
escapeString in interface SQLDialectstring - String to convert
public String escapeIdentifier(String identifier)
SQLDialect
escapeIdentifier in interface SQLDialectidentifier - string to wrapp
public String formatDateTime(Date date)
SQLDialect
formatDateTime in interface SQLDialectpublic String formatDate(Date date)
SQLDialect
formatDate in interface SQLDialectdate - Date to format
public String formatTime(Date date)
SQLDialect
formatTime in interface SQLDialectdate - Date to format
public String formatValue(Object value,
int targetType)
SQLDialect
formatValue in interface SQLDialectvalue - Value to be formattedtargetType - java.sql.Types constant of the type you want to format
the value as
public String[] getCreateTableStatement(String schemaName,
String name,
List<Column> columns,
List<Index> indexes)
getCreateTableStatement in interface SQLDialect
public String getDropTableStatement(String catalog,
String schema,
String tableName)
getDropTableStatement in interface SQLDialectpublic String getSingleLineCommentPrefix()
getSingleLineCommentPrefix in interface SQLDialect
public boolean isCompatible(int fromSqlType,
int toSqlType)
isCompatible in interface SQLDialect
public Object safeType(Column targetColumn,
Object object)
SQLDialect
safeType in interface SQLDialecttargetColumn - Column we want to insert intoobject - Object to insert
protected Object createExampleObject(int sqlType)
public static boolean isBigDecimal(int sqlType)
public static boolean isBoolean(int sqlType)
public static boolean isFloatingPoint(int sqlType)
public static boolean isString(int sqlType)
public static boolean isInteger(int sqlType)
public static boolean isDatetime(int sqlType)
public static boolean isDate(int sqlType)
public static boolean isTime(int sqlType)
public static boolean isBinary(int sqlType)
protected String formatDecimal(Object value)
protected String formatBoolean(Object value)
protected String formatFloatingPoint(Object value)
protected String formatString(Object value)
protected String formatInteger(Object value)
protected String formatDatetime(Object value)
protected String formatDate(Object value)
protected String formatTime(Object value)
protected String formatBinary(Object value)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||