mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbalbum.cpp
changeset 22 ecf06a08d4d9
child 25 3ec52facab4d
equal deleted inserted replaced
20:82baf59ce8dd 22:ecf06a08d4d9
       
     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::AddItemAlbumChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
       
   259                     EMPXAlbum, KDBPluginUid, ETrue, 0 );  
       
   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         MPXDbCommonUtil::AddItemAlbumChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
       
   317         		EMPXAlbum, KDBPluginUid, ETrue, 0 );    
       
   318         }
       
   319 
       
   320 	CleanupStack::PopAndDestroy(setStr);
       
   321 	CleanupStack::PopAndDestroy(values);
       
   322 	CleanupStack::PopAndDestroy(fields);
       
   323 	}
       
   324 
       
   325 // ----------------------------------------------------------------------------
       
   326 // CMPXDbAlbum::GetAlbumsCountForArtistL
       
   327 // ----------------------------------------------------------------------------
       
   328 //
       
   329 TInt CMPXDbAlbum::GetAlbumsCountForArtistL(TUint32 aArtistId)
       
   330 	{
       
   331     RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryCategorySubcategoryItems, aArtistId));
       
   332 
       
   333     TInt prevId(0);
       
   334     TInt count(0);
       
   335 	TInt err(KErrNone);
       
   336 	
       
   337     while ((err = recordset.Next()) == KSqlAtRow)
       
   338 		{
       
   339 		TUint32 rowId(recordset.ColumnInt64(EAlbumUniqueId));
       
   340         if (prevId == rowId)
       
   341             {
       
   342             continue;
       
   343             }
       
   344 		
       
   345 		count++;
       
   346 		prevId = rowId;
       
   347 		}
       
   348 
       
   349     if (err != KSqlAtEnd)
       
   350         {
       
   351         User::Leave(err);
       
   352         }
       
   353 
       
   354 	return count;
       
   355 
       
   356 	}
       
   357 
       
   358 // ----------------------------------------------------------------------------
       
   359 // CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL
       
   360 // ----------------------------------------------------------------------------
       
   361 //
       
   362 TInt CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL(TUint32 aArtistId, TUint32 aAlbumId)
       
   363 	{
       
   364 	MPX_FUNC("CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL");
       
   365 	
       
   366 	return ExecuteSumQueryL(KQuerySongsInArtistAlbum, aArtistId, aAlbumId);
       
   367 	}
       
   368 
       
   369 // ----------------------------------------------------------------------------
       
   370 // CMPXDbAlbum::UpdateMediaL
       
   371 // ----------------------------------------------------------------------------
       
   372 //
       
   373 void CMPXDbAlbum::UpdateMediaL(
       
   374     RSqlStatement& aRecord,
       
   375     const TArray<TMPXAttribute>& aAttrs,
       
   376     CMPXMedia& aMedia)
       
   377     {
       
   378     MPX_FUNC("CMPXDbAlbum::UpdateMediaL");
       
   379 
       
   380     TInt count(aAttrs.Count());
       
   381     for (TInt i = 0; i < count; ++i)
       
   382         {
       
   383         TInt contentId(aAttrs[i].ContentId());
       
   384         TUint attributeId(aAttrs[i].AttributeId());
       
   385 
       
   386         if (contentId == KMPXMediaIdGeneral)
       
   387             {
       
   388             if (attributeId & EMPXMediaGeneralId)
       
   389                 {
       
   390                 MPX_DEBUG1("    EMPXMediaGeneralId");
       
   391                 
       
   392                 aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
       
   393                     aRecord.ColumnInt64(EAlbumUniqueId));
       
   394                 }
       
   395             if (attributeId & EMPXMediaGeneralTitle)
       
   396                 {
       
   397                 MPX_DEBUG1("    EMPXMediaGeneralTitle");
       
   398                 
       
   399                 TPtrC album( MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) );
       
   400                 aMedia.SetTextValueL(KMPXMediaGeneralTitle,
       
   401                     MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName));
       
   402                 MPX_DEBUG2("	Album[%S]", &album );
       
   403                 }
       
   404             if (attributeId & EMPXMediaGeneralCount)
       
   405                 {
       
   406                 MPX_DEBUG1("    EMPXMediaGeneralCount");
       
   407 
       
   408 				TInt songCount = GetSongsCountL(KDbManagerAllDrives,
       
   409 					aRecord.ColumnInt64(EAlbumUniqueId));
       
   410                 aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount );
       
   411 				MPX_DEBUG2("	SongCount[%d]", songCount );
       
   412                 }
       
   413             } // end if contentId == KMPXMediaIdGeneral
       
   414 		else if ( contentId == KMPXMediaIdMusic )
       
   415 			{
       
   416 			if (attributeId & EMPXMediaMusicArtist)
       
   417 				{				
       
   418 				MPX_DEBUG1("	EMPXMediaMusicArtist");
       
   419 
       
   420 				TPtrC artistName(KNullDesC);
       
   421 				
       
   422 				// if album is unknown, ignore arist name
       
   423 				if (MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) != KNullDesC)
       
   424 					{
       
   425 					artistName.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArtistName));
       
   426 					}
       
   427 				
       
   428 				aMedia.SetTextValueL(KMPXMediaMusicArtist, artistName);
       
   429 				MPX_DEBUG2("	Artist[%S]", &artistName);
       
   430 				}
       
   431 
       
   432 			if (attributeId & EMPXMediaMusicAlbum)
       
   433 				{
       
   434 				MPX_DEBUG1("	EMPXMediaMusicAlbum");
       
   435 
       
   436 				TPtrC albumName(KNullDesC);
       
   437                 TPtrC album( MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) );
       
   438 
       
   439 
       
   440 				// if album is unknown
       
   441 				if ( album != KNullDesC)
       
   442 					{
       
   443 					albumName.Set(album);
       
   444 					}
       
   445 
       
   446 				aMedia.SetTextValueL(KMPXMediaMusicAlbum, albumName);
       
   447 				MPX_DEBUG2("	Album[%S]", &albumName);
       
   448 				}
       
   449 			if (attributeId & EMPXMediaMusicAlbumArtFileName)
       
   450 				{
       
   451 				MPX_DEBUG1("	EMPXMediaMusicAlbumArtFileName");
       
   452 
       
   453 				TPtrC art(KNullDesC);
       
   454 				
       
   455 				// if album is unknown, ignore album art name
       
   456 				if (MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) != KNullDesC)
       
   457 					{
       
   458 					art.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArt));
       
   459 					}
       
   460 				
       
   461 				aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
       
   462 				MPX_DEBUG2("	Art[%S]", &art);
       
   463 				}
       
   464 			}
       
   465 		} // end for
       
   466 
       
   467     aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
   468     aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, iCategory);
       
   469     }
       
   470 
       
   471 // ----------------------------------------------------------------------------
       
   472 // CMPXDbAlbum::GenerateAlbumFieldsValuesL
       
   473 // ----------------------------------------------------------------------------
       
   474 //
       
   475 void CMPXDbAlbum::GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia, CDesCArray& aFields, CDesCArray& aValues)
       
   476 	{
       
   477 	if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
       
   478 		{
       
   479 		const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen);
       
   480 		MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
       
   481 		}
       
   482 		
       
   483 	if (aMedia.IsSupported(KMPXMediaMusicArtist))
       
   484 	    {
       
   485 	    const TDesC& artistName = aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen);
       
   486 	    TUint32 artistId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXArtist,
       
   487 	            artistName, ETrue);
       
   488 	    MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArtist, artistId);	    
       
   489 	    }
       
   490 	}
       
   491 
       
   492 // ----------------------------------------------------------------------------
       
   493 // CMPXDbAlbum::IsUnknownArtistL
       
   494 // ----------------------------------------------------------------------------
       
   495 //
       
   496 TBool CMPXDbAlbum::IsUnknownArtistL(TUint32 aId)
       
   497 	{
       
   498 	return iObserver.HandleIsUnknownArtistL(aId);
       
   499 	}
       
   500 
       
   501 // ----------------------------------------------------------------------------
       
   502 // CMPXDbAlbum::ArtistForAlbumL
       
   503 // ----------------------------------------------------------------------------
       
   504 //
       
   505 TUint32 CMPXDbAlbum::ArtistForAlbumL(const TUint32 aId)
       
   506     {
       
   507     return iObserver.HandleArtistForAlbumL(aId);
       
   508     }
       
   509 
       
   510 // ----------------------------------------------------------------------------
       
   511 // CMPXDbAlbum::CreateTableL
       
   512 // ----------------------------------------------------------------------------
       
   513 //
       
   514 void CMPXDbAlbum::CreateTableL(
       
   515     RSqlDatabase& aDatabase,
       
   516     TBool /* aCorruptTable */)
       
   517     {
       
   518     MPX_FUNC("CMPXDbCategory::CreateTableL");
       
   519 
       
   520     // create the table
       
   521     HBufC* query = PreProcessStringLC(KAlbumCreateTable);
       
   522     User::LeaveIfError(aDatabase.Exec(*query));
       
   523     CleanupStack::PopAndDestroy(query);
       
   524 
       
   525     // do not create an index on the Name field
       
   526     // as it only slows down the insert/update queries overall
       
   527     }
       
   528 
       
   529 // ----------------------------------------------------------------------------
       
   530 // CMPXDbAlbum::CheckTableL
       
   531 // ----------------------------------------------------------------------------
       
   532 //
       
   533 TBool CMPXDbAlbum::CheckTableL(
       
   534     RSqlDatabase& aDatabase)
       
   535     {
       
   536     MPX_FUNC("CMPXDbCategory::CheckTableL");
       
   537 
       
   538     HBufC* query = PreProcessStringLC(KAlbumCheckTable);
       
   539     TBool check(DoCheckTable(aDatabase, *query));
       
   540     CleanupStack::PopAndDestroy(query);
       
   541 
       
   542     return check;
       
   543     }
       
   544 
       
   545 // End of File