Package ru.bgcrm.util.sql

# Class SingleConnectionSet

java.lang.Object
ru.bgcrm.util.sql.ConnectionSet
ru.bgcrm.util.sql.SingleConnectionSet

All Implemented Interfaces:
  `AutoCloseable`

public class SingleConnectionSet extends ConnectionSet
Implementation of `ConnectionSet` returning always the same master connection. Eliminates advantages of real connection set, can be used as quick adapter.

- ## Field Summary

  ### Fields inherited from class ru.bgcrm.util.sql.ConnectionSet

  `KEY, TYPE_FAKE, TYPE_MASTER, TYPE_SLAVE, TYPE_TRASH`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SingleConnectionSet(Connection master)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Connection`
  `getSlaveConnection()`
  Gets slave connection to read-only DB replica.
  `Connection`
  `getTrashConnection(String tableName, int defaultType)`
  Gets connection to so-called 'trash' DB, containing non-critical data.

  ### Methods inherited from class ru.bgcrm.util.sql.ConnectionSet

  `close, commit, getConnection, recycle, rollback`

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

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

- ## Constructor Details

  - ### SingleConnectionSet

    public SingleConnectionSet(Connection master)

- ## Method Details

  - ### getSlaveConnection

    public Connection getSlaveConnection()
    Description copied from class: `ConnectionSet`
    Gets slave connection to read-only DB replica.
    Overrides:
      `getSlaveConnection` in class `ConnectionSet`
    Returns:

  - ### getTrashConnection

    public Connection getTrashConnection(String tableName, int defaultType)
    Description copied from class: `ConnectionSet`
    Gets connection to so-called 'trash' DB, containing non-critical data.
    Overrides:
      `getTrashConnection` in class `ConnectionSet`
    Parameters:
      `tableName` - table name.
      `defaultType` - DB type returned if no trash DB is configured, can be:

           ConnectionSet.TYPE_SLAVE - slave DB connection;
           ConnectionSet.TYPE_FAKE -  instance of FakeConnection, does not do anything;
           ConnectionSet.TYPE_MASTER - master DB connection.

    Returns: