Interface XStore

All Superinterfaces:
AutoCloseable, SilentCloseable

public interface XStore extends SilentCloseable
Can be used to access other databases.

Provides a level of abstraction above pure JDBC access.

  • Method Details

    • getId

      String getId()
      Get the unique id.
      Returns:
      the id
    • getDescription

      String getDescription()
      Get the description.
      Returns:
      the description
    • getTimeout

      int getTimeout()
      Get the Query timeout
      Returns:
      the timeout (in seconds)
    • getConnection

      Connection getConnection()
      Get a connection to the external database.

      If such a connection has not been used in the current UserTransaction, a new one is created, else the existing connection is reused.

      Autocommit is off for the connection and the transaction isolation level is set to RECD_COMMITTED.

      Returns:
      the connection
    • commit

      void commit()
      Commit the operations on this XStore. Does not release the connection.
    • rollback

      void rollback()
      Roll back the operations on this XStore. Does not release the connection.
    • close

      void close()
      Commits the connection and releases it.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SilentCloseable
    • getValue

      Object getValue(String query, Object... bindVars)
      Execute a SQL query which returns one value. The query is executed, the first row fetched and from the result set the first element is returned.
      Parameters:
      query - the SQL query text.
      bindVars - if the query contains placeholders for binding variables this parameter should contain the values
      Returns:
      the value as object.
    • getValue

      Object getValue(int sqlType, String query, Object... bindVars)
      Execute a SQL query which returns one value. The query is executed, the first row fetched and from the result set the first element is returned.
      Parameters:
      sqlType - if a special mapping of the database type to java type is needed, the type (java.sql.Types) can be specified here.
      query - the SQL statement text.
      bindVars - if the query contains placeholders for binding variables, this should contain the values
      Returns:
      the value as object.
    • getRow

      DataRow getRow(String query, Object... bindVars)
      Execute a SQL query which returns one row. The query is executed, the first row is fetched returned.
      Parameters:
      query - the SQL statement text.
      bindVars - if the query contains placeholders for binding variables, this should contain the values
      Returns:
      the row
    • getList

      List<DataRow> getList(String query, Object... bindVars)
      Execute a SQL query which returns a list of rows.
      Parameters:
      query - the SQL statement text.
      bindVars - if the query contains placeholders for binding variables, this should contain the values
      Returns:
      the list of rows
    • executeStatement

      int executeStatement(String statement, Object... bindVars)
      Execute a SQL statement.
      Parameters:
      statement - the SQL statement text.
      bindVars - if the statement contains placeholders for binding variables this parameter should contain the values
      Returns:
      the number of rows changed