try { AbstractIscTrHandle tr = stmt.getTransaction(); if (tr != null) tr.unregisterStatementFromTransaction(stmt); } finally { stmt.unregisterTransaction(); }
    public void iscDsqlFreeStatement(IscStmtHandle stmt_handle, int option)            throws GDSException {        isc_stmt_handle_impl stmt = (isc_stmt_handle_impl) stmt_handle;        isc_db_handle_impl db = stmt.getRsr_rdb();        synchronized (db) {            if (stmt_handle == null) { throw new GDSException(                    ISCConstants.isc_bad_req_handle); }            // Does not seem to be possible or necessary to close            // an execute procedure statement.            if (stmt.isSingletonResult() && option == ISCConstants.DSQL_close) { return; }            if (option == ISCConstants.DSQL_drop) {                stmt.setInSqlda(null);                stmt.setOutSqlda(null);                stmt.setRsr_rdb(null);            }            native_isc_dsql_free_statement(stmt_handle, option);        }    }