The DB2eStatement class gets and sets certain Statement attributes. To use the DB2eStatement class methods on a Statement object, the Statement object must first be cast to a DB2eStatement object. These methods are implemented by calls to the CLI/ODBC functions SQLGetStmtAttr and SQLSetStmtAttr with the appropriate arguments.
com.ibm.db2e.jdbc package
public class DB2eStatement
implements Statement
ǥ 108 lists the methods in the DB2eStatement
class supported by DB2 Everyplace.
ǥ 108. DB2eStatement class methods
Method return type | Method |
---|---|
void | enableDeletePhysicalRemove(boolean enable) Enables or disables physically removing records, regardless of their dirty bit values, in a DELETE SQL statement. |
void | enableDirtyBitSetByApplication(boolean enable) Enables the application mode if enable is true. Otherwise, enables the system mode. |
void | enableReadIncludeMarkedDelete (boolean enable) Makes logically deleted records visible or invisible. |
void | enableReorg (boolean enable) Enables or disables database reorganization by DB2 Everyplace or explicitly by the user with a REORG SQL statement. |
boolean | isEnabledDeletePhysicalRemove() Will a delete SQL statement physically remove the records regardless of their dirty bit values? Or will the records only be marked as "delete"? |
boolean | isEnabledDirtyBitSetByApplication() Is the database system in the application mode? Or is it in the system mode? |
boolean | isEnabledReadIncludeMarkedDelete() Are logically deleted records visible from SQL statements? Or are these records hidden from SQL? |
boolean | isEnabledReorg() Can database reorganization be done by DB2 Everyplace or explicitly by the user with a REORG SQL statement? Or are REORG SQL statements restricted and is the automatic database reorganization of user-created tables disabled? |
In these examples, st represents a Statement object, and rs represents a ResultSet object.
To physically remove some records from table T ignoring the status of the dirty bits:
DB2eStatement db2e_st = (DB2eStatement) st; db2e_st.enableDeletePhysicalRemove(true); st.executeUpdate("DELETE FROM T WHERE X<>0");
To read all records in table T with the dirty bit set, including those with dirty bit marked as DELETE:
DB2eStatement db2e_st = (DB2eStatement) st; db2e_st.enableReadIncludeMarkedDelete(true); rs = st.executeQuery("SELECT * FROM T WHERE $dirty<>0");
To clean the dirty bit of a record in table T:
DB2eStatement db2e_st = (DB2eStatement) st; db2e_st.enableDirtyBitSetByApplication(true); st.executeUpdate("UPDATE T SET $dirty=0 WHERE $dirty>0");
Related tasks
Related reference