Package ru.bitel.common.sql

# Class ConnectionSet

java.lang.Object
ru.bitel.common.sql.ConnectionSet

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

    public abstract class ConnectionSet
    extends java.lang.Object
    implements ru.bitel.common.worker.Recyclable, ru.bitel.common.worker.Commitable, java.lang.AutoCloseable

Класс с коннекшнами к базе. Держать их по отдельности не всегда удобно.

- ## Field Summary

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

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `ConnectionSet​(java.sql.Connection master, boolean autoCommit)` |

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `void` | `close()` |
  `void` | `commit()` |
  `protected void` | `finalize()` |
  `boolean` | `getAutoCommit()` |
  `java.sql.Connection` | `getConnection()` |
  `java.sql.Connection` | `getSlaveConnection()` |
  `java.sql.Connection` | `getTrashConnection​(java.lang.String tableName, int defaultType)` |
  `static ConnectionSet` | `newInstance​(DefaultServerSetup setup, boolean autoCommit)` |
  `static ConnectionSet` | `newInstance​(DefaultServerSetup setup, java.sql.Connection con, boolean autoCommit)` |
  `protected abstract java.sql.Connection` | `newMasterConnection()` |
  `protected abstract java.sql.Connection` | `newSlaveConnection()` |
  `protected abstract java.sql.Connection` | `newTrashConnection​(java.lang.String tableName)` |
  `void` | `recycle()` |
  `void` | `rollback()` |
  `void` | `setAutoCommit​(boolean autoCommit)` |

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

  `clone, equals, 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​(java.sql.Connection master, boolean autoCommit)

- ## Method Details

  - ### getConnection

    public java.sql.Connection getConnection()

  - ### newMasterConnection

    protected abstract java.sql.Connection newMasterConnection()

  - ### newSlaveConnection

    protected abstract java.sql.Connection newSlaveConnection()

  - ### newTrashConnection

    protected abstract java.sql.Connection newTrashConnection​(java.lang.String tableName)

  - ### getSlaveConnection

    public java.sql.Connection getSlaveConnection()

  - ### getTrashConnection

    public java.sql.Connection getTrashConnection​(java.lang.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`

  - ### recycle

    public void recycle()
    Specified by:
      `recycle` in interface `ru.bitel.common.worker.Recyclable`

  - ### getAutoCommit

    public boolean getAutoCommit()

  - ### setAutoCommit

    public void setAutoCommit​(boolean autoCommit)

  - ### rollback

    public void rollback()

  - ### finalize

    protected void finalize() throws java.lang.Throwable
    Overrides:
      `finalize` in class `java.lang.Object`
    Throws:
      `java.lang.Throwable`

  - ### newInstance

    public static final ConnectionSet newInstance​(DefaultServerSetup setup, boolean autoCommit)

  - ### newInstance

    public static final ConnectionSet newInstance​(DefaultServerSetup setup, java.sql.Connection con, boolean autoCommit)

  - ### close

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