From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 10:33, 18 January 2024 by DiGro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Statements are used to create ResultSets or to update the database. The executeQuery() method creates new ResultSets. The following code snippet shows how the new ResultSet is created. There can be only one ResultSet at a time.

  Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) 
          throw(SQLException, RuntimeException)
      ::osl::MutexGuard aGuard( m_aMutex );
      Reference< XResultSet > xRS = NULL;
      // create a resultset as result of executing the sql statement
      // something needs to be done here :-)
      m_xResultSet = xRS; // we need a reference to it for later use
      return xRS;

The executeUpdate() methods only return the rows that were affected by the given SQL statement. The last method execute returns true when a ResultSet object is returned when calling the method getResultSet(), otherwise it returns false. All other methods have to be implemented.


The PreparedStatement is used when an SQL statement should be executed more than once. In addition to the statement class, it must support the ability to provide information about the parameters when they exist. For this reason, this class must support the interface and also the interface to set values for their parameters.

Result Set

The ResultSet needs to be implemented. For the first step, only forward ResultSets could be implemented, but it is recommended to support all ResultSet methods.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages