mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbhandler.cpp
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbhandler.cpp Tue Feb 02 00:09:33 2010 +0200
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbhandler.cpp Fri Feb 19 22:48:30 2010 +0200
@@ -1356,6 +1356,9 @@
}
}
+#ifdef __RAMDISK_PERF_ENABLE
+ iDbManager->CopyDBsToRamL();
+#endif //__RAMDISK_PERF_ENABLE
iDbMusic->RefreshStartL();
BeginTransactionL();
@@ -1386,6 +1389,10 @@
{
iSynchronizeBasicTable = EFalse;
}
+
+#ifdef __RAMDISK_PERF_ENABLE
+ iDbManager->CopyDBsFromRamL();
+#endif //__RAMDISK_PERF_ENABLE
}
// ----------------------------------------------------------------------------
@@ -1394,9 +1401,20 @@
//
void CMPXDbHandler::MtpStartL()
{
+ MPX_DEBUG1("-->CMPXDbHandler::MtpStartL");
iMtpInUse = ETrue;
iOpOnDbCount = 0;
+
+#ifdef __RAMDISK_PERF_ENABLE
+ TRAPD(err, iDbManager->CopyDBsToRamL(iMtpInUse));
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2("CMPXDbHandler::MtpStartL error=%d", err);
+ }
+#endif //__RAMDISK_PERF_ENABLE
+
iDbManager->BeginL();
+ MPX_DEBUG1("<--CMPXDbHandler::MtpStartL");
}
// ----------------------------------------------------------------------------
@@ -1405,9 +1423,20 @@
//
void CMPXDbHandler::MtpEndL()
{
+ MPX_DEBUG1("-->CMPXDbHandler::MtpEndL");
iMtpInUse = EFalse;
iOpOnDbCount = 0;
iDbManager->CommitL();
+
+#ifdef __RAMDISK_PERF_ENABLE
+ TRAPD(err, iDbManager->CopyDBsFromRamL());
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2("CMPXDbHandler::MtpEndL error=%d", err);
+ }
+#endif //__RAMDISK_PERF_ENABLE
+
+ MPX_DEBUG1("<--CMPXDbHandler::MtpEndL");
}
// ----------------------------------------------------------------------------
@@ -1489,6 +1518,16 @@
{
MPX_FUNC("CMPXDbHandler::BeginTransactionL");
+#ifdef __RAMDISK_PERF_ENABLE
+ // EnsureRamSpaceL will copy dbs from ram if ram space is low or dbs exceeded
+ // max space.
+ TRAPD(err, iDbManager->EnsureRamSpaceL());
+ if (err)
+ {
+ //error but continue
+ }
+#endif //__RAMDISK_PERF_ENABLE
+
if(!iMtpInUse)
{
iDbManager->BeginL();
@@ -2938,6 +2977,37 @@
{
return GetPlaylistDurationL(aPlaylistId);
}
+void CMPXDbHandler::HandlePlaylistInfoL(
+ TUint32 aPlaylistId,
+ TInt& aCount,
+ TInt& aDuration)
+ {
+ MPX_FUNC("CMPXDbHandler::HandlePlaylistInfoL");
+ MPX_DEBUG2("CMPXDbHandler::HandlePlaylistInfoL(0x%x)", aPlaylistId);
+
+ RArray<TMPXAttribute> attributes;
+ CleanupClosePushL(attributes);
+ attributes.AppendL(KMPXMediaGeneralId);
+ attributes.AppendL(TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralDuration));
+
+ CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
+ CleanupStack::PushL(mediaArray);
+
+ GetPlaylistSongsL(aPlaylistId, attributes.Array(), *mediaArray);
+
+ aCount = mediaArray->Count();
+ for (TInt index = 0; index < aCount; ++index)
+ {
+ CMPXMedia* media((*mediaArray)[index]);
+ if (media->IsSupported(KMPXMediaGeneralDuration))
+ {
+ aDuration += media->ValueTObjectL<TInt>(KMPXMediaGeneralDuration);
+ }
+ }
+
+ CleanupStack::PopAndDestroy(mediaArray);
+ CleanupStack::PopAndDestroy(&attributes);
+ }
TInt CMPXDbHandler::HandleGetAlbumsCountForArtistL(TUint32 aArtistId)
{