Interface SRConnection

All Superinterfaces:
AutoCloseable, Connection, Wrapper

public interface SRConnection extends Connection
  • Method Details

    • getParentDatasource

      Datasource getParentDatasource()
      Returns:
      the Datasource that created this connection. Note that this might not be the Datasource on which getConnection() was called in the case of a failover scenario.
    • runQuery

      Dataset runQuery(String query) throws SQLException
      Executes the given SELECT query, returning a Dataset of results.
      Returns:
      the results of the query in Dataset form
      Throws:
      SQLException
    • runLimitQuery

      Dataset runLimitQuery(String query, int limit) throws SQLException
      Executes the given SELECT query, applying a limit as defined by the translator.
      Throws:
      SQLException
    • runPrepLimitQuery

      Dataset runPrepLimitQuery(String query, int limit, Object... args) throws SQLException
      Executes the given SELECT query, applying a limit as defined by the translator.
      Throws:
      SQLException
    • runPrepQuery

      Dataset runPrepQuery(String query, Object... args) throws SQLException
      Executes a SELECT query using a prepared statements, assigning the arguments in order.
      Returns:
      the results of the query in Dataset form
      Throws:
      SQLException
    • runUpdateQuery

      int runUpdateQuery(String query) throws SQLException
      Executes a non-SELECT query.
      Returns:
      the number of rows modified
      Throws:
      SQLException
    • runPrepUpdate

      int runPrepUpdate(String query, Object... args) throws SQLException
      Executes a non-SELECT query using a prepared statement, assigning the arguments in order.
      Returns:
      the number of rows modified
      Throws:
      SQLException
    • runScalarQuery

      Object runScalarQuery(String query) throws SQLException
      Executes the query and returns the first return value.
      Throws:
      SQLException
    • runScalarPrepQuery

      Object runScalarPrepQuery(String query, Object... args) throws SQLException
      Executes the query and returns the first return value.
      Throws:
      SQLException
    • runPrepInsertGetKey

      long runPrepInsertGetKey(String query, String tableName, String keyCol, Object... args) throws SQLException
      Runs the given insert query, returning the generated key. Requires the table name and index column because some database require them in order to get the key.
      Throws:
      SQLException
    • getCurrentDatabaseTime

      Timestamp getCurrentDatabaseTime() throws SQLException
      Selects the current timestamp from the database and returns it as a java date.
      Throws:
      SQLException
    • prepareStatmentForGeneratedKeys

      PreparedStatement prepareStatmentForGeneratedKeys(String sql) throws SQLException
      Prepares statement for returning generated keys in a way that's safe for all database drivers.
      Throws:
      SQLException
    • fetchGeneratedKey

      long fetchGeneratedKey(PreparedStatement stmt, String table, String column) throws SQLException
      The counterpart to prepareStatmentForGeneratedKeys, returns the generated key in a way that's safe for all drivers.
      Throws:
      SQLException