ch.qos.logback.core.db

## Class DBAppenderBase<E>

- java.lang.Object
- - ch.qos.logback.core.spi.ContextAwareBase
  - - ch.qos.logback.core.UnsynchronizedAppenderBase<E>
    - - ch.qos.logback.core.db.DBAppenderBase<E>

All Implemented Interfaces:
  Appender<E>, ContextAware, FilterAttachable<E>, LifeCycle

Direct Known Subclasses:
  DBAppender, DBAppender

    public abstract class DBAppenderBase<E>
    extends UnsynchronizedAppenderBase<E>

Author:
  Ceki Gülcü, Ray DeCampo, Sébastien Pennec

### Field Summary

Fields
`protected boolean` `cnxSupportsBatchUpdates`
`protected boolean` `cnxSupportsGetGeneratedKeys`
`protected ConnectionSource` `connectionSource`
`protected SQLDialect` `sqlDialect`

### Fields inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase

`name, started`

### Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase

`context`

### Constructor Summary

Constructors
Constructor and Description
`DBAppenderBase()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`void` `append(E eventObject)`
`ConnectionSource` `getConnectionSource()`
`protected abstract Method` `getGeneratedKeysMethod()`
`protected abstract String` `getInsertSQL()`
`protected abstract void` `secondarySubAppend(E eventObject, Connection connection, long eventId)`
`protected long` `selectEventId(PreparedStatement insertStatement, Connection connection)`
`void` `setConnectionSource(ConnectionSource connectionSource)`
`void` `start()`
`void` `stop()`
`protected abstract void` `subAppend(E eventObject, Connection connection, PreparedStatement statement)`

### Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase

`addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString`

### Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase

`addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext`

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

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

### Methods inherited from interface ch.qos.logback.core.spi.ContextAware

`addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext`

### Field Detail

#### connectionSource

    protected ConnectionSource connectionSource

#### cnxSupportsGetGeneratedKeys

    protected boolean cnxSupportsGetGeneratedKeys

#### cnxSupportsBatchUpdates

    protected boolean cnxSupportsBatchUpdates

#### sqlDialect

    protected SQLDialect sqlDialect

### Constructor Detail

#### DBAppenderBase

    public DBAppenderBase()

### Method Detail

#### getGeneratedKeysMethod

    protected abstract Method getGeneratedKeysMethod()

#### getInsertSQL

    protected abstract String getInsertSQL()

#### start

    public void start()

Specified by:
  `start` in interface `LifeCycle`
Overrides:
  `start` in class `UnsynchronizedAppenderBase<E>`

#### getConnectionSource

    public ConnectionSource getConnectionSource()

Returns:
  Returns the connectionSource.

#### setConnectionSource

    public void setConnectionSource(ConnectionSource connectionSource)

Parameters:
  `connectionSource` - The connectionSource to set.

#### append

    public void append(E eventObject)

Specified by:
  `append` in class `UnsynchronizedAppenderBase<E>`

#### subAppend

    protected abstract void subAppend(E eventObject,
                                      Connection connection,
                                      PreparedStatement statement)
                               throws Throwable

Throws:
  `Throwable`

#### secondarySubAppend

    protected abstract void secondarySubAppend(E eventObject,
                                               Connection connection,
                                               long eventId)
                                        throws Throwable

Throws:
  `Throwable`

#### selectEventId

    protected long selectEventId(PreparedStatement insertStatement,
                                 Connection connection)
                          throws SQLException,
                                 InvocationTargetException

Throws:
  `SQLException`
  `InvocationTargetException`

#### stop

    public void stop()

Specified by:
  `stop` in interface `LifeCycle`
Overrides:
  `stop` in class `UnsynchronizedAppenderBase<E>`