internetradio2.0/sessionloginc/irsessiondb.h
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2006-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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IRSESSIONDB_H
       
    20 #define IRSESSIONDB_H
       
    21 
       
    22 #include <d32dbms.h>
       
    23 
       
    24 class CIRSessionLogger;
       
    25 
       
    26 NONSHARABLE_CLASS(CIRSessionDb) : public CBase
       
    27 	{												
       
    28 										//member functions
       
    29 public:
       
    30 
       
    31 	/**
       
    32 	* Function : NewL()
       
    33 	* Two phased construction
       
    34 	* @return instance of CIRSessionDb
       
    35 	*/
       
    36 	static CIRSessionDb* NewL();
       
    37 	
       
    38 	/**
       
    39 	* Function : NewLC()
       
    40 	* Two phased construction
       
    41 	* @return instance of CIRSessionDb
       
    42 	*/	
       
    43 	static CIRSessionDb* NewLC();
       
    44 	
       
    45 	/**
       
    46 	* Function : ~CIRSessionDb()
       
    47 	* default destructor
       
    48 	*/	
       
    49 	~CIRSessionDb();
       
    50 
       
    51 	/**
       
    52 	* Function : CreateDbConditional()
       
    53 	* Creates both the dbms files conditionally(only if not yet created)
       
    54 	* @param session database file
       
    55 	* @return errcode
       
    56 	*/	
       
    57 	TInt CreateDbConditional(TFileName &aSession);
       
    58 
       
    59 	/**
       
    60 	* Function : AddSessionStartL()
       
    61 	* adds the session log entry into data base
       
    62 	* @param session data instance
       
    63 	*/
       
    64 	void AddSessionStartL(CIRSessionLogger& aSession);
       
    65 	
       
    66 	/**
       
    67 	* CIRSessionDb::GetAllPresetL()
       
    68 	* gets all the preset into an array 
       
    69 	*/
       
    70 	void GetAllSessionL(CArrayPtrFlat<CIRSessionLogger>& aSessionDataList);
       
    71 	
       
    72 	/**
       
    73 	* Function : DeleteAllSessionL
       
    74 	* delete all the session from session log entry
       
    75 	*/
       
    76 	void DeleteAllSessionL();
       
    77 
       
    78 private: 
       
    79 
       
    80 	/**
       
    81 	* Function : ConstructL()
       
    82 	* two phase construction
       
    83 	*/   
       
    84     void ConstructL();
       
    85     
       
    86     /**
       
    87 	* Function : CloseDb()
       
    88 	* Closes the database 
       
    89 	*/
       
    90 	void CloseDb();
       
    91 	
       
    92 	/**
       
    93 	* Function : CreateSessionTableL
       
    94 	* creates sessionlogtable with two column one is sessionid and rest of session
       
    95 	* log data
       
    96 	* ---------------------------------------------------------------------------
       
    97 	* SessionTable
       
    98 	*---------------------------
       
    99 	*| KID   |	 KSessionLogCol |
       
   100 	*---------------------------
       
   101 	*|TInt32 | EDbColLongText8 |
       
   102 	*---------------------------
       
   103 	*/	
       
   104     void CreateSessionTableL();
       
   105     
       
   106 	/**
       
   107 	* Function : CreateSessionIndexL
       
   108 	* sets sessionid as the primary key
       
   109 	*/  
       
   110     void CreateSessionIndexL();
       
   111     
       
   112 	/**
       
   113 	* Function : OpenDbL()
       
   114 	* opening the data base 
       
   115 	*/
       
   116 	void OpenDbL();
       
   117 	
       
   118 	/**
       
   119 	* Function : CreateDbL()
       
   120 	* creates both the dbms files 
       
   121 	* database filename
       
   122 	*/	
       
   123 	void CreateDbL(TFileName& aSession);
       
   124 
       
   125 										//data members
       
   126 										
       
   127 private:
       
   128 
       
   129 	/**
       
   130 	* database file
       
   131 	*/
       
   132 	TFileName iDbFile;
       
   133 	
       
   134 	/**
       
   135 	* file session
       
   136 	*/
       
   137     RFs iFsSession;
       
   138     
       
   139 	/**
       
   140 	* data base handler
       
   141 	*/
       
   142     RDbNamedDatabase iSessionDb;
       
   143     
       
   144     };
       
   145 
       
   146 #endif  //IRSESSIONDB_H
       
   147 
       
   148 
       
   149 
       
   150 
       
   151 
       
   152 
       
   153 
       
   154