epoc32/include/cdbtemp.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 cdbtemp.h
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // CommDb Template Record View
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @deprecated since v9.1. Functionality is replaced with commsdat.
       
    23 */
       
    24 
       
    25 #ifndef CDBTEMP_H
       
    26 #define CDBTEMP_H
       
    27 
       
    28 #include <d32dbms.h>
       
    29 
       
    30 class CCommsDatabaseBase;
       
    31 class CCommsDbTableView;
       
    32 
       
    33 // Template view class. Uses a supplied `CCommsDatabase` and a
       
    34 // `CCommsDbTableView` to read and write template records. Created from
       
    35 // `CCommsDbTableView::ConstructL()` the recursion	is stopped because the
       
    36 //	template view NewL is called with aUseTemplate set to false.
       
    37 //	internal "This class is poorly named it should be something like:
       
    38 //	CCommDbTemplateView"
       
    39 class CCommsDbTemplateRecord : public CBase
       
    40 /** The view on a template record of a specific table. 
       
    41 
       
    42 The view contains only the template record and therefore, unlike the more 
       
    43 general CCommsDbTableView class, does not contain any navigation functions.
       
    44 
       
    45 This class does, however, contain the necessary member functions for reading 
       
    46 and writing to columns.
       
    47 @publishedAll
       
    48 @released */
       
    49 	{
       
    50 public:
       
    51 	/** Creates a new template view on the database and table specified. */
       
    52 	IMPORT_C static CCommsDbTemplateRecord* NewL(CCommsDatabaseBase* aDb,const TDesC& aTableName);
       
    53 	IMPORT_C ~CCommsDbTemplateRecord();
       
    54 
       
    55 	/** Modifies the existing template record if there is no template create one.
       
    56 		StoreModifications() is called to complete the transaction. */
       
    57 	IMPORT_C TInt Modify();
       
    58 	/** Removes the template from the table. */
       
    59 	IMPORT_C TInt Delete();
       
    60 	/** Stores an new or updated template back to the database. */
       
    61 	IMPORT_C TInt StoreModifications();
       
    62 	/** Cancels pending changes since `Modify()`. */
       
    63 	IMPORT_C void CancelModifications();
       
    64 
       
    65 	// Access data from the template 
       
    66 	IMPORT_C void ReadTextL(const TDesC& aColumn, TDes8& aValue);
       
    67 	IMPORT_C void ReadTextL(const TDesC& aColumn, TDes16& aValue);
       
    68 	IMPORT_C HBufC* ReadLongTextLC(const TDesC& aColumn);
       
    69 	IMPORT_C void ReadUintL(const TDesC& aColumn, TUint32& aValue);
       
    70 	IMPORT_C void ReadBoolL(const TDesC& aColumn, TBool& aValue);
       
    71 	IMPORT_C void ReadTypeAttribL(const TDesC& aColumn, TDbColType& aColType, TUint32& aAttrib);
       
    72 	IMPORT_C void ReadColumnLengthL(const TDesC& aColumn, TInt& aLength);
       
    73 
       
    74 	// Modify a new or modified template. Must call `StoreModifications()`
       
    75 	// to store the changes. 
       
    76 	IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC8& aValue);
       
    77 	IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC16& aValue);
       
    78 	IMPORT_C void WriteLongTextL(const TDesC& aColumn, const TDesC& aValue);
       
    79 	IMPORT_C void WriteUintL(const TDesC& aColumn, const TUint32& aValue);
       
    80 	IMPORT_C void WriteBoolL(const TDesC& aColumn, const TBool& aValue);
       
    81 
       
    82 	/** The name of the table that this template belongs to. */
       
    83 	IMPORT_C void GetTableName(TDes& aTableName) const;
       
    84 
       
    85 	/** True if a template exists. */
       
    86 	IMPORT_C TBool TemplateRecordExists();
       
    87 	
       
    88 	// Create a new record based on the contents of the template record 
       
    89 	IMPORT_C TInt InsertCopy(TUint32& aId);
       
    90 private:
       
    91 	CCommsDbTemplateRecord();
       
    92 	void ConstructL(CCommsDatabaseBase* aDb, const TDesC& aTableName);
       
    93 	TInt Reposition();
       
    94 
       
    95     // Enabling and Desabling client view on template record
       
    96     TBool SetHiddenMask();
       
    97     void ClearHiddenMask(TBool aClearHiddenMask);
       
    98 private:
       
    99 	CCommsDbTableView* iView;
       
   100 	TBool iRecordExists;
       
   101 	};
       
   102 
       
   103 #endif