|
SRJRCFrames v0.1.296 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DbUtil
use database specific code in a generic way. AbstractDbUtils is a
base class for all database implementations and handles the common stuff.
This way we decide at runtime, which type of database should be used.
| Field Summary | |
|---|---|
static String |
EMPTY_STRING
|
static String |
ONE_SPACE
|
static String |
PK_NAME
|
| Method Summary | ||
|---|---|---|
Collection<ColumnMetaData> |
columnDefinitions(Connection conn,
TableDefinition td)
|
|
String |
genAccessRightsFor(TableDefinition tbInfo,
String defaultUser)
generates a SQL-string to grant access rights to tables |
|
String |
genAccessRightsForPK(TableDefinition tbInfo,
String defaultUser)
generates a SQL-string to grant access to an external sequence |
|
String |
genColumnCreation(ColumnDefinition colDef)
generates a SQL string to add a column to an existing table |
|
String |
genColumnModification(ColumnDefinition colDef)
generates a SQL string to modify a column of an existing table |
|
String |
genCondition(EntityDescriptor ed,
Collection<ConditionElement> args)
generates a condition string for SQL statements |
|
|
genCondition(EntityDescriptor ed,
E instance,
Collection<String> fields)
generates a condition string for SQL statements |
|
String |
genCondition(EntityDescriptor ed,
Map<String,Object> args)
generates a condition string for SQL statements |
|
String |
genDBAccess(DatabaseModel dbInfo,
String user)
generates a SQL-string to grant access rights to the entire database |
|
String |
genDBCreation(DatabaseModel dbInfo)
generates a SQL string to create a database |
|
String |
genIndexCreation(IndexDefinition iInfo)
generates a SQL string to create an index |
|
String |
genIndexRemoval(IndexDefinition iInfo)
generates a SQL string to remove an index |
|
String |
genInsert(EntityDescriptor ed,
Entity instance)
generates a SQL-insert statement for given instance |
|
String |
genInsertIdQuery(EntityDescriptor ed,
Date dtCreated,
String userName)
generates a query for the generated autoincrement key. |
|
String |
genOrder(EntityDescriptor ed,
Collection<String> properties)
generates the sorting part of a SQL query |
|
String |
genOrder(EntityDescriptor ed,
Collection<String> properties,
Collection<SortInfo> orderSequence)
generates the sorting part of an SQL-query. |
|
String |
genRemove(EntityDescriptor ed,
Collection<ConditionElement> args)
generates a SQL delete statement |
|
String |
genSchemaAccess(SchemaDefinition schemInfo,
String defaultUser)
generates a SQL-string to grant access rights to schema |
|
String |
genSchemaCreation(SchemaDefinition schemInfo)
generates a SQL string to create a schema |
|
String |
genSequenceReset(TableDefinition tbInfo)
generates a SQL string to reset an external sequence |
|
String |
genTableCreation(TableDefinition tbInfo)
generates a SQL string to create a database table |
|
String |
genTableMetaAccess(TableDefinition tbInfo)
generates a SQL query that returns no data to access tables meta data information |
|
String |
genTablePKCreation(TableDefinition tbInfo)
generates a statement to create an external sequence for autoincrement-column |
|
String |
genTablePKMod(TableDefinition tbInfo)
generates a statement to modify the external sequence after table creation. |
|
String |
genTableRemoval(TableDefinition tbInfo)
generates a SQL string that removes a table from database |
|
String |
genTableRemoval(TableDefinition tbInfo,
boolean withExist)
generates a SQL string that removes a table from database. |
|
String |
genTruncate(EntityDescriptor ed)
generates a SQL statement that truncates a database table, which means, that all entries will be removed. |
|
String |
genUpdate(EntityDescriptor ed,
Entity instance)
generates a SQL statement to change the persistent view of an entity |
|
String |
genUpdate(EntityDescriptor ed,
Entity instance,
Collection<String> fields,
boolean withCondition)
generates a SQL statement to partially change the persistent view of an entity. |
|
String |
genUserCreation(String username,
String password)
generates a SQL statement to create a user/role/principal |
|
String |
genUserCreation(String username,
String password,
String host)
generates a SQL statement to create a user/role/principal. |
|
String |
getFieldSeparator()
returns the separator used in field lists |
|
String |
getMapped(EntityDescriptor ed,
String attributeName)
get the physical name for the given property, already quoted with the right syntax for the involved database |
|
String |
getMapped(String dbObjName)
returns the quoted name of database identifiers (table, column, etc), cause we always want do handle case sensitive identifiers |
|
String |
getSchemaSeparator()
returns the schema separator for the actual storage. |
|
String |
getTableNameFor(EntityDescriptor ed)
returns the tablename for given entity |
|
String |
getTableNameFor(TableDefinition ti)
returns the tablename of given table model information |
|
String |
getTerminator()
returns the terminator of SQL statements |
|
ColumnType |
getTypeFrom(int sqlType)
maps SQL types to logical ColumnTypes used by application |
|
Collection<IndexMetaData> |
indexDefinitions(Connection conn,
TableDefinition td)
|
|
boolean |
needDropIndexAfterDropTable()
signals whether an index must be dropped separately after removal of a table |
|
boolean |
needExternalSequenceForSerial()
signals whether the database needs an external sequence to support autoincrement columns |
|
boolean |
needSequenceResetAfterTruncate()
signals whether the database needs to set a new value to the sequence on removing all records of a table |
|
boolean |
needsUpdate(ColumnDefinition targetColDef,
ColumnDefinition other)
|
|
boolean |
needsUpdate(IndexDefinition targetIndexDef,
IndexDefinition other)
|
|
String |
quoteAndCutValue(Object value,
int size)
some databases pad strings to an unsupported size, so this call ensures, that the quoted string does not exceed the defined column size. |
|
Collection<SchemaDefinition> |
schemaDefinitions(Connection conn)
|
|
boolean |
supportsGeneratedKeyQuery()
signals whether the JDBC implementation supports the call for generated (autoincrement) keys. |
|
Collection<TableDefinition> |
tableDefinitions(Connection conn,
SchemaDefinition sd)
|
|
| Field Detail |
|---|
static final String EMPTY_STRING
static final String ONE_SPACE
static final String PK_NAME
| Method Detail |
|---|
Collection<ColumnMetaData> columnDefinitions(Connection conn,
TableDefinition td)
String genAccessRightsFor(TableDefinition tbInfo,
String defaultUser)
tbInfo - - table model informationdefaultUser - - the user that gets the rights granted
String genAccessRightsForPK(TableDefinition tbInfo,
String defaultUser)
tbInfo - - table model informationdefaultUser - - the user that gets the rights granted
String genColumnCreation(ColumnDefinition colDef)
colDef - - column model information
String genColumnModification(ColumnDefinition colDef)
colDef - - column model information
String genCondition(EntityDescriptor ed,
Collection<ConditionElement> args)
ed - - descriptor of the entityargs - - list of elements that form the condition
<E extends Entity> String genCondition(EntityDescriptor ed,
E instance,
Collection<String> fields)
E - - the entity to useed - - descriptor of the entityinstance - - instance of that entity, containing the values for the
conditionfields - - list of attributes used in the condition
String genCondition(EntityDescriptor ed,
Map<String,Object> args)
ed - - descriptor of the entityargs - - map of attribute/value pairs to build the condition from
String genDBAccess(DatabaseModel dbInfo,
String user)
dbInfo - - database model informationuser - - the user that gets the rights granted
String genDBCreation(DatabaseModel dbInfo)
dbInfo - - database model information
String genIndexCreation(IndexDefinition iInfo)
iInfo - - index model information
String genIndexRemoval(IndexDefinition iInfo)
iInfo - - index model information
String genInsert(EntityDescriptor ed,
Entity instance)
ed - - descriptor of the entityinstance - - the instance that should be copied to persistence
String genInsertIdQuery(EntityDescriptor ed,
Date dtCreated,
String userName)
Statement.getGeneratedKeys(). So they have to support at least
dirty reads.
ed - - descriptor of the entitydtCreated - - timestamp of the insertuserName - - name of the user that triggered the insert
String genOrder(EntityDescriptor ed,
Collection<String> properties)
ed - - descriptor of the entityproperties - - list of attributes to sort by
String genOrder(EntityDescriptor ed,
Collection<String> properties,
Collection<SortInfo> orderSequence)
ed - - descriptor of the entityproperties - - list of attributes to readorderSequence - - list of sorting segment info
String genRemove(EntityDescriptor ed,
Collection<ConditionElement> args)
ed - - descriptor of the entity to removeargs - - list of elements that form the condition
String genSchemaAccess(SchemaDefinition schemInfo,
String defaultUser)
schemInfo - - schema model informationdefaultUser - - the user that gets the rights granted
String genSchemaCreation(SchemaDefinition schemInfo)
schemInfo - - schema model information
String genSequenceReset(TableDefinition tbInfo)
tbInfo - - table model information
String genTableCreation(TableDefinition tbInfo)
tbInfo - - table model information
String genTableMetaAccess(TableDefinition tbInfo)
tbInfo - - table model information
String genTablePKCreation(TableDefinition tbInfo)
tbInfo - - table model information
String genTablePKMod(TableDefinition tbInfo)
tbInfo - - table model information
String genTableRemoval(TableDefinition tbInfo)
tbInfo - - table model information
String genTableRemoval(TableDefinition tbInfo,
boolean withExist)
tbInfo - - table model informationwithExist - - flag to indicate, whether existence check should be added
String genTruncate(EntityDescriptor ed)
Truncation of a table may require additional permissions beside the permission to delete records.
ed - - descriptor of the Entity
String genUpdate(EntityDescriptor ed,
Entity instance)
ed - - descriptor of the involved entityinstance - - the instance to save
String genUpdate(EntityDescriptor ed,
Entity instance,
Collection<String> fields,
boolean withCondition)
ed - - descriptor of the involved entityinstance - - instance containing the modified values to savefields - the attribute names to modifywithCondition -
String genUserCreation(String username,
String password)
username - - name of the userpassword - - password for that user
String genUserCreation(String username,
String password,
String host)
username - - name of the userpassword - - password for that userhost - - name of the host
String getFieldSeparator()
String getMapped(EntityDescriptor ed,
String attributeName)
ed - - descriptor of the involved entityattributeName - - name of attribute to map
String getMapped(String dbObjName)
dbObjName - - the identifier to quote
String getSchemaSeparator()
String getTableNameFor(EntityDescriptor ed)
ed - - descriptor of an entity
String getTableNameFor(TableDefinition ti)
ti - - table model information
String getTerminator()
ColumnType getTypeFrom(int sqlType)
ColumnTypes used by application
sqlType - - a SQL type to map
ColumnType
Collection<IndexMetaData> indexDefinitions(Connection conn,
TableDefinition td)
boolean needDropIndexAfterDropTable()
boolean needExternalSequenceForSerial()
boolean needSequenceResetAfterTruncate()
boolean needsUpdate(ColumnDefinition targetColDef,
ColumnDefinition other)
boolean needsUpdate(IndexDefinition targetIndexDef,
IndexDefinition other)
String quoteAndCutValue(Object value,
int size)
value - - the value to storesize - - declared field size
Collection<SchemaDefinition> schemaDefinitions(Connection conn)
boolean supportsGeneratedKeyQuery()
Collection<TableDefinition> tableDefinitions(Connection conn,
SchemaDefinition sd)
|
SRJRCFrames v0.1.296 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||