org.qi4j.library.sql.common

## Class Databases

- java.lang.Object
- - org.qi4j.library.sql.common.Databases

-     public class Databases
      extends Object

  Utility methods for performing SQL calls wrapping a given DataSource.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `Databases.ResultSetVisitor` Visitor for the ResultSet.
    `static interface` | `Databases.StatementVisitor` Visitor for PreparedStatements.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Databases(DataSource source)` Create a new Databases wrapper for a given DataSource.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Input<ResultSet,SQLException>` | `query(String sql)` Perform SQL query and provide results as an Input.
    `void` | `query(String sql, Databases.ResultSetVisitor visitor)` Perform SQL query and let visitor handle results.
    `Input<ResultSet,SQLException>` | `query(String sql, Databases.StatementVisitor visitor)` Perform SQL query and provide results as an Input.
    `void` | `query(String sql, Databases.StatementVisitor statement, Databases.ResultSetVisitor resultsetVisitor)` Perform SQL query and let visitor handle results.
    `int` | `update(String sql)` Perform SQL update statement.
    `int` | `update(String sql, Databases.StatementVisitor visitor)` Perform SQL update statement.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Databases

          public Databases(DataSource source)

      Create a new Databases wrapper for a given DataSource.

  - ### Method Detail

    - #### update

          public int update(String sql)
                     throws SQLException

      Perform SQL update statement.
      Throws:
        `SQLException`

    - #### update

          public int update(String sql,
                   Databases.StatementVisitor visitor)
                     throws SQLException

      Perform SQL update statement. If the SQL string contains ? placeholders, use the StatementVisitor to update the PreparedStatement with actual values.
      Throws:
        `SQLException`

    - #### query

          public void query(String sql,
                   Databases.ResultSetVisitor visitor)
                     throws SQLException

      Perform SQL query and let visitor handle results.
      Throws:
        `SQLException`

    - #### query

          public void query(String sql,
                   Databases.StatementVisitor statement,
                   Databases.ResultSetVisitor resultsetVisitor)
                     throws SQLException

      Perform SQL query and let visitor handle results. If the SQL string contains ? placeholders, use the StatementVisitor to update the PreparedStatement with actual values.
      Throws:
        `SQLException`

    - #### query

          public Input<ResultSet,SQLException> query(String sql)

      Perform SQL query and provide results as an Input. This makes it possible to combine SQL data with the I/O API.

    - #### query

          public Input<ResultSet,SQLException> query(String sql,
                                            Databases.StatementVisitor visitor)

      Perform SQL query and provide results as an Input. This makes it possible to combine SQL data with the I/O API. If the SQL string contains ? placeholders, use the StatementVisitor to update the PreparedStatement with actual values.