[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/arzie_akonadi/server/src/storage
From: Robert Zwerus <arzie () dds ! nl>
Date: 2007-07-31 23:43:52
Message-ID: 1185925432.383643.22672.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 694882 by arzie:
Removed some singlepart-only stuff.
M +6 -17 datastore.cpp
--- branches/work/arzie_akonadi/server/src/storage/datastore.cpp #694881:694882
@@ -27,6 +27,7 @@
#include "selectquerybuilder.h"
#include "handlerhelper.h"
#include "countquerybuilder.h"
+#include "libakonadi/item.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
@@ -720,11 +721,6 @@
return -1;
}
-QString fieldNameForDataType( FetchQuery::Type type )
-{
- return QLatin1String("data");
-}
-
QByteArray Akonadi::DataStore::retrieveDataFromResource( int uid, const QByteArray& \
remote_id,
int locationid, \
FetchQuery::Type type ) {
@@ -790,12 +786,12 @@
if ( !m_dbOpened )
return PimItem();
- const QString field = fieldNameForDataType( type );
+ // retrieve pim item from database
QStringList cols;
cols << PimItem::idColumn() << PimItem::locationIdColumn() << \
PimItem::mimeTypeIdColumn()
<< PimItem::datetimeColumn() << PimItem::remoteIdColumn() << \
PimItem::atimeColumn() << PimItem::dirtyColumn();
- QString statement = QString::fromLatin1( "SELECT %1, %2 FROM %3 WHERE %4 = :id" )
- .arg( cols.join( QLatin1String(",") ), field, PimItem::tableName(), \
PimItem::idColumn() ); + QString statement = QString::fromLatin1( "SELECT %1 FROM %2 \
WHERE %3 = :id" ) + .arg( cols.join( QLatin1String(",") ), PimItem::tableName(), \
PimItem::idColumn() );
QSqlQuery query( m_database );
query.prepare( statement );
@@ -813,18 +809,11 @@
QDateTime dateTime = dateTimeToQDateTime( query.value( 3 ).toByteArray() );
QDateTime atime = dateTimeToQDateTime( query.value( 5 ).toByteArray() );
bool dirty = query.value( 6 ).toBool();
- QByteArray data = query.value( 7 ).toByteArray();
- if ( data.isEmpty() && type != FetchQuery::FastType )
- data = retrieveDataFromResource( id, remote_id, location, type );
- // update access time
+ // build PimItem with retrieved data
PimItem item = PimItem( pimItemId, remote_id, location, mimetype, dateTime, atime, \
dirty );
- Part part = item.parts().first();
- part.setData( data );
- if ( !part.update() )
- qDebug() << "Failed to update item part" << part.id();
-
+ // update access time
item.setAtime( QDateTime::currentDateTime() );
if ( !item.update() )
qDebug() << "Failed to update access time for item" << item.id();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic