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