9#include "commandcontext.h" 
   10#include "storage/countquerybuilder.h" 
   11#include "storage/datastore.h" 
   12#include "storage/itemretriever.h" 
   14#include "private/protocol_p.h" 
   15#include "private/scope_p.h" 
   19class ItemFetchHelperTest;
 
   31    ItemFetchHelper(Connection *connection,
 
   33                    const Protocol::ItemFetchScope &itemFetchScope,
 
   34                    const Protocol::TagFetchScope &tagFagScope,
 
   35                    AkonadiServer &akonadi,
 
   36                    const Protocol::FetchLimit &itemsLimit = Protocol::FetchLimit());
 
   37    ItemFetchHelper(Connection *connection,
 
   38                    const CommandContext &context,
 
   40                    const Protocol::ItemFetchScope &itemFetchScope,
 
   41                    const Protocol::TagFetchScope &tagFetchScope,
 
   42                    AkonadiServer &akonadi,
 
   43                    const Protocol::FetchLimit &itemsLimit = Protocol::FetchLimit());
 
   45    bool fetchItems(std::function<
void(Protocol::FetchItemsResponse &&)> &&callback = {});
 
   47    void disableATimeUpdates();
 
   50    enum ItemQueryColumns {
 
   51        ItemQueryPimItemIdColumn,
 
   52        ItemQueryPimItemRidColumn,
 
   53        ItemQueryMimeTypeIdColumn,
 
   55        ItemQueryRemoteRevisionColumn,
 
   57        ItemQueryDatetimeColumn,
 
   58        ItemQueryCollectionIdColumn,
 
   59        ItemQueryPimItemGidColumn,
 
   63    void updateItemAccessTime();
 
   64    void triggerOnDemandFetch();
 
   65    QueryBuilder buildItemQuery();
 
   66    QueryBuilder buildPartQuery(QSqlQuery &itemQuery, 
const QList<QByteArray> &partList, 
bool allPayload, 
bool allAttrs);
 
   67    QueryBuilder buildFlagQuery(QSqlQuery &itemQuery);
 
   68    QueryBuilder buildTagQuery(QSqlQuery &itemQuery);
 
   69    QueryBuilder buildVRefQuery(QSqlQuery &itemQuery);
 
   71    QList<Protocol::Ancestor> ancestorsForItem(
Collection::Id parentColId);
 
   72    static bool needsAccessTimeUpdate(
const QList<QByteArray> &parts);
 
   73    QVariant extractQueryResult(
const QSqlQuery &query, ItemQueryColumns column) 
const;
 
   74    bool isScopeLocal(
const Scope &scope);
 
   75    DataStore *storageBackend() 
const;
 
   78    Connection *mConnection = 
nullptr;
 
   79    const CommandContext &mContext;
 
   80    QHash<Collection::Id, QList<Protocol::Ancestor>> mAncestorCache;
 
   82    Protocol::ItemFetchScope mItemFetchScope;
 
   83    Protocol::TagFetchScope mTagFetchScope;
 
   84    int mItemQueryColumnMap[ItemQueryColumnCount];
 
   85    bool mUpdateATimeEnabled = 
true;
 
   86    AkonadiServer &mAkonadi;
 
   87    Protocol::FetchLimit mItemsLimit;
 
   88    QString mPimItemQueryAlias;
 
   90    friend class ::ItemFetchHelperTest;
 
qint64 Id
Describes the unique id type.
 
An Connection represents one connection of a client to the server.
 
Helper integration between Akonadi and Qt.