Akonadi::Server::PartHelper Namespace Reference


bool insert (Part *part, qint64 *insertId=nullptr)
bool remove (Part *part)
bool remove (const QString &column, const QVariant &value)
QByteArray translateData (const QByteArray &data, Part::Storage storageType)
QByteArray translateData (const Part &part)
bool truncate (Part &part)
void update (Part *part, const QByteArray &data, qint64 dataSize)
bool verify (Part &part)

Detailed Description

Helper methods that store data in a file instead of the database.

Andras Mantia amant[email protected][email protected][email protected]de.or[email protected]g
Use exceptions for error handling in all these methods. Requires that all callers can handle that first though.

Function Documentation

bool Akonadi::Server::PartHelper::insert ( Part *  part,
qint64 *  insertId = nullptr 

Adds a new part to the database and if necessary to the filesystem.

part must not be in the database yet (ie. valid() == false) and must have a data size set.

Definition at line 59 of file parthelper.cpp.

bool Akonadi::Server::PartHelper::remove ( Part *  part)

Deletes part from the database and also removes existing filesystem data if needed.

Definition at line 91 of file parthelper.cpp.

bool Akonadi::Server::PartHelper::remove ( const QString column,
const QVariant value 

Deletes all parts which match the given constraint, including all corresponding filesystem data.

Definition at line 103 of file parthelper.cpp.

QByteArray Akonadi::Server::PartHelper::translateData ( const QByteArray data,
Part::Storage  storageType 

Returns the payload data.

Definition at line 123 of file parthelper.cpp.

QByteArray Akonadi::Server::PartHelper::translateData ( const Part &  part)

Convenience overload of the above.

Definition at line 148 of file parthelper.cpp.

bool Akonadi::Server::PartHelper::truncate ( Part &  part)

Truncate the payload of part and update filesystem/database accordingly.

This is more efficient than using update since it does not require the data to be loaded.

Definition at line 153 of file parthelper.cpp.

void Akonadi::Server::PartHelper::update ( Part *  part,
const QByteArray data,
qint64  dataSize 

Update payload of an existing part part to data and size dataSize.

Automatically decides whether or not the data should be stored in the database or the file system.

PartHelperExceptionif file operations failed

Definition at line 23 of file parthelper.cpp.

bool Akonadi::Server::PartHelper::verify ( Part &  part)

Verifies and if necessary fixes the external reference of this part.

Definition at line 165 of file parthelper.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 23:17:35 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.