Пример #1
0
QString LogFilter::queryString() const
{
    if (isEmpty()) {
        return QString();
    }

    QString query;
    query.append(createDateString());

    if (!query.isEmpty() && !m_sources.isEmpty()) {
        query.append("AND ");
    }
    query.append(createSourcesString());

    if (!query.isEmpty() && !m_levels.isEmpty()) {
        query.append("AND ");
    }
    query.append(createLevelsString());

    if (!query.isEmpty() && !m_eventTypes.isEmpty()) {
        query.append("AND ");
    }
    query.append(createEventTypesString());

    if (!query.isEmpty() && !m_typeIds.isEmpty()) {
        query.append("AND ");
    }
    query.append(createTypeIdsString());

    if (!query.isEmpty() && !m_deviceIds.isEmpty()) {
        query.append("AND ");
    }
    query.append(createDeviceIdString());

    if (!query.isEmpty() && !m_values.isEmpty()) {
        query.append("AND ");
    }
    query.append(createValuesString());

    return query;
}
Пример #2
0
/*! Returns the database query string for this \l{LogFilter}.*/
QString LogFilter::queryString() const
{
    if (isEmpty()) {
        return QString();
    }

    QString query;
    query.append(createDateString());

    if (!query.isEmpty() && !loggingSources().isEmpty()) {
        query.append("AND ");
    }
    query.append(createSourcesString());

    if (!query.isEmpty() && !loggingLevels().isEmpty()) {
        query.append("AND ");
    }
    query.append(createLevelsString());

    if (!query.isEmpty() && !loggingEventTypes().isEmpty()) {
        query.append("AND ");
    }
    query.append(createEventTypesString());

    if (!query.isEmpty() && !typeIds().isEmpty()) {
        query.append("AND ");
    }
    query.append(createTypeIdsString());

    if (!query.isEmpty() && !deviceIds().isEmpty()) {
        query.append("AND ");
    }
    query.append(createDeviceIdString());

    if (!query.isEmpty() && !values().isEmpty()) {
        query.append("AND ");
    }
    query.append(createValuesString());

    return query;
}