mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbartist.cpp
branchRCL_3
changeset 66 1f1dad4af8f8
parent 56 2cbbefa9af78
equal deleted inserted replaced
60:bdd9da0d70fe 66:1f1dad4af8f8
    40 // Two-phased constructor.
    40 // Two-phased constructor.
    41 // ----------------------------------------------------------------------------
    41 // ----------------------------------------------------------------------------
    42 //
    42 //
    43 CMPXDbArtist* CMPXDbArtist::NewL(
    43 CMPXDbArtist* CMPXDbArtist::NewL(
    44     CMPXDbManager& aDbManager,
    44     CMPXDbManager& aDbManager,
    45     TMPXGeneralCategory aCategory)
    45     TMPXGeneralCategory aCategory,
       
    46     MMPXDbArtistObserver& aObserver)
    46     {
    47     {
    47     MPX_FUNC("CMPXDbArtist::NewL");
    48     MPX_FUNC("CMPXDbArtist::NewL");
    48 
    49 
    49     CMPXDbArtist* self = CMPXDbArtist::NewLC(aDbManager, aCategory);
    50     CMPXDbArtist* self = CMPXDbArtist::NewLC(aDbManager, aCategory, aObserver);
    50     CleanupStack::Pop(self);
    51     CleanupStack::Pop(self);
    51     return self;
    52     return self;
    52     }
    53     }
    53 
    54 
    54 // ----------------------------------------------------------------------------
    55 // ----------------------------------------------------------------------------
    55 // Two-phased constructor.
    56 // Two-phased constructor.
    56 // ----------------------------------------------------------------------------
    57 // ----------------------------------------------------------------------------
    57 //
    58 //
    58 CMPXDbArtist* CMPXDbArtist::NewLC(
    59 CMPXDbArtist* CMPXDbArtist::NewLC(
    59     CMPXDbManager& aDbManager,
    60     CMPXDbManager& aDbManager,
    60     TMPXGeneralCategory aCategory)
    61     TMPXGeneralCategory aCategory,
       
    62     MMPXDbArtistObserver& aObserver)
    61     {
    63     {
    62     MPX_FUNC("CMPXDbArtist::NewLC");
    64     MPX_FUNC("CMPXDbArtist::NewLC");
    63 
    65 
    64     CMPXDbArtist* self = new (ELeave) CMPXDbArtist(aDbManager, aCategory);
    66     CMPXDbArtist* self = new (ELeave) CMPXDbArtist(aDbManager, aCategory, aObserver);
    65     CleanupStack::PushL(self);
    67     CleanupStack::PushL(self);
    66     self->ConstructL();
    68     self->ConstructL();
    67     return self;
    69     return self;
    68     }
    70     }
    69 
    71 
    80 // Constructor
    82 // Constructor
    81 // ----------------------------------------------------------------------------
    83 // ----------------------------------------------------------------------------
    82 //
    84 //
    83 CMPXDbArtist::CMPXDbArtist(
    85 CMPXDbArtist::CMPXDbArtist(
    84     CMPXDbManager& aDbManager,
    86     CMPXDbManager& aDbManager,
    85     TMPXGeneralCategory aCategory) :
    87     TMPXGeneralCategory aCategory,
    86     CMPXDbCategory(aDbManager, aCategory)
    88     MMPXDbArtistObserver& aObserver) :
       
    89     CMPXDbCategory(aDbManager, aCategory),
       
    90     iObserver(aObserver)
    87     {
    91     {
    88     MPX_FUNC("CMPXDbArtist::CMPXDbArtist");
    92     MPX_FUNC("CMPXDbArtist::CMPXDbArtist");
    89     }
    93     }
    90 
    94 
    91 // ----------------------------------------------------------------------------
    95 // ----------------------------------------------------------------------------
   102 // ----------------------------------------------------------------------------
   106 // ----------------------------------------------------------------------------
   103 // CMPXDbArtist::AddItemL
   107 // CMPXDbArtist::AddItemL
   104 // ----------------------------------------------------------------------------
   108 // ----------------------------------------------------------------------------
   105 //
   109 //
   106 TUint32 CMPXDbArtist::AddItemL(
   110 TUint32 CMPXDbArtist::AddItemL(
   107     TMPXGeneralCategory /*aCategory*/,        
   111     const TDesC& aName,
   108     const CMPXMedia& aMedia,
   112     const TDesC& aArt,
   109     TInt aDriveId,
   113     TInt aDriveId,
   110     TBool& aNewRecord,
   114     TBool& aNewRecord,
   111     TBool aCaseSensitive)
   115     TBool aCaseSensitive)
   112     {
   116     {
   113     MPX_FUNC("CMPXDbArtist::AddItemL");
   117     MPX_FUNC("CMPXDbArtist::AddItemL");
   114 
   118 
   115     TPtrC artist(KNullDesC);
       
   116     TPtrC albumArt(KNullDesC);
       
   117     
       
   118     if (aMedia.IsSupported(KMPXMediaMusicArtist))
       
   119         {
       
   120         artist.Set(aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen));
       
   121         }
       
   122     
       
   123     if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
       
   124         {
       
   125         albumArt.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
       
   126         }
       
   127        
       
   128     // try to find the item first
   119     // try to find the item first
   129     TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
   120     TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
   130         artist, aCaseSensitive));
   121         aName, aCaseSensitive));
   131 
   122     aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
   132     HBufC* query = PreProcessStringLC(KQueryCategoryItem);
   123 
   133     RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDriveId, *query, rowId));
   124     if (aNewRecord)
   134     CleanupStack::PopAndDestroy(query);
   125         {
   135     CleanupClosePushL(recordset);
       
   136     
       
   137     TInt result(recordset.Next());
       
   138     if (result == KSqlAtEnd)
       
   139         {
       
   140         aNewRecord = result;
       
   141         
       
   142         // insert new
   126         // insert new
   143         HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(artist);
   127         HBufC* query = PreProcessStringLC(KQueryArtistInsert);
   144         HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(albumArt);
   128         HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
   145 
   129         HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(aArt);
   146         iDbManager.ExecuteQueryL(aDriveId, KQueryArtistInsert, rowId, name, 1, 0, art);
   130 
       
   131         iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1, art);
   147 
   132 
   148         CleanupStack::PopAndDestroy(art);
   133         CleanupStack::PopAndDestroy(art);
   149         CleanupStack::PopAndDestroy(name);
   134         CleanupStack::PopAndDestroy(name);
   150         }
   135         CleanupStack::PopAndDestroy(query);
   151     else if (result == KSqlAtRow)
   136         }
   152         {
   137     else
   153         // retrieve Art from Artist table
   138         {
       
   139         // retrieve the existing record
       
   140         HBufC* query = NULL;
       
   141         query = PreProcessStringLC(KQueryCategoryItem);
       
   142         RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, rowId));
       
   143         CleanupStack::PopAndDestroy(query);
       
   144 
       
   145         CleanupClosePushL(recordset);
       
   146 
       
   147         if (recordset.Next() != KSqlAtRow)
       
   148             {
       
   149             User::Leave(KErrNotFound);
       
   150         }
       
   151 
       
   152         // Album Art
   154         TPtrC art(KNullDesC);
   153         TPtrC art(KNullDesC);
   155         art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EArtistArt));
   154         art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EArtistArt));
   156 
   155 
   157         // the current one is Unknown and the new one is Not Unknown
   156         // the current one is Unknown and the new one is Not Unknown
   158         if ( art == KNullDesC && albumArt != KNullDesC )
   157         if ( art == KNullDesC && aArt != KNullDesC )
   159             {
   158             {
   160             HBufC* artReplaceSingleQuote = 
   159             HBufC* artReplaceSingleQuote = 
   161                 MPXDbCommonUtil::ProcessSingleQuotesLC( albumArt );
   160                 MPXDbCommonUtil::ProcessSingleQuotesLC( aArt );
   162             _LIT( KFormatArt, "Art=\'%S\'" );
   161             _LIT( KFormatArt, "Art=\'%S\'" );
   163             HBufC* setStr = HBufC::NewLC(KMaxFileName);
   162             HBufC* setStr = HBufC::NewLC(256);
   164             setStr->Des().Format( KFormatArt, artReplaceSingleQuote );
   163             setStr->Des().Format( KFormatArt, artReplaceSingleQuote );
   165 
   164 
   166             iDbManager.ExecuteQueryL(aDriveId, KQueryArtistUpdate, setStr, rowId);
   165             iDbManager.ExecuteQueryL(aDriveId, KQueryArtistUpdate, setStr, rowId);
   167             CleanupStack::PopAndDestroy(setStr);
   166             CleanupStack::PopAndDestroy(setStr);
   168             CleanupStack::PopAndDestroy(artReplaceSingleQuote);
   167             CleanupStack::PopAndDestroy(artReplaceSingleQuote);
   169             }
   168             }
   170 
   169 
       
   170         CleanupStack::PopAndDestroy(&recordset);
       
   171 
   171         // increment the number of songs for the category
   172         // increment the number of songs for the category
   172         query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
   173         query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
   173         iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
   174         iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
   174         CleanupStack::PopAndDestroy(query);
   175         CleanupStack::PopAndDestroy(query);
   175         }
   176         }
   176     else
   177 
   177         {
       
   178         MPX_DEBUG2("SQL error %d", result);
       
   179         User::Leave(result);
       
   180         }
       
   181     
       
   182     CleanupStack::PopAndDestroy(&recordset);
       
   183     
       
   184     return rowId;
   178     return rowId;
   185     }
   179     }
   186     
   180 
   187 // ----------------------------------------------------------------------------
   181 // ----------------------------------------------------------------------------
   188 // CMPXDbArtist::DecrementSongsForCategoryL
   182 // CMPXDbArtist::IsUnknownArtistL
   189 // ----------------------------------------------------------------------------
   183 // ----------------------------------------------------------------------------
   190 //
   184 //
   191 void CMPXDbArtist::DecrementSongsForCategoryL(
   185 TBool CMPXDbArtist::IsUnknownArtistL(TUint32 aId)
   192     const TUint32 aId,
   186     {
   193     TInt aDriveId,
   187 	MPX_FUNC("CMPXDbArtist::IsUnknownArtistL");
   194     CMPXMessageArray* aItemChangedMessages,
   188 
   195     TBool& aItemExist
   189     HBufC* name = GetNameL(aId);
   196 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
   190 
   197     ,
   191 	TInt ret = EFalse;
   198     TBool /*aMTPInUse*/
   192 	if (*name == KNullDesC)
   199 #endif //ABSTRACTAUDIOALBUM_INCLUDED
   193 		{
   200     )
   194 		ret = ETrue;
   201     {
   195 		}
   202     MPX_FUNC("CMPXDbArtist::DecrementSongsForCategoryL");
   196 	delete name;
   203     
   197 
   204     TInt songsCount(0);
   198 	return ret;
   205     TInt albumsCount(0);
       
   206     
       
   207     GetSongsAndAlbumsCountL(aDriveId, aId, songsCount, albumsCount); 
       
   208             
       
   209     MPX_DEBUG4("id %d, songsCount %d, albumsCount %d", aId, songsCount, albumsCount);
       
   210     
       
   211     // if just one song uses this category. Use <= just in case
       
   212     if (songsCount <= 1 && albumsCount == 0)  
       
   213         {
       
   214         aItemExist = EFalse;
       
   215         // delete the category
       
   216         DeleteCategoryL(aId, aDriveId);
       
   217 
       
   218         if (aItemChangedMessages)
       
   219             {
       
   220             // add the item changed message
       
   221             MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
       
   222                 iCategory, KDBPluginUid);
       
   223             }
       
   224         }
       
   225     else if (songsCount > 0)
       
   226         {
       
   227         aItemExist = ETrue;
       
   228         // decrement the number of songs for the category
       
   229         HBufC* query = PreProcessStringLC(KQueryCategoryDecrementSongCount);
       
   230         iDbManager.ExecuteQueryL(aDriveId, *query, aId);
       
   231         CleanupStack::PopAndDestroy(query);
       
   232         }
       
   233     }
   199     }
   234 
   200 
   235 // ----------------------------------------------------------------------------
   201 // ----------------------------------------------------------------------------
   236 // CMPXDbArtist::UpdateMediaL
   202 // CMPXDbArtist::UpdateMediaL
   237 // ----------------------------------------------------------------------------
   203 // ----------------------------------------------------------------------------
   269 
   235 
   270 				MPX_DEBUG2("	Artist[%S]", &artist);
   236 				MPX_DEBUG2("	Artist[%S]", &artist);
   271                 }
   237                 }
   272             if (attributeId & EMPXMediaGeneralCount)
   238             if (attributeId & EMPXMediaGeneralCount)
   273                 {
   239                 {
       
   240 //				TInt albumCount = GetAlbumsCountL(aRecord.ColumnInt64(EArtistUniqueId));
       
   241 //              aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,albumCount);
       
   242 //              MPX_DEBUG1("	EMPXMediaGeneralCount");
       
   243 //				MPX_DEBUG2("	AlbumCount[%d]", albumCount);
   274                 // get songs count from all drives
   244                 // get songs count from all drives
   275                 TInt songCount = GetSongsCountL( KDbManagerAllDrives,
   245                 TInt songCount = GetSongsCountL( KDbManagerAllDrives,
   276                                     aRecord.ColumnInt64( EArtistUniqueId ) );
   246                                     aRecord.ColumnInt64( EArtistUniqueId ) );
   277 				aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount); // mod by anjokela
   247 				aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount); // mod by anjokela
   278 
   248 
   309         MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
   279         MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
   310         }
   280         }
   311     }
   281     }
   312 
   282 
   313 // ----------------------------------------------------------------------------
   283 // ----------------------------------------------------------------------------
       
   284 // CMPXDbArtist::GetAlbumsCountL
       
   285 // ----------------------------------------------------------------------------
       
   286 //
       
   287 TInt CMPXDbArtist::GetAlbumsCountL(TUint32 aId)
       
   288     {
       
   289     MPX_FUNC("CMPXDbArtist::GetAlbumsCountL");
       
   290 
       
   291 	return iObserver.HandleGetAlbumsCountForArtistL(aId);
       
   292     }
       
   293 
       
   294 // ----------------------------------------------------------------------------
   314 // CMPXDbArtist::GetAllCategoryItemsL
   295 // CMPXDbArtist::GetAllCategoryItemsL
   315 // ----------------------------------------------------------------------------
   296 // ----------------------------------------------------------------------------
   316 //
   297 //
   317 void CMPXDbArtist::GetAllCategoryItemsL(
   298 void CMPXDbArtist::GetAllCategoryItemsL(
   318     const TArray<TMPXAttribute>& aAttrs,
   299     const TArray<TMPXAttribute>& aAttrs,
   319     CMPXMediaArray& aMediaArray)
   300     CMPXMediaArray& aMediaArray)
   320     {
   301     {
   321     MPX_FUNC("CMPXDbArtist::GetAllCategoryItemsL");
   302     MPX_FUNC("CMPXDbArtist::GetAllCategoryItemsL");
   322     RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryArtistAll()));
   303     HBufC* query = PreProcessStringLC(KQueryArtistAll);
       
   304     RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
       
   305     CleanupStack::PopAndDestroy(query);
   323     CleanupClosePushL(recordset);
   306     CleanupClosePushL(recordset);
   324     ProcessRecordsetL(aAttrs, recordset, aMediaArray);
   307     ProcessRecordsetL(aAttrs, recordset, aMediaArray);
   325     CleanupStack::PopAndDestroy(&recordset);
   308     CleanupStack::PopAndDestroy(&recordset);
   326     }
   309     }
   327 
   310 
   358 
   341 
   359     CleanupStack::PopAndDestroy(setStr);
   342     CleanupStack::PopAndDestroy(setStr);
   360     CleanupStack::PopAndDestroy(values);
   343     CleanupStack::PopAndDestroy(values);
   361     CleanupStack::PopAndDestroy(fields);
   344     CleanupStack::PopAndDestroy(fields);
   362     }
   345     }
   363 
   346 // ----------------------------------------------------------------------------
   364 // ----------------------------------------------------------------------------
   347 // CMPXDbAlbum::CreateTableL
   365 // CMPXDbArtist::AddAlbumArtistL
       
   366 // ----------------------------------------------------------------------------
       
   367 //
       
   368 TUint32 CMPXDbArtist::AddAlbumArtistL(
       
   369     const TDesC& aName,
       
   370     const TDesC& aArt,
       
   371     TInt aDriveId)
       
   372     {
       
   373     MPX_FUNC("CMPXDbArtist::AddAlbumArtistL");
       
   374 
       
   375     // try to find the item first
       
   376     TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
       
   377         aName, ETrue));
       
   378     HBufC* query = PreProcessStringLC(KQueryCategoryItem);
       
   379     RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDriveId, *query, rowId));
       
   380     CleanupStack::PopAndDestroy(query);
       
   381     CleanupClosePushL(recordset);
       
   382     
       
   383     TInt result(recordset.Next());
       
   384     if (result == KSqlAtEnd)
       
   385         {
       
   386         // insert new
       
   387         HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
       
   388         HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(aArt);
       
   389 
       
   390         iDbManager.ExecuteQueryL(aDriveId, KQueryArtistInsert, rowId, name, 0, 1, art);
       
   391 
       
   392         CleanupStack::PopAndDestroy(art);
       
   393         CleanupStack::PopAndDestroy(name);
       
   394         }
       
   395     else if (result == KSqlAtRow)
       
   396         {
       
   397         // retrieve Art from Artist table
       
   398         TPtrC art(KNullDesC);
       
   399         art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EArtistArt));
       
   400 
       
   401         // the current one is Unknown and the new one is Not Unknown
       
   402         if ( art == KNullDesC && aArt != KNullDesC )
       
   403             {
       
   404             HBufC* artReplaceSingleQuote = 
       
   405                 MPXDbCommonUtil::ProcessSingleQuotesLC( aArt );
       
   406             _LIT( KFormatArt, "Art=\'%S\'" );
       
   407             HBufC* setStr = HBufC::NewLC(KMaxFileName);
       
   408             setStr->Des().Format( KFormatArt, artReplaceSingleQuote );
       
   409 
       
   410             iDbManager.ExecuteQueryL(aDriveId, KQueryArtistUpdate, setStr, rowId);
       
   411             CleanupStack::PopAndDestroy(setStr);
       
   412             CleanupStack::PopAndDestroy(artReplaceSingleQuote);
       
   413             }
       
   414 
       
   415         // increment the number of songs for the category
       
   416         iDbManager.ExecuteQueryL(aDriveId, KQueryArtistIncrementAlbumCount, rowId);
       
   417         }
       
   418     else
       
   419         {
       
   420         MPX_DEBUG2("SQL error %d", result);
       
   421         User::Leave(result);
       
   422         }
       
   423 
       
   424     CleanupStack::PopAndDestroy(&recordset);
       
   425     
       
   426     return rowId;
       
   427     }
       
   428 
       
   429 // ----------------------------------------------------------------------------
       
   430 // CMPXDbArtist::DecrementAlbumsForArtistL
       
   431 // ----------------------------------------------------------------------------
       
   432 //
       
   433 void CMPXDbArtist::DecrementAlbumsForArtistL(
       
   434     const TUint32 aId,
       
   435     TInt aDriveId,
       
   436     CMPXMessageArray* aItemChangedMessages
       
   437     )
       
   438     {
       
   439     MPX_FUNC("CMPXDbArtist::DecrementAlbumsForCategoryL");
       
   440     
       
   441     TInt songsCount(0);
       
   442     TInt albumsCount(0);
       
   443     
       
   444     GetSongsAndAlbumsCountL(aDriveId, aId, songsCount, albumsCount);
       
   445     
       
   446     MPX_DEBUG4("id %d, songsCount %d, albumsCount %d", aId, songsCount, albumsCount);
       
   447     
       
   448     // if just one album uses this category. Use <= just in case
       
   449     if (songsCount == 0 && albumsCount <= 1)
       
   450         {
       
   451         // delete the category
       
   452         DeleteCategoryL(aId, aDriveId);
       
   453 
       
   454         if (aItemChangedMessages)
       
   455             {
       
   456             // add the item changed message
       
   457             MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
       
   458                 iCategory, KDBPluginUid);
       
   459             }
       
   460         }
       
   461     else if (albumsCount > 0)
       
   462         {
       
   463         // decrement the number of albums for the category
       
   464         iDbManager.ExecuteQueryL(aDriveId, KQueryArtistDecrementAlbumCount, aId);
       
   465         }
       
   466     }
       
   467 
       
   468 // ----------------------------------------------------------------------------
       
   469 // CMPXDbArtist::GetSongsAndAlbumsCountL
       
   470 // ----------------------------------------------------------------------------
       
   471 //
       
   472 void CMPXDbArtist::GetSongsAndAlbumsCountL(
       
   473     TInt aDriveId,
       
   474     TUint32 aId, 
       
   475     TInt& aSongCount,
       
   476     TInt& aAlbumCount)
       
   477     {
       
   478     MPX_FUNC("CMPXDbArtist::GetSongsAndAlbumsCountL");
       
   479 
       
   480     RSqlStatement recordset(
       
   481         iDbManager.ExecuteSelectQueryL(aDriveId, KQueryArtistGetSongCountAndAlbumCount, aId));
       
   482     CleanupClosePushL(recordset);
       
   483 
       
   484     TInt err(KErrNone);
       
   485     while ((err = recordset.Next()) == KSqlAtRow)
       
   486         {
       
   487         aSongCount += recordset.ColumnInt(KMPXTableDefaultIndex);
       
   488         aAlbumCount += recordset.ColumnInt(KMPXTableDefaultIndex+1);
       
   489         }
       
   490 
       
   491     if (err != KSqlAtEnd)
       
   492         {
       
   493         User::Leave(err);
       
   494         }
       
   495 
       
   496     CleanupStack::PopAndDestroy(&recordset);
       
   497     }
       
   498 
       
   499 // ----------------------------------------------------------------------------
       
   500 // CMPXDbArtist::CreateTableL
       
   501 // ----------------------------------------------------------------------------
   348 // ----------------------------------------------------------------------------
   502 //
   349 //
   503 void CMPXDbArtist::CreateTableL(
   350 void CMPXDbArtist::CreateTableL(
   504     RSqlDatabase& aDatabase,
   351     RSqlDatabase& aDatabase,
   505     TBool /* aCorruptTable */)
   352     TBool /* aCorruptTable */)
   506     {
   353     {
   507     MPX_FUNC("CMPXDbArtist::CreateTableL");
   354     MPX_FUNC("CMPXDbCategory::CreateTableL");
   508 
   355 
   509     // create the table
   356     // create the table
   510     User::LeaveIfError(aDatabase.Exec(KArtistCreateTable));
   357     HBufC* query = PreProcessStringLC(KArtistCreateTable);
       
   358     User::LeaveIfError(aDatabase.Exec(*query));
       
   359     CleanupStack::PopAndDestroy(query);
   511 
   360 
   512     // do not create an index on the Name field
   361     // do not create an index on the Name field
   513     // as it only slows down the insert/update queries overall
   362     // as it only slows down the insert/update queries overall
   514     }
   363     }
   515 
   364 
   516 // ----------------------------------------------------------------------------
   365 // ----------------------------------------------------------------------------
   517 // CMPXDbArtist::CheckTableL
   366 // CMPXDbAlbum::CheckTableL
   518 // ----------------------------------------------------------------------------
   367 // ----------------------------------------------------------------------------
   519 //
   368 //
   520 TBool CMPXDbArtist::CheckTableL(
   369 TBool CMPXDbArtist::CheckTableL(
   521     RSqlDatabase& aDatabase)
   370     RSqlDatabase& aDatabase)
   522     {
   371     {
   523     MPX_FUNC("CMPXDbArtist::CheckTableL");
   372     MPX_FUNC("CMPXDbCategory::CheckTableL");
   524 
   373 
   525     TBool check(DoCheckTable(aDatabase, KArtistCheckTable));
   374     HBufC* query = PreProcessStringLC(KArtistCheckTable);
       
   375     TBool check(DoCheckTable(aDatabase, *query));
       
   376     CleanupStack::PopAndDestroy(query);
   526 
   377 
   527     return check;
   378     return check;
   528     }
   379     }
   529 
   380 
   530 // End of File
   381 // End of File