public interface DatabaseResource extends Resource
DatabaseResource
interface represents a Database Resource which provides the ability to execute SQL statements.
Each resource can operate in one of two modes: table mode or non-table mode.
In table mode, methods on this interface are not used. Instead, the Database Resource is configured as the
backing resource for a Table
. SQL statements are issued as a
result of fetchTable()
methods issued against the table.
and
updateTable()
In non-table mode, SQL statements are executed as a result of method calls to this interface. In general, these methods are intended to retrieve, update, insert or delete a single database row.
fetch()
update()
insert()
delete()
Modifier and Type | Method and Description |
---|---|
int |
delete()
Builds and executes a delete SQL statement.
|
int |
fetch()
Builds and executes a select SQL statement and sets the value of mapped form fields with column
values retrieved from the database.
|
int |
insert()
Builds and executes an insert SQL statement and inserts a table row with values obtained from mapped form fields.
|
int |
update()
Builds and executes an update SQL statement and updates the database with values obtained from mapped form fields.
|
getElementName, getElementType
int fetch() throws com.ebasetech.xi.exceptions.FormRuntimeException
Table.fetchTable()
method.
If any of the resource fields in the Database Resource is marked as required but has no value, a FormRuntimeException is thrown.
com.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during execution, including a SQL errorTable.fetchTable()
int update() throws com.ebasetech.xi.exceptions.FormRuntimeException, com.ebasetech.xi.exceptions.OptimisticLockingException
Table.updateTable()
method.
If any of the resource fields in the Database Resource is marked as required but has no value, a FormRuntimeException is thrown.
If the Optimistic Locking option has been activated in the form's properties, the system will check that the database record to be updated has not been altered by an external system since it was originally fetched. If this check fails, an OptimisticLockingException exception is thrown.
com.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during execution, including a SQL errorcom.ebasetech.xi.exceptions.OptimisticLockingException
- if the database record to be updated has been altered by an external system since
it was originally fetchedTable.updateTable()
int delete() throws com.ebasetech.xi.exceptions.FormRuntimeException
Table.updateTable()
method.
If any of the resource fields in the Database Resource is marked as required but has no value, a FormRuntimeException is thrown.
com.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during execution, including a SQL errorTable.updateTable()
int insert() throws com.ebasetech.xi.exceptions.FormRuntimeException
Table.updateTable()
method.
com.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during execution, including a SQL errorTable.updateTable()