mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxdbauxiliary.h
changeset 0 ff3acec5bc43
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:  This class is responsible for interacting with the Auxiliary
       
    15 *                table.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef MPXDBAUXILIARY_H
       
    21 #define MPXDBAUXILIARY_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "mpxdbtable.h"
       
    25 
       
    26 // CLASS DECLARATION
       
    27 
       
    28 /**
       
    29 * Responsible for managing the playlist tables
       
    30 *
       
    31 * @lib mpxpodcastdbplugin.lib
       
    32 */
       
    33 class CMPXDbAuxiliary :
       
    34     public CMPXDbTable
       
    35     {
       
    36     public:
       
    37 
       
    38         /**
       
    39         * Two-phased constructor.
       
    40         * @param aDbManager database manager to use for database interactions
       
    41         * @return New CMPXDbManager instance.
       
    42         */
       
    43         static CMPXDbAuxiliary* NewL(CMPXDbManager& aDbManager);
       
    44 
       
    45         /**
       
    46         * Two-phased constructor.
       
    47         * @param aDbManager database manager to use for database interactions
       
    48         * @return New CMPXDbManager instance on the cleanup stack.
       
    49         */
       
    50         static CMPXDbAuxiliary* NewLC(CMPXDbManager& aDbManager);
       
    51 
       
    52         /**
       
    53         * Destructor
       
    54         */
       
    55         virtual ~CMPXDbAuxiliary();
       
    56 
       
    57     public:
       
    58 
       
    59         /**
       
    60         * Sets the last refreshed time in the auxiliary table.
       
    61         * @param aTime the last refreshed time value
       
    62         */
       
    63         void SetLastRefreshedTimeL(TTime aTime);
       
    64 
       
    65         /**
       
    66         * Gets the last refreshed time from the auxiliary table.
       
    67         * @return last refreshed time value
       
    68         */
       
    69         TTime LastRefreshedTimeL();
       
    70 
       
    71         /**
       
    72         * Sets the db corrupted flag in the auxiliary table.
       
    73         * @param aCorrupted db corrupted flag value
       
    74         */
       
    75         void SetDBCorruptedL(TBool aCorrupted);
       
    76 
       
    77         /**
       
    78         * Gets the db corrupted flag value from the auxiliary table.
       
    79         * @return db corrupted flag value
       
    80         */
       
    81         TBool DBCorruptedL();
       
    82 
       
    83         /**
       
    84          * Sets the save deleted record count value.
       
    85          * @param aDrive drive identifier
       
    86          * @param aValue new field value
       
    87          *
       
    88          */
       
    89          void SetSaveDeletedRecordCountL(TInt aDrive,TUint32 aValue);
       
    90 
       
    91         /**
       
    92         * Gets the save deleted record count field value.
       
    93         * @return field value
       
    94         */
       
    95         TUint32 SaveDeletedRecordCountL();
       
    96 
       
    97         /**
       
    98          * Gets the save deleted record count field value.
       
    99          * @param aDrive drive identifier
       
   100          * @return field value
       
   101          */
       
   102          TUint32 SaveDeletedRecordCountL(TInt aDrive);
       
   103 
       
   104         /**
       
   105         * Checks if all databases have been refreshed.
       
   106         * @return EFalse if at least one database has not been refreshed.
       
   107         */
       
   108         TBool IsRefreshedL();
       
   109 
       
   110         /**
       
   111         * Get the auxilary id for a drive
       
   112         * @param aDrive drive to get the volume id
       
   113         * @return TInt id for the aux database
       
   114         */
       
   115         TInt IdL( TInt aDrive );
       
   116 
       
   117         /**
       
   118         * Set the auxilary id for a drive
       
   119         * @param aDrive,
       
   120         * @param aId
       
   121         */
       
   122         void SetIdL( TInt aDrive, TInt aId );
       
   123 
       
   124     private:    // from MMPXTable
       
   125 
       
   126         /**
       
   127         * @see MMPXTable
       
   128         */
       
   129         virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
       
   130 
       
   131         /**
       
   132         * @see MMPXTable
       
   133         */
       
   134         virtual void DropTableL(RSqlDatabase& aDatabase);
       
   135 
       
   136         /**
       
   137         * @see MMPXTable
       
   138         */
       
   139         virtual TBool CheckTableL(RSqlDatabase& aDatabase);
       
   140 
       
   141     private:
       
   142 
       
   143         /**
       
   144         * C++ constructor
       
   145         * @param aDbManager database manager to use for database interactions
       
   146         */
       
   147         CMPXDbAuxiliary(CMPXDbManager& aDbManager);
       
   148 
       
   149         /**
       
   150         * Safely construct things that can leave
       
   151         */
       
   152         void ConstructL();
       
   153 
       
   154     private:
       
   155 
       
   156         /**
       
   157         * Column indexes in the auxiliary table
       
   158         */
       
   159         enum TAuxiliaryColumns
       
   160             {
       
   161             EAuxiliaryId = KMPXTableDefaultIndex,
       
   162             EAuxiliaryVersion,
       
   163             EAuxiliaryTimeRefreshed,
       
   164             EAuxiliaryTimeSynced,
       
   165             EAuxiliaryCorrupt,
       
   166             EAuxiliarySavedDeletedRecordCount
       
   167             };
       
   168 
       
   169     };
       
   170 
       
   171 #endif // MPXDBAUXILIARY_H
       
   172 
       
   173 // End of File