|
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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.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 @file |
|
20 @deprecated since v9.1. Functionality is replaced with commsdat. |
|
21 */ |
|
22 |
|
23 #ifndef CDBTEMP_H |
|
24 #define CDBTEMP_H |
|
25 |
|
26 #include <d32dbms.h> |
|
27 |
|
28 class CCommsDatabaseBase; |
|
29 class CCommsDbTableView; |
|
30 |
|
31 // Template view class. Uses a supplied `CCommsDatabase` and a |
|
32 // `CCommsDbTableView` to read and write template records. Created from |
|
33 // `CCommsDbTableView::ConstructL()` the recursion is stopped because the |
|
34 // template view NewL is called with aUseTemplate set to false. |
|
35 // internal "This class is poorly named it should be something like: |
|
36 // CCommDbTemplateView" |
|
37 class CCommsDbTemplateRecord : public CBase |
|
38 /** The view on a template record of a specific table. |
|
39 |
|
40 The view contains only the template record and therefore, unlike the more |
|
41 general CCommsDbTableView class, does not contain any navigation functions. |
|
42 |
|
43 This class does, however, contain the necessary member functions for reading |
|
44 and writing to columns. |
|
45 @publishedAll |
|
46 @released */ |
|
47 { |
|
48 public: |
|
49 /** Creates a new template view on the database and table specified. */ |
|
50 IMPORT_C static CCommsDbTemplateRecord* NewL(CCommsDatabaseBase* aDb,const TDesC& aTableName); |
|
51 IMPORT_C ~CCommsDbTemplateRecord(); |
|
52 |
|
53 /** Modifies the existing template record if there is no template create one. |
|
54 StoreModifications() is called to complete the transaction. */ |
|
55 IMPORT_C TInt Modify(); |
|
56 /** Removes the template from the table. */ |
|
57 IMPORT_C TInt Delete(); |
|
58 /** Stores an new or updated template back to the database. */ |
|
59 IMPORT_C TInt StoreModifications(); |
|
60 /** Cancels pending changes since `Modify()`. */ |
|
61 IMPORT_C void CancelModifications(); |
|
62 |
|
63 // Access data from the template |
|
64 IMPORT_C void ReadTextL(const TDesC& aColumn, TDes8& aValue); |
|
65 IMPORT_C void ReadTextL(const TDesC& aColumn, TDes16& aValue); |
|
66 IMPORT_C HBufC* ReadLongTextLC(const TDesC& aColumn); |
|
67 IMPORT_C void ReadUintL(const TDesC& aColumn, TUint32& aValue); |
|
68 IMPORT_C void ReadBoolL(const TDesC& aColumn, TBool& aValue); |
|
69 IMPORT_C void ReadTypeAttribL(const TDesC& aColumn, TDbColType& aColType, TUint32& aAttrib); |
|
70 IMPORT_C void ReadColumnLengthL(const TDesC& aColumn, TInt& aLength); |
|
71 |
|
72 // Modify a new or modified template. Must call `StoreModifications()` |
|
73 // to store the changes. |
|
74 IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC8& aValue); |
|
75 IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC16& aValue); |
|
76 IMPORT_C void WriteLongTextL(const TDesC& aColumn, const TDesC& aValue); |
|
77 IMPORT_C void WriteUintL(const TDesC& aColumn, const TUint32& aValue); |
|
78 IMPORT_C void WriteBoolL(const TDesC& aColumn, const TBool& aValue); |
|
79 |
|
80 /** The name of the table that this template belongs to. */ |
|
81 IMPORT_C void GetTableName(TDes& aTableName) const; |
|
82 |
|
83 /** True if a template exists. */ |
|
84 IMPORT_C TBool TemplateRecordExists(); |
|
85 |
|
86 // Create a new record based on the contents of the template record |
|
87 IMPORT_C TInt InsertCopy(TUint32& aId); |
|
88 private: |
|
89 CCommsDbTemplateRecord(); |
|
90 void ConstructL(CCommsDatabaseBase* aDb, const TDesC& aTableName); |
|
91 TInt Reposition(); |
|
92 |
|
93 // Enabling and Desabling client view on template record |
|
94 TBool SetHiddenMask(); |
|
95 void ClearHiddenMask(TBool aClearHiddenMask); |
|
96 private: |
|
97 CCommsDbTableView* iView; |
|
98 TBool iRecordExists; |
|
99 }; |
|
100 |
|
101 #endif |