mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbalbum.cpp
changeset 0 ff3acec5bc43
child 14 943ff5625028
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Responsible for interation with the category tables:
       
    15 *                Artist, Album, Genre and Composer
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <sqldb.h>
       
    22 
       
    23 #include <mpxlog.h>
       
    24 
       
    25 #include "mpxdbcommonutil.h"
       
    26 #include "mpxdbcommondef.h"
       
    27 #include "mpxdbmanager.h"
       
    28 
       
    29 #include "mpxcollectiondbdef.h"
       
    30 #include "mpxmediamusicdefs.h"
       
    31 #include "mpxdbpluginqueries.h"
       
    32 #include "mpxdbutil.h"
       
    33 #include "mpxdbalbum.h"
       
    34 
       
    35 // CONSTANTS
       
    36 
       
    37 // ============================ MEMBER FUNCTIONS ==============================
       
    38 
       
    39 // ----------------------------------------------------------------------------
       
    40 // Two-phased constructor.
       
    41 // ----------------------------------------------------------------------------
       
    42 //
       
    43 CMPXDbAlbum* CMPXDbAlbum::NewL(
       
    44     CMPXDbManager& aDbManager,
       
    45     TMPXGeneralCategory aCategory,
       
    46     MMPXDbAlbumObserver& aObserver)
       
    47     {
       
    48     MPX_FUNC("CMPXDbAlbum::NewL");
       
    49 
       
    50     CMPXDbAlbum* self = CMPXDbAlbum::NewLC(aDbManager, aCategory, aObserver);
       
    51     CleanupStack::Pop(self);
       
    52     return self;
       
    53     }
       
    54 
       
    55 // ----------------------------------------------------------------------------
       
    56 // Two-phased constructor.
       
    57 // ----------------------------------------------------------------------------
       
    58 //
       
    59 CMPXDbAlbum* CMPXDbAlbum::NewLC(
       
    60     CMPXDbManager& aDbManager,
       
    61     TMPXGeneralCategory aCategory,
       
    62     MMPXDbAlbumObserver& aObserver)
       
    63     {
       
    64     MPX_FUNC("CMPXDbAlbum::NewLC");
       
    65 
       
    66     CMPXDbAlbum* self = new (ELeave) CMPXDbAlbum(aDbManager, aCategory, aObserver);
       
    67     CleanupStack::PushL(self);
       
    68     self->ConstructL();
       
    69     return self;
       
    70     }
       
    71 
       
    72 // ----------------------------------------------------------------------------
       
    73 // Destructor
       
    74 // ----------------------------------------------------------------------------
       
    75 //
       
    76 CMPXDbAlbum::~CMPXDbAlbum()
       
    77     {
       
    78     MPX_FUNC("CMPXDbAlbum::~CMPXDbAlbum");
       
    79     }
       
    80 
       
    81 // ----------------------------------------------------------------------------
       
    82 // Constructor
       
    83 // ----------------------------------------------------------------------------
       
    84 //
       
    85 CMPXDbAlbum::CMPXDbAlbum(
       
    86     CMPXDbManager& aDbManager,
       
    87     TMPXGeneralCategory aCategory,
       
    88     MMPXDbAlbumObserver& aObserver) :
       
    89     CMPXDbCategory(aDbManager, aCategory),
       
    90     iObserver(aObserver)
       
    91     {
       
    92     MPX_FUNC("CMPXDbAlbum::CMPXDbAlbum");
       
    93     }
       
    94 
       
    95 // ----------------------------------------------------------------------------
       
    96 // Second phase constructor.
       
    97 // ----------------------------------------------------------------------------
       
    98 //
       
    99 void CMPXDbAlbum::ConstructL()
       
   100     {
       
   101     MPX_FUNC("CMPXDbAlbum::ConstructL");
       
   102 
       
   103     BaseConstructL();
       
   104     }
       
   105 
       
   106 // ----------------------------------------------------------------------------
       
   107 // CMPXDbAlbum::AddItemL
       
   108 // ----------------------------------------------------------------------------
       
   109 //
       
   110 TUint32 CMPXDbAlbum::AddItemL(
       
   111     const TDesC& aName,
       
   112     TUint32 aArtist,
       
   113     const TDesC& aArt,
       
   114     TInt aDriveId,
       
   115     TBool& aNewRecord,
       
   116     TBool aCaseSensitive)
       
   117     {
       
   118     MPX_FUNC("CMPXDbAlbum::AddItemL");
       
   119 
       
   120     // try to find the item first
       
   121     TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
       
   122         aName, aCaseSensitive));
       
   123     aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
       
   124 
       
   125     if (aNewRecord)
       
   126         {
       
   127         // insert new
       
   128         HBufC* query = PreProcessStringLC(KQueryAlbumInsert);
       
   129         HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
       
   130 		HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(aArt);
       
   131 
       
   132         iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1, aArtist, art);
       
   133 
       
   134 		CleanupStack::PopAndDestroy(art);
       
   135         CleanupStack::PopAndDestroy(name);
       
   136         CleanupStack::PopAndDestroy(query);
       
   137         }
       
   138     else
       
   139         {
       
   140         // retrieve the existing record
       
   141         HBufC* query = NULL;
       
   142         query = PreProcessStringLC(KQueryCategoryItem);
       
   143         RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, rowId));
       
   144         CleanupStack::PopAndDestroy(query);
       
   145 
       
   146         CleanupClosePushL(recordset);
       
   147 
       
   148         if (recordset.Next() != KSqlAtRow)
       
   149             {
       
   150             User::Leave(KErrNotFound);
       
   151 	    }
       
   152 
       
   153         // Artist
       
   154         TUint32 artistId = recordset.ColumnInt64(EAlbumArtist);
       
   155 
       
   156         // the current one is Unknown and the new one is Not Unknown.
       
   157         if ( IsUnknownArtistL( artistId ) && !IsUnknownArtistL( aArtist ) )
       
   158             {
       
   159             _LIT( KFormatArtistId, "Artist=%d" );
       
   160             HBufC* setStr = HBufC::NewLC(KFormatArtistId().Length() + KMCIntegerLen);
       
   161             setStr->Des().Format( KFormatArtistId, aArtist );
       
   162 
       
   163             iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, rowId);
       
   164             CleanupStack::PopAndDestroy(setStr);
       
   165             }
       
   166 
       
   167         // Album Art
       
   168         TPtrC art(KNullDesC);
       
   169         art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EAlbumArt));
       
   170 
       
   171         // the current one is Unknown and the new one is Not Unknown
       
   172         if ( art == KNullDesC && aArt != KNullDesC )
       
   173             {
       
   174             HBufC* artReplaceSingleQuote = 
       
   175                             MPXDbCommonUtil::ProcessSingleQuotesLC( aArt );
       
   176             _LIT( KFormatArt, "Art=\'%S\'" );
       
   177             HBufC* setStr = HBufC::NewLC(256);
       
   178             setStr->Des().Format( KFormatArt, artReplaceSingleQuote );
       
   179 
       
   180             iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, rowId);
       
   181             CleanupStack::PopAndDestroy(setStr);
       
   182             CleanupStack::PopAndDestroy(artReplaceSingleQuote);
       
   183             }
       
   184 
       
   185         CleanupStack::PopAndDestroy(&recordset);
       
   186 
       
   187         // increment the number of songs for the category
       
   188         query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
       
   189         iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
       
   190         CleanupStack::PopAndDestroy(query);
       
   191         }
       
   192 
       
   193     return rowId;
       
   194     }
       
   195 
       
   196 // ----------------------------------------------------------------------------
       
   197 // CMPXDbAlbum::DecrementSongsForCategoryL
       
   198 // ----------------------------------------------------------------------------
       
   199 //
       
   200 void CMPXDbAlbum::DecrementSongsForCategoryL(
       
   201     const TUint32 aId,
       
   202     TInt aDriveId,
       
   203     CMPXMessageArray* aItemChangedMessages,
       
   204     TBool& aItemExist,
       
   205     const TUint32 aArtist)
       
   206     {
       
   207     MPX_FUNC("CMPXDbAlbum::DecrementSongsForCategoryL");
       
   208 
       
   209     // if just one song uses this category. Use <= just in case
       
   210     if (GetSongsCountL(aDriveId, aId) <= 1)
       
   211         {
       
   212         aItemExist = EFalse;
       
   213         // delete the category
       
   214         DeleteCategoryL(aId, aDriveId);
       
   215 
       
   216         if (aItemChangedMessages)
       
   217             {
       
   218             // add the item changed message
       
   219             MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
       
   220                 iCategory, KDBPluginUid);
       
   221             }
       
   222         }
       
   223     else
       
   224         {
       
   225         aItemExist = ETrue;
       
   226 
       
   227         // retrieve the existing record
       
   228         HBufC* query = PreProcessStringLC(KQueryCategoryItem);
       
   229         RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, aId));
       
   230         CleanupStack::PopAndDestroy(query);
       
   231 
       
   232         CleanupClosePushL(recordset);
       
   233 
       
   234         if (recordset.Next() != KSqlAtRow)
       
   235             {
       
   236             User::Leave(KErrNotFound);
       
   237         }
       
   238 
       
   239         TUint32 artistId = recordset.ColumnInt64(EAlbumArtist);
       
   240 
       
   241         CleanupStack::PopAndDestroy(&recordset);
       
   242 
       
   243         // the current artist is equal to deleted song's artist
       
   244         if ( artistId == aArtist )
       
   245             {
       
   246             TUint32 newArtistId = ArtistForAlbumL(aId);
       
   247 
       
   248             _LIT( KFormatArtistId, "Artist=%d" );
       
   249             HBufC* setStr = HBufC::NewLC(KFormatArtistId().Length() + KMCIntegerLen);
       
   250             setStr->Des().Format(KFormatArtistId, newArtistId);
       
   251 
       
   252             iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, aId);
       
   253             CleanupStack::PopAndDestroy(setStr);
       
   254 
       
   255             if (aItemChangedMessages)
       
   256                 {
       
   257                 // add the item changed message
       
   258                 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
       
   259                     iCategory, KDBPluginUid);
       
   260                 }
       
   261             }
       
   262 
       
   263         // decrement the number of songs for the category
       
   264         query = PreProcessStringLC(KQueryCategoryDecrementSongCount);
       
   265         iDbManager.ExecuteQueryL(aDriveId, *query, aId);
       
   266         CleanupStack::PopAndDestroy(query);
       
   267         }
       
   268     }
       
   269 
       
   270 // ----------------------------------------------------------------------------
       
   271 // CMPXDbAlbum::GetAllCategoryItemsL
       
   272 // ----------------------------------------------------------------------------
       
   273 //
       
   274 void CMPXDbAlbum::GetAllCategoryItemsL(
       
   275     const TArray<TMPXAttribute>& aAttrs,
       
   276     CMPXMediaArray& aMediaArray)
       
   277     {
       
   278     MPX_FUNC("CMPXDbAlbum::GetAllCategoryItemsL");
       
   279 
       
   280     HBufC* query = PreProcessStringLC(KQueryAlbumAll);
       
   281     RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
       
   282     CleanupStack::PopAndDestroy(query);
       
   283 
       
   284     CleanupClosePushL(recordset);
       
   285     ProcessRecordsetL(aAttrs, recordset, aMediaArray);
       
   286     CleanupStack::PopAndDestroy(&recordset);
       
   287     }
       
   288 
       
   289 // ----------------------------------------------------------------------------
       
   290 // CMPXDbAlbum::UpdateItemL
       
   291 // ----------------------------------------------------------------------------
       
   292 //
       
   293 void CMPXDbAlbum::UpdateItemL(
       
   294     TUint32 aId,
       
   295     const CMPXMedia& aMedia,
       
   296     TInt aDriveId,
       
   297     CMPXMessageArray* aItemChangedMessages)
       
   298 	{
       
   299 	MPX_FUNC("CMPXDbAlbum::UpdateItemL");
       
   300 
       
   301 	CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EAlbumFieldCount);
       
   302 	CleanupStack::PushL(fields);
       
   303 	CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EAlbumFieldCount);
       
   304 	CleanupStack::PushL(values);
       
   305 
       
   306 	// process the media parameter and construct the fields and values array
       
   307 	GenerateAlbumFieldsValuesL(aMedia, *fields, *values);
       
   308 
       
   309 	// construct the SET string
       
   310 	HBufC* setStr = MPXDbCommonUtil::StringFromArraysLC(*fields, *values, KMCEqualSign, KMCCommaSign);
       
   311 
       
   312     if (setStr->Length())
       
   313         {
       
   314         // execute the query
       
   315         iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, aId);
       
   316 	    TInt oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
       
   317 	    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
       
   318             EMPXAlbum, KDBPluginUid, oldSongId );
       
   319         }
       
   320 
       
   321 	CleanupStack::PopAndDestroy(setStr);
       
   322 	CleanupStack::PopAndDestroy(values);
       
   323 	CleanupStack::PopAndDestroy(fields);
       
   324 	}
       
   325 
       
   326 // ----------------------------------------------------------------------------
       
   327 // CMPXDbAlbum::GetAlbumsCountForArtistL
       
   328 // ----------------------------------------------------------------------------
       
   329 //
       
   330 TInt CMPXDbAlbum::GetAlbumsCountForArtistL(TUint32 aArtistId)
       
   331 	{
       
   332     RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryCategorySubcategoryItems, aArtistId));
       
   333 
       
   334     TInt prevId(0);
       
   335     TInt count(0);
       
   336 	TInt err(KErrNone);
       
   337 
       
   338     while ((err = recordset.Next()) == KSqlAtRow)
       
   339 		{
       
   340 		TUint32 rowId(recordset.ColumnInt64(EAlbumUniqueId));
       
   341         if (prevId == rowId)
       
   342             {
       
   343             continue;
       
   344             }
       
   345 
       
   346 		count++;
       
   347 		prevId = rowId;
       
   348 		}
       
   349 
       
   350     if (err != KSqlAtEnd)
       
   351         {
       
   352         User::Leave(err);
       
   353         }
       
   354 
       
   355 	return count;
       
   356 
       
   357 	}
       
   358 
       
   359 // ----------------------------------------------------------------------------
       
   360 // CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL
       
   361 // ----------------------------------------------------------------------------
       
   362 //
       
   363 TInt CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL(TUint32 aArtistId, TUint32 aAlbumId)
       
   364 	{
       
   365 	MPX_FUNC("CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL");
       
   366 
       
   367 	return ExecuteSumQueryL(KQuerySongsInArtistAlbum, aArtistId, aAlbumId);
       
   368 	}
       
   369 
       
   370 // ----------------------------------------------------------------------------
       
   371 // CMPXDbAlbum::UpdateMediaL
       
   372 // ----------------------------------------------------------------------------
       
   373 //
       
   374 void CMPXDbAlbum::UpdateMediaL(
       
   375     RSqlStatement& aRecord,
       
   376     const TArray<TMPXAttribute>& aAttrs,
       
   377     CMPXMedia& aMedia)
       
   378     {
       
   379     MPX_FUNC("CMPXDbAlbum::UpdateMediaL");
       
   380 
       
   381     TInt count(aAttrs.Count());
       
   382     for (TInt i = 0; i < count; ++i)
       
   383         {
       
   384         TInt contentId(aAttrs[i].ContentId());
       
   385         TUint attributeId(aAttrs[i].AttributeId());
       
   386 
       
   387         if (contentId == KMPXMediaIdGeneral)
       
   388             {
       
   389             if (attributeId & EMPXMediaGeneralId)
       
   390                 {
       
   391                 MPX_DEBUG1("    EMPXMediaGeneralId");
       
   392 
       
   393                 aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
       
   394                     aRecord.ColumnInt64(EAlbumUniqueId));
       
   395                 }
       
   396             if (attributeId & EMPXMediaGeneralTitle)
       
   397                 {
       
   398                 MPX_DEBUG1("    EMPXMediaGeneralTitle");
       
   399 
       
   400                 TPtrC album( MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) );
       
   401                 aMedia.SetTextValueL(KMPXMediaGeneralTitle,
       
   402                     MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName));
       
   403                 MPX_DEBUG2("	Album[%S]", &album );
       
   404                 }
       
   405             if (attributeId & EMPXMediaGeneralCount)
       
   406                 {
       
   407                 MPX_DEBUG1("    EMPXMediaGeneralCount");
       
   408 
       
   409 				TInt songCount = GetSongsCountL(KDbManagerAllDrives,
       
   410 					aRecord.ColumnInt64(EAlbumUniqueId));
       
   411                 aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount );
       
   412 				MPX_DEBUG2("	SongCount[%d]", songCount );
       
   413                 }
       
   414             } // end if contentId == KMPXMediaIdGeneral
       
   415 		else if ( contentId == KMPXMediaIdMusic )
       
   416 			{
       
   417 			if (attributeId & EMPXMediaMusicArtist)
       
   418 				{
       
   419 				MPX_DEBUG1("	EMPXMediaMusicArtist");
       
   420 
       
   421 				TPtrC artistName(KNullDesC);
       
   422 
       
   423 				// if album is unknown, ignore arist name
       
   424 				if (MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) != KNullDesC)
       
   425 					{
       
   426 					artistName.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArtistName));
       
   427 					}
       
   428 
       
   429 				aMedia.SetTextValueL(KMPXMediaMusicArtist, artistName);
       
   430 				MPX_DEBUG2("	Artist[%S]", &artistName);
       
   431 				}
       
   432 
       
   433 			if (attributeId & EMPXMediaMusicAlbum)
       
   434 				{
       
   435 				MPX_DEBUG1("	EMPXMediaMusicAlbum");
       
   436 
       
   437 				TPtrC albumName(KNullDesC);
       
   438                 TPtrC album( MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) );
       
   439 
       
   440 
       
   441 				// if album is unknown
       
   442 				if ( album != KNullDesC)
       
   443 					{
       
   444 					albumName.Set(album);
       
   445 					}
       
   446 
       
   447 				aMedia.SetTextValueL(KMPXMediaMusicAlbum, albumName);
       
   448 				MPX_DEBUG2("	Album[%S]", &albumName);
       
   449 				}
       
   450 			if (attributeId & EMPXMediaMusicAlbumArtFileName)
       
   451 				{
       
   452 				MPX_DEBUG1("	EMPXMediaMusicAlbumArtFileName");
       
   453 
       
   454 				TPtrC art(KNullDesC);
       
   455 
       
   456 				// if album is unknown, ignore album art name
       
   457 				if (MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) != KNullDesC)
       
   458 					{
       
   459 					art.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArt));
       
   460 					}
       
   461 
       
   462 				aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
       
   463 				MPX_DEBUG2("	Art[%S]", &art);
       
   464 				}
       
   465 			}
       
   466 		} // end for
       
   467 
       
   468     aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
   469     aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, iCategory);
       
   470     }
       
   471 
       
   472 // ----------------------------------------------------------------------------
       
   473 // CMPXDbAlbum::GenerateAlbumFieldsValuesL
       
   474 // ----------------------------------------------------------------------------
       
   475 //
       
   476 void CMPXDbAlbum::GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia, CDesCArray& aFields, CDesCArray& aValues)
       
   477 	{
       
   478 	if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
       
   479 		{
       
   480 		const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen);
       
   481 		MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
       
   482 		}
       
   483 
       
   484 	if (aMedia.IsSupported(KMPXMediaMusicArtist))
       
   485 	    {
       
   486 	    const TDesC& artistName = aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen);
       
   487 	    TUint32 artistId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXArtist,
       
   488 	            artistName, ETrue);
       
   489 	    MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArtist, artistId);
       
   490 	    }
       
   491 	}
       
   492 
       
   493 // ----------------------------------------------------------------------------
       
   494 // CMPXDbAlbum::IsUnknownArtistL
       
   495 // ----------------------------------------------------------------------------
       
   496 //
       
   497 TBool CMPXDbAlbum::IsUnknownArtistL(TUint32 aId)
       
   498 	{
       
   499 	return iObserver.HandleIsUnknownArtistL(aId);
       
   500 	}
       
   501 
       
   502 // ----------------------------------------------------------------------------
       
   503 // CMPXDbAlbum::ArtistForAlbumL
       
   504 // ----------------------------------------------------------------------------
       
   505 //
       
   506 TUint32 CMPXDbAlbum::ArtistForAlbumL(const TUint32 aId)
       
   507     {
       
   508     return iObserver.HandleArtistForAlbumL(aId);
       
   509     }
       
   510 
       
   511 // ----------------------------------------------------------------------------
       
   512 // CMPXDbAlbum::CreateTableL
       
   513 // ----------------------------------------------------------------------------
       
   514 //
       
   515 void CMPXDbAlbum::CreateTableL(
       
   516     RSqlDatabase& aDatabase,
       
   517     TBool /* aCorruptTable */)
       
   518     {
       
   519     MPX_FUNC("CMPXDbCategory::CreateTableL");
       
   520 
       
   521     // create the table
       
   522     HBufC* query = PreProcessStringLC(KAlbumCreateTable);
       
   523     User::LeaveIfError(aDatabase.Exec(*query));
       
   524     CleanupStack::PopAndDestroy(query);
       
   525 
       
   526     // do not create an index on the Name field
       
   527     // as it only slows down the insert/update queries overall
       
   528     }
       
   529 
       
   530 // ----------------------------------------------------------------------------
       
   531 // CMPXDbAlbum::CheckTableL
       
   532 // ----------------------------------------------------------------------------
       
   533 //
       
   534 TBool CMPXDbAlbum::CheckTableL(
       
   535     RSqlDatabase& aDatabase)
       
   536     {
       
   537     MPX_FUNC("CMPXDbCategory::CheckTableL");
       
   538 
       
   539     HBufC* query = PreProcessStringLC(KAlbumCheckTable);
       
   540     TBool check(DoCheckTable(aDatabase, *query));
       
   541     CleanupStack::PopAndDestroy(query);
       
   542 
       
   543     return check;
       
   544     }
       
   545 
       
   546 // End of File