upnpharvester/common/cmsqlwrapper/inc/cmsqldbmaintenance.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2008 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:      SQL database maintenance class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef C_CMSQLDBMAINTENANCE_H
       
    25 #define C_CMSQLDBMAINTENANCE_H
       
    26 
       
    27 #include <e32base.h>
       
    28 
       
    29 // Forward declarations
       
    30 class CCmSqlConnection;
       
    31 
       
    32 /**
       
    33  *  CCmSqlDbMaintenance class
       
    34  *  Part of SQL wrapper. SQL wrapper is part of
       
    35  *  Content manager component.CCmSqlDbMaintenance creates needed
       
    36  *  database tables and initializes connenction to the database
       
    37  *
       
    38  *  @lib cmsqlwrapper.lib
       
    39  *
       
    40  *  @since S60 v3.1
       
    41  */
       
    42 class CCmSqlDbMaintenance : public CBase
       
    43     {
       
    44 
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Two-phased constructor.
       
    49      */
       
    50     static CCmSqlDbMaintenance* NewL();
       
    51     
       
    52     /**
       
    53      * Two-phased constructor.
       
    54      */
       
    55     static CCmSqlDbMaintenance* NewLC();
       
    56 
       
    57     /**
       
    58      * Destructor.
       
    59      */
       
    60     virtual ~CCmSqlDbMaintenance();    
       
    61     
       
    62     /**
       
    63      * Initializes database connection
       
    64      *
       
    65      * @since S60 5.1
       
    66      * @param aConnection, reference to connection class
       
    67      * @return Error code
       
    68      */    
       
    69     TInt InitConnection( CCmSqlConnection& aConnection );
       
    70 
       
    71     /**
       
    72      * Closes database connection
       
    73      *
       
    74      * @since S60 5.1
       
    75      * @param aConnection, reference to connection class
       
    76      * @return None
       
    77      */        
       
    78     void CloseConnection( CCmSqlConnection& aConnection );
       
    79 
       
    80     /**
       
    81      * Creates db file
       
    82      *
       
    83      * @since S60 5.1
       
    84      * @param aConnection, reference to connection class
       
    85      * @return Error code
       
    86      */  
       
    87     TInt CreateDbFile( CCmSqlConnection& aConnection );    
       
    88     
       
    89     /**
       
    90      * Creates database tables
       
    91      *
       
    92      * @since S60 5.1
       
    93      * @param aConnection, reference to connection class
       
    94      * @return None
       
    95      */        
       
    96     void CreateDb( CCmSqlConnection& aConnection );
       
    97 
       
    98     /**
       
    99      * Creates database indexes
       
   100      *
       
   101      * @since S60 5.1
       
   102      * @param aConnection, reference to connection class
       
   103      * @return None
       
   104      */        
       
   105     void CreateIndexes( CCmSqlConnection& aConnection );
       
   106 
       
   107 private:
       
   108 
       
   109     /**
       
   110      * Performs the first phase of two phase construction.
       
   111      */
       
   112     CCmSqlDbMaintenance();
       
   113 
       
   114     /**
       
   115      * Performs the second phase construction.
       
   116      */
       
   117     void ConstructL();
       
   118     
       
   119 
       
   120 private: // data
       
   121 
       
   122     };
       
   123 
       
   124 #endif //  C_CMSQLDBMAINTENANCE_H