mmappcomponents/harvester/filehandler/inc/mpxharvesterdb.h
branchRCL_3
changeset 9 bee149131e4b
parent 0 a2952bb97e68
child 40 4a1905d205a2
equal deleted inserted replaced
4:d45095c2f4f3 9:bee149131e4b
    22 #include <d32dbms.h>
    22 #include <d32dbms.h>
    23 #include <s32file.h>
    23 #include <s32file.h>
    24 
    24 
    25 // FORWARD DECLARATIONS
    25 // FORWARD DECLARATIONS
    26 class CMPXHarvesterDatabaseTable;
    26 class CMPXHarvesterDatabaseTable;
       
    27 
       
    28 // ENUMS
       
    29 #ifdef __RAMDISK_PERF_ENABLE
       
    30 // enum for database state
       
    31 enum TDbState
       
    32     {
       
    33     EDbClose,
       
    34     EDbOpen,
       
    35     EDbInTransaction
       
    36     };
       
    37 #endif // __RAMDISK_PERF_ENABLE
    27 
    38 
    28 /**
    39 /**
    29  *  Database class for the Harvester Component
    40  *  Database class for the Harvester Component
    30  *
    41  *
    31  *  @lib mpxfilehandler.lib
    42  *  @lib mpxfilehandler.lib
    49     */
    60     */
    50     virtual ~CMPXHarvesterDB();
    61     virtual ~CMPXHarvesterDB();
    51 
    62 
    52     /**
    63     /**
    53     * Open the database
    64     * Open the database
       
    65     * @return State of the opened database: KErrNone or KErrCorrupt
       
    66     * Leaves if cannot open the database
    54     */
    67     */
    55     TInt OpenL();
    68     TInt OpenL();
    56 
    69 
    57     /**
    70     /**
    58     * Close the database
    71     * Close the database
   139     /**
   152     /**
   140     * Rollbacks the current transaction
   153     * Rollbacks the current transaction
   141     */
   154     */
   142     void Rollback();
   155     void Rollback();
   143     
   156     
       
   157 #ifdef __RAMDISK_PERF_ENABLE
       
   158     /**
       
   159      * Set RAM drive info
       
   160      */
       
   161     void SetRamDriveInfo(TDriveNumber aDrive, TBool aUseRamDrive);
       
   162     
       
   163     /**
       
   164      * Get UseRamDrive
       
   165      */
       
   166     TBool IsUseRamDrive();
       
   167     
       
   168     /**
       
   169      * Get the state of the database.
       
   170      */
       
   171     TDbState GetDbState();
       
   172     
       
   173     /**
       
   174      * Set the state of the database.
       
   175      */
       
   176     void SetDbStateL( TDbState aState );
       
   177 #endif // __RAMDISK_PERF_ENABLE
   144     
   178     
   145 private: // private functions
   179 private: // private functions
   146 
   180 
   147     /**
   181     /**
   148     * Create a database
   182     * Create a database
   149     */
   183     */
   150     void CreateDBL();
   184     void CreateDBL();
   151 
   185 
   152     /**
   186     /**
   153     * Opens a database
   187     * Opens a database
   154     * @return error for the operation
   188     * @return State of the opened database: KErrNone or KErrCorrupt
       
   189     * Leaves if cannot open the database
   155     */
   190     */
   156     TInt OpenDBL();
   191     TInt OpenDBL();
   157 
   192 
   158     /**
   193     /**
   159     * Replace quotes
   194     * Replace quotes
   161     * @param aTrg destination
   196     * @param aTrg destination
   162     */
   197     */
   163     void FindAndReplaceSingleQuote(const TDesC& aSrc,
   198     void FindAndReplaceSingleQuote(const TDesC& aSrc,
   164                                    TDes& aTrg);
   199                                    TDes& aTrg);
   165 
   200 
       
   201     /**
       
   202      * Generate the database name.
       
   203      * @return the database file name.
       
   204      */
       
   205     TFileName GenerateDbName();
       
   206     
   166 private:
   207 private:
   167 
   208 
   168     /**
   209     /**
   169     * Default constructor
   210     * Default constructor
   170     */
   211     */
   180     RFs&              iFs;
   221     RFs&              iFs;
   181     // Internal database
   222     // Internal database
   182     CFileStore*       iStore;
   223     CFileStore*       iStore;
   183     RDbStoreDatabase* iDatabase;  // Local single client db
   224     RDbStoreDatabase* iDatabase;  // Local single client db
   184     TBool             iDBOpen;    // Is the db open and ready
   225     TBool             iDBOpen;    // Is the db open and ready
       
   226 #ifdef __RAMDISK_PERF_ENABLE
       
   227     TDriveNumber      iRamDrive;
       
   228     TBool             iUseRamDrive;
       
   229 #endif // __RAMDISK_PERF_ENABLE
   185     };
   230     };
   186 
   231 
   187 #endif // CMPXHARVESTERDB_H
   232 #endif // CMPXHARVESTERDB_H