ch.qos.logback.classic.db.names.TableName Java Examples

The following examples show how to use ch.qos.logback.classic.db.names.TableName. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DBLogReader.java    From background-geolocation-android with Apache License 2.0 5 votes vote down vote up
public String buildStackTraceQuery(int eventId) {
    SqlSelectStatement builder = new SqlSelectStatement();
    builder.column(mDbNameResolver.getColumnName(ColumnName.TRACE_LINE));
    builder.from(mDbNameResolver.getTableName(TableName.LOGGING_EVENT_EXCEPTION));
    builder.where(mDbNameResolver.getColumnName(ColumnName.I), SqlExpression.SqlOperatorEqualTo, Integer.valueOf(eventId));
    builder.orderBy(mDbNameResolver.getColumnName(ColumnName.I));

    return builder.statement();
}
 
Example #2
Source File: DBLogReader.java    From background-geolocation-android with Apache License 2.0 5 votes vote down vote up
public String buildQuery(int limit, int fromLogEntryId, Level minLevel) {
    SqlSelectStatement builder = new SqlSelectStatement();
    builder.columns(new String[]{
            mDbNameResolver.getColumnName(ColumnName.EVENT_ID),
            mDbNameResolver.getColumnName(ColumnName.TIMESTMP),
            mDbNameResolver.getColumnName(ColumnName.FORMATTED_MESSAGE),
            mDbNameResolver.getColumnName(ColumnName.LOGGER_NAME),
            mDbNameResolver.getColumnName(ColumnName.LEVEL_STRING),
    });
    builder.from(mDbNameResolver.getTableName(TableName.LOGGING_EVENT));
    builder.where(mDbNameResolver.getColumnName(ColumnName.LEVEL_STRING), SqlExpression.SqlOperatorIn, aboveLevel(minLevel));
    if (fromLogEntryId > 0) {
        if (limit >= 0) {
            builder.where(mDbNameResolver.getColumnName(ColumnName.EVENT_ID), SqlExpression.SqlOperatorLessThan, fromLogEntryId);
        } else {
            builder.where(mDbNameResolver.getColumnName(ColumnName.EVENT_ID), SqlExpression.SqlOperatorGreaterThan, fromLogEntryId);
        }
    }
    if (limit < 0) {
        builder.orderBy(mDbNameResolver.getColumnName(ColumnName.TIMESTMP));
        builder.orderBy(mDbNameResolver.getColumnName(ColumnName.EVENT_ID));
    } else {
        builder.orderBy(mDbNameResolver.getColumnName(ColumnName.TIMESTMP), true);
        builder.orderBy(mDbNameResolver.getColumnName(ColumnName.EVENT_ID), true);
    }
    builder.limit(limit);

    return builder.statement();
}
 
Example #3
Source File: JDBCSettingsDBNameResolverTest.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
@Test
public void getTableName()
{
    assertEquals((TABLE_PREFIX + TableName.LOGGING_EVENT.name()).toLowerCase(),
                 _dbNameResolver.getTableName(TableName.LOGGING_EVENT));
}