public interface Dbms
| Modifier and Type | Method and Description |
|---|---|
String |
alterColumnAddCommentSQL(Column<?> column,
String comment) |
String |
alterColumnNotNullableSQL(String tableName,
Column<?> column)
Return the SQL snippet to alter a column to not nullable.
|
String |
alterTableAddCommentSQL(Table<?> table,
String comment) |
String |
booleanTrueExpression(Column<Boolean> booleanColumn)
Accommodate lack of boolean types in underlying DBMS.
|
boolean |
canBeIndexed(Column<?> column)
Whether a Column can have an SQL index applied to it.
|
boolean |
canDropColumns()
Whether this DBMS can drop columns.
|
<S,O> PoemType<O> |
canRepresent(PoemType<S> storage,
PoemType<O> other)
Enable one PoemType to represent another,
for example a bit to represent a boolean.
|
boolean |
canStoreBlobs()
Whether this DBMS can store binary data.
|
String |
caseInsensitiveRegExpSQL(String term1,
String term2)
Accommodate the variety of ways of ignoring case.
|
String |
createTableOptionsSql()
Accomodate MySQL table creation options.
|
String |
createTableSql(Table<?> table) |
String |
createTableTypeQualifierSql(Table<?> table)
Allow Hsqldb to have a different create table syntax.
|
SQLPoemType<?> |
defaultPoemTypeOfColumnMetaData(ResultSet rs)
The simplest POEM type corresponding to a JDBC description from the
database.
|
SQLPoemException |
exceptionForUpdate(Table<?> table,
PreparedStatement ps,
boolean insert,
SQLException e)
Version of previous method for PreparedStatements.
|
SQLPoemException |
exceptionForUpdate(Table<?> table,
String sql,
boolean insert,
SQLException e)
An exception appropriate for expressing what really went wrong
during a write to the db.
|
String |
getBinarySqlDefinition(int size)
Accommodate different treatment of different sized binary data.
|
Connection |
getConnection(String url,
String user,
String password)
Return a connection.
|
String |
getFixedPtSqlDefinition(int scale,
int precision)
Accommodate differing Fixed Point notations.
|
String |
getForeignKeyDefinition(String tableName,
String fieldName,
String targetTableName,
String targetTableFieldName,
String fixName)
If Foreign key definitions are part of field definitions,
otherwise blank (silently unsupported).
|
String |
getIndexLength(Column<?> column)
Accommodate DBMS which require a length for BLOBS.
|
String |
getJdbcMetadataName(String name)
Some DBMSen (HSQLDB) use canonical uppercased names in the metadata but not
in normal use.
|
String |
getLongSqlDefinition()
Accommodate Long / Bigint deviants.
|
String |
getPrimaryKeyDefinition(String fieldName)
Return the PRIMARY KEY definition string for this dbms.
|
String |
getQuotedName(String name)
Accommodate different quoting strategies.
|
String |
getQuotedValue(SQLType<?> sqlType,
String value)
Accommodate different quoting strategies for values.
|
String |
getSchema()
The db schema name to use, if any.
|
String |
getSqlDefaultValue(SQLType<?> type)
Used to set a not null value when
creating a non nullable column.
|
String |
getSqlDefinition(String sqlTypeName)
Retrieve a SQL type keyword used by the DBMS
for the given Melati type name.
|
String |
getStringSqlDefinition(int size)
Accommodate String / Text distinction.
|
String |
givesCapabilitySQL(Integer userTroid,
String capabilityExpr)
SQL string to get a Capability.
|
String |
melatiName(String name)
Reverse the mapping in unreservedName.
|
String |
preparedStatementPlaceholder(PoemType<?> type)
Accommodate casting in placeholders.
|
String |
selectLimit(String querySelection,
int limit)
Accommodate different limiting syntax.
|
void |
shutdown(Connection connection)
A no-op for all but hsqldb, where the db needs to be shutdown
when the servlet container or jvm is destroyed.
|
String |
sqlBooleanValueOfRaw(Object raw)
Accommodate different true and false values.
|
String |
tableInitialisationSql(Table<?> table) |
String |
toString()
A string to represent this DBMS.
|
void |
unloadDriver()
Used in tests to allow multiple dbmsen to be loaded and unloaded.
|
String |
unreservedName(String name)
Translate special names to non special ones.
|
void unloadDriver()
Connection getConnection(String url, String user, String password) throws ConnectionFailurePoemException
url - the jdbc URLuser - the user to connect as, may be nullpassword - the password for user, may be nullConnectionFailurePoemException - is we cannot connectString getSchema()
void shutdown(Connection connection) throws SQLException
SQLExceptionString getQuotedName(String name)
name - the unquoted nameString getQuotedValue(SQLType<?> sqlType, String value)
sqlType - the SQLType of the valuevalue - the valueString getJdbcMetadataName(String name)
name - entity name such as tableinfoString preparedStatementPlaceholder(PoemType<?> type)
type - the PoemTypePostgresqlString createTableSql(Table<?> table)
String createTableTypeQualifierSql(Table<?> table)
String createTableOptionsSql()
String tableInitialisationSql(Table<?> table)
String getSqlDefinition(String sqlTypeName)
sqlTypeName - the Melati internal type nameString getStringSqlDefinition(int size) throws SQLException
size - the string length (-1 means no limit)SQLExceptionString getLongSqlDefinition()
String sqlBooleanValueOfRaw(Object raw)
String getBinarySqlDefinition(int size) throws SQLException
size - how big the field isSQLExceptionString getFixedPtSqlDefinition(int scale, int precision) throws SQLException
scale - the number of places to right of decimal pointprecision - how many digits in totalSQLException - potentially<S,O> PoemType<O> canRepresent(PoemType<S> storage, PoemType<O> other)
storage - the containerother - the type to storeSQLPoemType<?> defaultPoemTypeOfColumnMetaData(ResultSet rs) throws SQLException
rs - the JDBC metadataSQLException - potentiallyboolean canDropColumns()
boolean canStoreBlobs()
SQLPoemException exceptionForUpdate(Table<?> table, String sql, boolean insert, SQLException e)
table - The table on which the update was affectedsql - The operation attempted, or possibly nullinsert - Whether the operation was an INSERT as
opposed to an UPDATEe - The raw SQL exception: the routine is meant to
try to interpret e.getMessage if it canPostgresql.exceptionForUpdate(org.melati.poem.Table<?>, java.lang.String, boolean, java.sql.SQLException)SQLPoemException exceptionForUpdate(Table<?> table, PreparedStatement ps, boolean insert, SQLException e)
table - The table on which the update was affectedps - The operation attempted, or possibly nullinsert - Whether the operation was an INSERT as
opposed to an UPDATEe - The raw SQL exception: the routine is meant to
try to interpret e.getMessage if it canAnsiStandard.exceptionForUpdate(org.melati.poem.Table, java.lang.String,
boolean, java.sql.SQLException)String unreservedName(String name)
name - the field or table nameString melatiName(String name)
name - an SQL nameString getIndexLength(Column<?> column)
column - the POEM Column we are dealing withboolean canBeIndexed(Column<?> column)
column - the POEM Column we are dealing withString givesCapabilitySQL(Integer userTroid, String capabilityExpr)
userTroid - the troid of the User to use in the querycapabilityExpr - the capability troid we needString caseInsensitiveRegExpSQL(String term1, String term2)
term1 - the term to find interm2 - the quoted term to findString toString()
String getForeignKeyDefinition(String tableName, String fieldName, String targetTableName, String targetTableFieldName, String fixName)
tableName - the table that this column is in, unquotedfieldName - often the name of the foreign table, unquotedtargetTableName - the table that this is a foreign key into, unquotedtargetTableFieldName - name of the primary key field of the foreign
table, often id, unquotedfixName - name of the IntegrityFixString getPrimaryKeyDefinition(String fieldName)
fieldName - the table Troid column, often id, unquotedString alterColumnNotNullableSQL(String tableName, Column<?> column)
tableName - column - String alterColumnAddCommentSQL(Column<?> column, String comment)
column - the target to add a remark tocomment - the remark to addString alterTableAddCommentSQL(Table<?> table, String comment)
table - the target to add a remark tocomment - the remark to addString selectLimit(String querySelection, int limit)
querySelection - main body of querylimit - number to limit toString booleanTrueExpression(Column<Boolean> booleanColumn)
booleanColumn - the column which should be a booleanCopyright © 2000–2021 PanEris. All rights reserved.