BufferInfo PostgreSqlStorage::getBufferInfo(UserId user, const BufferId &bufferId)
{
    QSqlQuery query(logDb());
    query.prepare(queryString("select_buffer_by_id"));
    query.bindValue(":userid", user.toInt());
    query.bindValue(":bufferid", bufferId.toInt());
    safeExec(query);
    if (!watchQuery(query))
        return BufferInfo();

    if (!query.first())
        return BufferInfo();

    BufferInfo bufferInfo(query.value(0).toInt(), query.value(1).toInt(), (BufferInfo::Type)query.value(2).toInt(), 0, query.value(4).toString());
    Q_ASSERT(!query.next());

    return bufferInfo;
}
BufferInfo PostgreSqlStorage::getBufferInfo(UserId user, const BufferId &bufferId)
{
    QSqlQuery query(logDb());
    query.prepare(queryString("select_buffer_by_id"));
    query.bindValue(":userid", user.toInt());
    query.bindValue(":bufferid", bufferId.toInt());
    safeExec(query);
    if (!watchQuery(query))
        return BufferInfo();

    if (!query.first())
        return BufferInfo();

    BufferInfo bufferInfo(query.value(0).toInt(), query.value(1).toInt(), (BufferInfo::Type)query.value(2).toInt(), 0, query.value(4).toString());
    Q_ASSERT(!query.next());

    return bufferInfo;
}