- TIBCO BusinessEvents®
- RDBMS
- Database

# Database

## Description

Database access functions

## Categories

Name | Description
--- | ---
`Util` | Database Utility functions
`sp` | Database stored procedure support access functions

## Functions

Name | Signature and Synopsis
--- | ---
`assertDBInstance` | `void assertDBInstance(Concept instance, boolean deep)` Asserts a DB Concept instance into working memory. If deep is set to true then asserts all contained/referenced DB concept instances
`beginTransaction` | `void beginTransaction()` Begins a transaction on the current connection.
`closeQuery` | `void closeQuery(String cursorName)` Closes the cursor for the query
`commit` | `void commit()` Commits the current transaction.
`createQuery` | `String createQuery(String jdbcURI, String cursorName, String resultConceptURI, String sql, int pageSize, Object requestObj)` Opens a database cursor for the given sql query. Once the cursor is open, a user can page on the resultset of the query
`delete` | `int delete(Concept instance, boolean cascade)` Deletes rows from the database based on primary key values of the passed instance. If cascade is set to true, deletes all rows corresponding to its contained concept and concept reference properties. Further, for concept reference properties, updates other tables by setting their foreign key references to null for those rows that match primary keys of the rows being deleted
`executePreparedStmt` | `int executePreparedStmt(String preparedStmt, Object[] args)` Executes a PreparedStatement. A prepared statement is a SQL statement where values are determined at runtime. The values to be used are passed as an array of objects.
`executePreparedStmtByParamList` | `int executePreparedStmtByParamList(String preparedStmt, List parameterList)` Executes a PreparedStatement. A prepared statement is a SQL statement where values are determined at runtime. The values to be used are passed as a List of parameters.
`executeSQL` | `int executeSQL(String sql)` Executes an SQL statement. To be used for inserts/updates and deletes.
`getConnectionStatus` | `int getConnectionStatus(String jdbcResourceURI)` Returns the status of connections for the given JDBC URI If underlying connections are good, returns 1, else returns 0
`getNextPage` | `Object[] getNextPage(String cursorName, int pageSize)` Gets the next page from the database cursor
`getNextPageFromOffset` | `getNextPageFromOffset(String cursorName, int startOffset, int pageSize)` Gets the next page from the database cursor, starting from the given offset
`getPreviousPage` | `Object[] getPreviousPage(String cursorName, int pageSize)` Gets the previous page from the database cursor. The fetch direction is always forward. So if the cursor is on 11th record calling this method will return 1 to 10 records in th forward direction and not 10 to 1.
`getPreviousPageFromOffset` | `getPreviousPageFromOffset(String cursorName, int startOffset, int pageSize)` Gets the previous page from the database cursor, starting from the given offset
`insert` | `Concept insert(Concept instance)` Inserts a record corresponding to the passed DB concept, into the database. If the passed instance contains concept references, then all such instances are inserted recursively. Primary keys are either generated using sequences (based on sequences.xml in the project) or have to be specified in the instance.
`queryUsingConceptProps` | `Concept[] queryUsingConceptProps(Concept qConcept, boolean queryChildren)` Queries database using the values in a concept instance.
`queryUsingPreparedStmt` | `Concept[] queryUsingPreparedStmt(String conceptURI, String preparedStmt, Object[] args, boolean queryChildren)` Queries the database using the supplied prepared statement.
`queryUsingPreparedStmtByParamList` | `Concept[] queryUsingPreparedStmtByParamList(String conceptURI, String preparedStmt, List parameterList, boolean queryChildren)` Queries the database using the supplied prepared statement.
`queryUsingPrimaryKeys` | `Concept[] queryUsingPrimaryKeys(String conceptURI, SimpleEvent pKeyEvent, boolean queryChildren)` Queries the database using primary key values provided in an Event.
`queryUsingSQL` | `Concept[] queryUsingSQL(String conceptURI, String sql, boolean queryChildren)` Queries underlying database using the supplied SQL.
`rollback` | `void rollback()` Rolls back current transaction.
`setCurrentConnection` | `void setCurrentConnection(String jdbcResourceURI)` Sets the connection to use for database operations.
`unsetConnection` | `void unsetConnection()` Releases the current connection back to the connection pool. To be called each time after performing database operations.
`update` | `int update(Concept instance)` Updates the database using values in the passed concept