|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DatabaseType
Definition of the per-database functionality needed to isolate the differences between the various databases.
| Method Summary | |
|---|---|
void |
appendColumnArg(StringBuilder sb,
FieldType fieldType,
List<String> additionalArgs,
List<String> statementsBefore,
List<String> statementsAfter,
List<String> queriesAfter)
Takes a FieldType and appends the SQL necessary to create the field to the string builder. |
void |
appendCreateTableSuffix(StringBuilder sb)
Append the SQL necessary to properly finish a CREATE TABLE line. |
void |
appendEscapedEntityName(StringBuilder sb,
String word)
Add a entity-name word to the string builder wrapped in the proper characters to escape it. |
void |
appendEscapedWord(StringBuilder sb,
String word)
Add the word to the string builder wrapped in the proper characters to escape it. |
void |
appendLimitValue(StringBuilder sb,
int limit)
Append to the string builder the necessary SQL to limit the results to a certain number. |
void |
appendSelectNextValFromSequence(StringBuilder sb,
String sequenceName)
Append the SQL necessary to get the next-value from a sequence. |
DatabaseAccess |
buildDatabaseAccess(DataSource dataSource)
Return a newly built database access object which possibly is attached to the provided data source. |
String |
convertColumnName(String columnName)
Convert and return the column name for table and sequence creation. |
void |
dropColumnArg(FieldType fieldType,
List<String> statementsBefore,
List<String> statementsAfter)
Takes a FieldType and adds the necessary statements to the before and after lists necessary so that the
dropping of the table will succeed and will clear other associated sequences or other database artifacts |
String |
generateIdSequenceName(String tableName,
FieldType idFieldType)
Return the name of an ID sequence based on the tabelName and the fieldType of the id. |
String |
getCommentLinePrefix()
Return the prefix to put at the front of a SQL line to mark it as a comment. |
String |
getDriverClassName()
Return the class name of the database driver. |
String |
getDriverUrlPart()
Return the part in the database URI which identifies the particular database. |
FieldConverter |
getFieldConverter(FieldType fieldType)
Return the FieldConverter to associate with the FieldType. |
boolean |
isCreateTableReturnsZero()
Returns true if a 'CREATE TABLE' statement should return 0. |
boolean |
isEntityNamesMustBeUpCase()
Returns true if table and field names should be made uppercase. |
boolean |
isIdSequenceNeeded()
Return true if the database needs a sequence when you use generated IDs. |
boolean |
isLimitAfterSelect()
Return true if the LIMIT should be called after SELECT otherwise at the end of the WHERE (the default). |
boolean |
isLimitSqlSupported()
Return true if the database supports the LIMIT SQL command. |
boolean |
isVarcharFieldWidthSupported()
Return true if the database supports the width parameter on VARCHAR fields. |
void |
loadDriver()
Load the driver class associated with this database so it can wire itself into JDBC. |
| Method Detail |
|---|
String getDriverUrlPart()
String getDriverClassName()
DatabaseAccess buildDatabaseAccess(DataSource dataSource)
void loadDriver()
throws ClassNotFoundException
ClassNotFoundException - If the driver class is not available in the classpath.
void appendColumnArg(StringBuilder sb,
FieldType fieldType,
List<String> additionalArgs,
List<String> statementsBefore,
List<String> statementsAfter,
List<String> queriesAfter)
FieldType and appends the SQL necessary to create the field to the string builder. The field may
also generate additional arguments which go at the end of the insert statement or additional statements to be
executed before or afterwards depending on the configurations. The database can also add to the list of queries
that will be performed afterward to test portions of the config.
String convertColumnName(String columnName)
void dropColumnArg(FieldType fieldType,
List<String> statementsBefore,
List<String> statementsAfter)
FieldType and adds the necessary statements to the before and after lists necessary so that the
dropping of the table will succeed and will clear other associated sequences or other database artifacts
void appendEscapedEntityName(StringBuilder sb,
String word)
void appendEscapedWord(StringBuilder sb,
String word)
String generateIdSequenceName(String tableName,
FieldType idFieldType)
String getCommentLinePrefix()
boolean isIdSequenceNeeded()
FieldConverter getFieldConverter(FieldType fieldType)
FieldConverter to associate with the FieldType. This allows the database instance to
convert a field as necessary before it goes to the database.
boolean isVarcharFieldWidthSupported()
boolean isLimitSqlSupported()
Statement.setMaxRows(int) instead. See prepareSqlStatement in MappedPreparedQuery.
boolean isLimitAfterSelect()
void appendLimitValue(StringBuilder sb,
int limit)
void appendSelectNextValFromSequence(StringBuilder sb,
String sequenceName)
isIdSequenceNeeded() is true.
void appendCreateTableSuffix(StringBuilder sb)
boolean isCreateTableReturnsZero()
boolean isEntityNamesMustBeUpCase()
Turns out that Derby and Hsqldb are doing something wrong (IMO) with entity names. If you create a table with the name "footable" (with the quotes) then it will be created as lowercase footable, case sensitive. However, if you then issue the query 'select * from footable' it won't find the table because it gets promoted to be FOOTABLE and is searched in a case sensitive manner. So for these databases, entity names have to be forced to be uppercase so external queries will also work.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||