|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Dbms
A Database Management System.
Method Summary | |
---|---|
String |
alterColumnNotNullableSQL(String tableName,
Column column)
Return the SQL snippet to alter a column to not nullable. |
String |
booleanTrueExpression(Column booleanColumn)
Accomodate lack of boolean types. |
boolean |
canBeIndexed(Column column)
Whether a Column can have an SQL index applied to it. |
boolean |
canDropColumns()
Whether this DBMS can drop columns. |
PoemType<?> |
canRepresent(PoemType<?> storage,
PoemType<?> type)
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)
Accomodate 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)
Accomodate different treatment of different sized binary data. |
Connection |
getConnection(String url,
String user,
String password)
Return a connection. |
String |
getFixedPtSqlDefinition(int scale,
int precision)
Accomodate 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)
Accomodate 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()
Accomodate Long / Bigint deviants. |
String |
getPrimaryKeyDefinition(String fieldName)
Return the PRIMARY KEY definition string for this dbms. |
String |
getQuotedName(String name)
Accomodate different quoting strategies. |
String |
getQuotedValue(SQLType sqlType,
String value)
Accomodate 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)
Accomodate 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)
Accomodate casting in placeholders. |
String |
selectLimit(String querySelection,
int limit)
Accomodate 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)
Accomodate 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. |
Method Detail |
---|
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 null
ConnectionFailurePoemException
- is we cannot connectString getSchema()
void shutdown(Connection connection) throws SQLException
SQLException
String getQuotedName(String name)
name
- the unquoted name
String getQuotedValue(SQLType sqlType, String value)
sqlType
- the SQLType of the valuevalue
- the value
String getJdbcMetadataName(String name)
name
- entity name such as tableinfo
String preparedStatementPlaceholder(PoemType<?> type)
type
-
Postgresql
String createTableSql(Table table)
String createTableTypeQualifierSql(Table table)
String createTableOptionsSql()
String tableInitialisationSql(Table table)
table
-
String getSqlDefinition(String sqlTypeName)
sqlTypeName
- the Melati internal type name
String getStringSqlDefinition(int size) throws SQLException
size
- the string length (-1 means no limit)
SQLException
String getLongSqlDefinition()
String sqlBooleanValueOfRaw(Object raw)
String getBinarySqlDefinition(int size) throws SQLException
size
- how big the field is
SQLException
String getFixedPtSqlDefinition(int scale, int precision) throws SQLException
scale
- the number of places to right of decimal pointprecision
- how many digits in total
SQLException
- potentiallyPoemType<?> canRepresent(PoemType<?> storage, PoemType<?> type)
storage
- the POEM native typetype
- the current type
SQLPoemType defaultPoemTypeOfColumnMetaData(ResultSet rs) throws SQLException
rs
- the JDBC metadata
SQLException
- 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 can
Postgresql.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 can
AnsiStandard.exceptionForUpdate(org.melati.poem.Table, java.lang.String,
boolean, java.sql.SQLException)
String unreservedName(String name)
name
- the field or table name
String melatiName(String name)
name
- an SQL name
String getIndexLength(Column column)
column
- the POEM Column we are dealing with
boolean canBeIndexed(Column column)
column
- the POEM Column we are dealing with
String givesCapabilitySQL(Integer userTroid, String capabilityExpr)
userTroid
- the troid of the User to use in the querycapabilityExpr
- the capability troid we need
String caseInsensitiveRegExpSQL(String term1, String term2)
term1
- the term to find interm2
- the quoted term to find
String toString()
toString
in class Object
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 IntegrityFix
String getPrimaryKeyDefinition(String fieldName)
fieldName
- the table Troid column, often id
, unquoted
String alterColumnNotNullableSQL(String tableName, Column column)
tableName
- column
-
String selectLimit(String querySelection, int limit)
querySelection
- main body of querylimit
- number to limit to
String booleanTrueExpression(Column booleanColumn)
booleanColumn
-
String getSqlDefaultValue(SQLType type)
type
- the type name
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |