|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Database
Interface intended to be an abstraction for a any database.
Method Summary | |
---|---|
void |
beginTransaction(int transactionIsolationLevel)
Starts a transaction. |
void |
endTransaction(boolean rollback)
Ends a transaction. |
void |
ensureTableExists(java.lang.String tableName,
FieldDescriptor fixedDescriptor,
java.util.Collection fieldDescriptors,
java.util.Collection indexDescriptors,
boolean userManaged,
boolean autoIncrementRequested,
boolean deleteFields)
Ensures that a table exists and modifies fields and indexes as needed. |
int |
getMaxColumnNameLength()
|
int |
getMaxTableNameLength()
|
void |
init(javax.sql.DataSource dataSource)
This method should be invoked as soon as the Database implementation is instantiated by a DatabaseFactory . |
java.lang.Long |
insert(java.lang.String tableName,
java.lang.String idField,
java.lang.String[] fieldNames,
java.lang.Object[] values,
boolean autoIncrementRequested)
Inserts a record in the database. |
boolean |
inTransaction()
|
boolean |
isDuplicateEntryError(java.sql.SQLException se)
Determines whether a SQLException corresponds to a duplicate record error. |
java.lang.String |
normalizeName(java.lang.String itemName)
Coverts a field or table name to the name that will actually be used in the database. |
ResultsIterator<BeanWrapper> |
query(java.lang.String sql,
java.lang.Object[] parameters,
BeanUnmarshaller unmarshaller)
Performs a database query. |
void |
relinquishLock(boolean rollback)
Gives up a lock previously obtained by invoking requestLock
in the current thread. |
void |
requestLock(java.lang.String lockName,
int transactionIsolationLevel)
Requests a record lock. |
void |
rollback(java.sql.Savepoint savepoint)
|
java.sql.Savepoint |
setSavepoint(java.lang.String savepointName)
|
int |
update(java.lang.String sql,
java.lang.Object[] parameters)
Executes a database statement. |
Method Detail |
---|
void init(javax.sql.DataSource dataSource) throws java.sql.SQLException
DatabaseFactory
.
dataSource
- A DataSource instance.
java.sql.SQLException
int getMaxTableNameLength() throws java.sql.SQLException
java.sql.SQLException
int getMaxColumnNameLength() throws java.sql.SQLException
java.sql.SQLException
void ensureTableExists(java.lang.String tableName, FieldDescriptor fixedDescriptor, java.util.Collection fieldDescriptors, java.util.Collection indexDescriptors, boolean userManaged, boolean autoIncrementRequested, boolean deleteFields) throws java.sql.SQLException
tableName
- Name of the table.fixedDescriptor
- A FieldDescriptor which cannot be removed later (typically the table's primary key.)fieldDescriptors
- A collection of FieldDescriptor instances.indexDescriptors
- A collection of IndexDescriptor instances.autoIncrementRequested
- Whether auto-increment is requested for mandatory field.deleteFields
- Whether fields not requested that were found in the table should be deleted.
java.sql.SQLException
ResultsIterator<BeanWrapper> query(java.lang.String sql, java.lang.Object[] parameters, BeanUnmarshaller unmarshaller) throws java.sql.SQLException
sql
- A SQL SELECT statement with question marks (?) as placeholders.parameters
- An array of parameters whose length is equal to the number of placeholders in the SQL statement.unmarshaller
- A BeanUnmarshaller implementation instance.
java.sql.SQLException
update(java.lang.String, java.lang.Object[])
int update(java.lang.String sql, java.lang.Object[] parameters) throws java.sql.SQLException
sql
- A SQL modification statement with question marks (?) as placeholders.parameters
- An array of parameters whose length is equal to the number of placeholders in the SQL statement.
java.sql.SQLException
query(java.lang.String, java.lang.Object[], net.sourceforge.pbeans.data.BeanUnmarshaller)
java.lang.Long insert(java.lang.String tableName, java.lang.String idField, java.lang.String[] fieldNames, java.lang.Object[] values, boolean autoIncrementRequested) throws java.sql.SQLException
tableName
- idField
- Name of ID field.fieldNames
- values
- autoIncrementRequested
- Whether auto-increment is requested for the ID field.
java.sql.SQLException
void requestLock(java.lang.String lockName, int transactionIsolationLevel) throws java.lang.InterruptedException, java.sql.SQLException
relinquishLock
. Nested locks are allowed.
java.lang.InterruptedException
java.sql.SQLException
void relinquishLock(boolean rollback) throws java.sql.SQLException
requestLock
in the current thread.
java.sql.SQLException
void beginTransaction(int transactionIsolationLevel) throws java.sql.SQLException
transactionIsolationLevel
-
java.sql.SQLException
void endTransaction(boolean rollback) throws java.sql.SQLException
java.sql.SQLException
java.sql.Savepoint setSavepoint(java.lang.String savepointName) throws java.sql.SQLException
java.sql.SQLException
void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException
java.sql.SQLException
boolean inTransaction()
boolean isDuplicateEntryError(java.sql.SQLException se)
java.lang.String normalizeName(java.lang.String itemName)
itemName
parameter unchanged.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |