Package ru.bitel.common.sql

# Class ConnectionSet

java.lang.Object
ru.bitel.bgbilling.kernel.base.server.logger.BGLogger
ru.bitel.common.sql.ConnectionSet

All Implemented Interfaces:
  `AutoCloseable`, `ru.bitel.common.worker.Commitable`

public abstract class ConnectionSet extends ru.bitel.bgbilling.kernel.base.server.logger.BGLogger implements ru.bitel.common.worker.Commitable, AutoCloseable
Класс с коннекшнами к базе. Держать их по отдельности не всегда удобно.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected boolean`
  `autoCommit`
  `static final int`
  `TYPE_FAKE`
  `static final int`
  `TYPE_MASTER`
  `static final int`
  `TYPE_SLAVE`
  `static final int`
  `TYPE_TRASH`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ConnectionSet(Connection master, boolean autoCommit)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `void`
  `commit()`
  `boolean`
  `getAutoCommit()`
  `Connection`
  `getConnection()`
  `Connection`
  `getSlaveConnection()`
  `Connection`
  `getTrashConnection(String tableName, int defaultType)`
  `static final ConnectionSet`
  `newInstance(DefaultServerSetup setup, boolean autoCommit)`
  возвращает реализацию ConnectionSet (SetupConnectionSet), которая дёргает коннекшены FromPool из сетапа.
  `static final ConnectionSet`
  `newInstance(DefaultServerSetup setup, Connection con, boolean autoCommit)`
  возвращает реализацию ConnectionSet (SetupConnectionSet), которая дёргает коннекшены FromPool из сетапа.
  `protected abstract Connection`
  `newMasterConnection()`
  `protected abstract Connection`
  `newSlaveConnection()`
  `protected abstract Connection`
  `newTrashConnection(String tableName)`
  `void`
  `rollback()`
  `void`
  `setAutoCommit(boolean autoCommit)`

  ### Methods inherited from class ru.bitel.bgbilling.kernel.base.server.logger.BGLogger

  `error, error, error, getLogger, logError, logError, warn`

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

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

- ## Field Details

  - ### TYPE_MASTER

    public static final int TYPE_MASTER
    See Also:
      - Constant Field Values

  - ### TYPE_SLAVE

    public static final int TYPE_SLAVE
    See Also:
      - Constant Field Values

  - ### TYPE_TRASH

    public static final int TYPE_TRASH
    See Also:
      - Constant Field Values

  - ### TYPE_FAKE

    public static final int TYPE_FAKE
    See Also:
      - Constant Field Values

  - ### autoCommit

    protected boolean autoCommit

- ## Constructor Details

  - ### ConnectionSet

    public ConnectionSet(Connection master, boolean autoCommit)

- ## Method Details

  - ### getConnection

    public Connection getConnection()

  - ### newMasterConnection

    protected abstract Connection newMasterConnection()

  - ### newSlaveConnection

    protected abstract Connection newSlaveConnection()

  - ### newTrashConnection

    protected abstract Connection newTrashConnection(String tableName)

  - ### getSlaveConnection

    public Connection getSlaveConnection()

  - ### getTrashConnection

    public Connection getTrashConnection(String tableName, int defaultType)

  - ### commit

    public void commit() throws ru.bitel.bgbilling.common.BGException
    Specified by:
      `commit` in interface `ru.bitel.common.worker.Commitable`
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`

  - ### getAutoCommit

    public boolean getAutoCommit()

  - ### setAutoCommit

    public void setAutoCommit(boolean autoCommit)

  - ### rollback

    public void rollback()

  - ### newInstance

    public static final ConnectionSet newInstance(DefaultServerSetup setup, boolean autoCommit)
    возвращает реализацию ConnectionSet (SetupConnectionSet), которая дёргает коннекшены FromPool из сетапа.

  - ### newInstance

    public static final ConnectionSet newInstance(DefaultServerSetup setup, Connection con, boolean autoCommit)
    возвращает реализацию ConnectionSet (SetupConnectionSet), которая дёргает коннекшены FromPool из сетапа.