williamr@2
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
// Comms Database public interface
|
williamr@2
|
15 |
//
|
williamr@2
|
16 |
//
|
williamr@2
|
17 |
|
williamr@2
|
18 |
/**
|
williamr@2
|
19 |
@file
|
williamr@2
|
20 |
@deprecated since v9.1. Functionality is replaced with commsdat.
|
williamr@2
|
21 |
*/
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#ifndef COMMDB_H
|
williamr@2
|
24 |
#define COMMDB_H
|
williamr@2
|
25 |
|
williamr@2
|
26 |
#include <d32dbms.h>
|
williamr@2
|
27 |
#include <metadatabase.h>
|
williamr@2
|
28 |
|
williamr@2
|
29 |
using namespace CommsDat;
|
williamr@2
|
30 |
|
williamr@2
|
31 |
#include <dial.h>
|
williamr@2
|
32 |
#include <cdbcols.h>
|
williamr@2
|
33 |
#include <cdblen.h>
|
williamr@2
|
34 |
|
williamr@2
|
35 |
/**
|
williamr@2
|
36 |
Protection of settings: when the entire table is protected, write operations
|
williamr@2
|
37 |
fail with KErrWrite. However KErrAccessDenied should be returned to client
|
williamr@2
|
38 |
@internalComponent
|
williamr@2
|
39 |
*/
|
williamr@2
|
40 |
#define TRAPD_CONVERT(_r,_s) TRAPD(_r,_s); if(ret == KErrWrite) ret = KErrAccessDenied;
|
williamr@2
|
41 |
/**
|
williamr@2
|
42 |
@internalComponent
|
williamr@2
|
43 |
*/
|
williamr@2
|
44 |
#define TRAP_CONVERT(_r,_s) TRAP(_r,_s); if(ret == KErrWrite) ret = KErrAccessDenied;
|
williamr@2
|
45 |
|
williamr@2
|
46 |
class CCommsDbTableView;
|
williamr@2
|
47 |
class CCommsDbConnectionPrefTableView;
|
williamr@2
|
48 |
class CCommDbTableExtension;
|
williamr@2
|
49 |
class CCommsDatabaseImpl;
|
williamr@2
|
50 |
|
williamr@2
|
51 |
class CCommsDatabaseBase : public CBase
|
williamr@2
|
52 |
/** Base class for CCommsDatabase.
|
williamr@2
|
53 |
|
williamr@2
|
54 |
This class is never instantiated, but its member functions are used through
|
williamr@2
|
55 |
the derived class.
|
williamr@2
|
56 |
|
williamr@2
|
57 |
Responsible for Transactions, Notifications, Write protection, Hidden
|
williamr@2
|
58 |
records, Phone number resolution and Creating views. Stores the database, the
|
williamr@2
|
59 |
session, transaction and notifier information.
|
williamr@2
|
60 |
|
williamr@2
|
61 |
CCommsDatabaseBase is an abstract base class as the CreateDatabaseL() and
|
williamr@2
|
62 |
Open() methods are pure virtual.
|
williamr@2
|
63 |
@publishedAll
|
williamr@2
|
64 |
@released */
|
williamr@2
|
65 |
{
|
williamr@2
|
66 |
public:
|
williamr@2
|
67 |
// These classes added as friends for commdb shim
|
williamr@2
|
68 |
friend class CCommsDbTableView;
|
williamr@2
|
69 |
friend class CCommsDbConnectionPrefTableView;
|
williamr@2
|
70 |
friend class CCommsDbProtectTableView;
|
williamr@2
|
71 |
friend class CCommsDbProtectConnectPrefTableView;
|
williamr@2
|
72 |
friend class CCommsDbTemplateRecord;
|
williamr@2
|
73 |
public:
|
williamr@2
|
74 |
IMPORT_C virtual ~CCommsDatabaseBase();
|
williamr@2
|
75 |
|
williamr@2
|
76 |
// Returns the version of the database server.
|
williamr@2
|
77 |
IMPORT_C TVersion Version() const;
|
williamr@2
|
78 |
// Begin a transaction. Call before `InsertRecord()` or `UpdateRecord()`.
|
williamr@2
|
79 |
IMPORT_C TInt BeginTransaction();
|
williamr@2
|
80 |
// End a transaction. Call after `InsertRecord()` or `UpdateRecord()`.
|
williamr@2
|
81 |
IMPORT_C TInt CommitTransaction();
|
williamr@2
|
82 |
// Cancel a transaction.
|
williamr@2
|
83 |
IMPORT_C void RollbackTransaction();
|
williamr@2
|
84 |
// True if BeginTransaction() has been called but not
|
williamr@2
|
85 |
// `CommitTransaction()` or `RollbackTransaction()`.
|
williamr@2
|
86 |
IMPORT_C TBool InTransaction();
|
williamr@2
|
87 |
// True if the database has been locked.
|
williamr@2
|
88 |
IMPORT_C TBool IsDatabaseWriteLockedL();
|
williamr@2
|
89 |
|
williamr@2
|
90 |
// Enable a notification event on any change to the database.
|
williamr@2
|
91 |
IMPORT_C TInt RequestNotification(TRequestStatus& aStatus);
|
williamr@2
|
92 |
// Cancels notifications.
|
williamr@2
|
93 |
IMPORT_C void CancelRequestNotification();
|
williamr@2
|
94 |
|
williamr@2
|
95 |
// Obtain a view of all records in a table.
|
williamr@2
|
96 |
IMPORT_C CCommsDbTableView* OpenTableLC(const TDesC& aTableName);
|
williamr@2
|
97 |
// Obtain a view of the records in a table that match the query.
|
williamr@2
|
98 |
IMPORT_C CCommsDbTableView* OpenViewLC(const TDesC& aTableName, const TDesC& aSqlQuery);
|
williamr@2
|
99 |
// Obtain a view of all the records in a table for which the field
|
williamr@2
|
100 |
// `aColumnToMatch` matches `aValueToMatch`.
|
williamr@2
|
101 |
IMPORT_C CCommsDbTableView* OpenViewMatchingUintLC(const TDesC& aTableName, const TDesC& aColumnToMatch, TUint32 aValueToMatch);
|
williamr@2
|
102 |
IMPORT_C CCommsDbTableView* OpenViewMatchingBoolLC(const TDesC& aTableName, const TDesC& aColumnToMatch, TBool aValueToMatch);
|
williamr@2
|
103 |
IMPORT_C CCommsDbTableView* OpenViewMatchingTextLC(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC8& aValueToMatch);
|
williamr@2
|
104 |
IMPORT_C CCommsDbTableView* OpenViewMatchingTextLC(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC16& aValueToMatch);
|
williamr@2
|
105 |
|
williamr@2
|
106 |
// Make hidden records visible
|
williamr@2
|
107 |
IMPORT_C void ShowHiddenRecords();
|
williamr@2
|
108 |
|
williamr@2
|
109 |
// Set `aDialString` to be the appropriate string based on the directory
|
williamr@2
|
110 |
// number, where the dial is being performed and the chargecard to use.
|
williamr@2
|
111 |
// `ResolvePhoneNumberL()` opens a comms database to perform the
|
williamr@2
|
112 |
// resolution
|
williamr@2
|
113 |
IMPORT_C static void ResolvePhoneNumberL(TDesC& aNumber, TDes& aDialString, TParseMode aDialParseMode, TUint32 aLocationId, TUint32 aChargecardId);
|
williamr@2
|
114 |
// Set `aDialString` to be the appropriate string based on the directory
|
williamr@2
|
115 |
// number, where the dial is being performed and the chargecard to use.
|
williamr@2
|
116 |
IMPORT_C void ResolvePhoneNumberFromDatabaseL(TDesC& aNumber, TDes& aDialString, TParseMode aDialParseMode, TUint32 aLocationId, TUint32 aChargecardId);
|
williamr@2
|
117 |
IMPORT_C static TInt InitializeFilestore();
|
williamr@2
|
118 |
|
williamr@2
|
119 |
// Check access to database fields
|
williamr@2
|
120 |
IMPORT_C TInt CheckReadCapability( const TDesC& aField, const RMessagePtr2* aMessage );
|
williamr@2
|
121 |
IMPORT_C TInt CheckWriteCapability( const TDesC& aField, const RMessagePtr2* aMessage );
|
williamr@2
|
122 |
|
williamr@2
|
123 |
protected:
|
williamr@2
|
124 |
// internal
|
williamr@2
|
125 |
// Please note that as of v9.0 TCommDbSystemAgentNotification now actually contains
|
williamr@2
|
126 |
// the notification information for the Publish and Subscribe notifications, not
|
williamr@2
|
127 |
// for System Agent notifications.
|
williamr@2
|
128 |
class TCommDbSystemAgentNotification
|
williamr@2
|
129 |
/**
|
williamr@2
|
130 |
@publishedAll
|
williamr@2
|
131 |
@deprecated
|
williamr@2
|
132 |
*/
|
williamr@2
|
133 |
{
|
williamr@2
|
134 |
public:
|
williamr@2
|
135 |
TCommDbSystemAgentNotification();
|
williamr@2
|
136 |
void Set(TUid aUid, TInt aVal);
|
williamr@2
|
137 |
public:
|
williamr@2
|
138 |
TUid iUid;
|
williamr@2
|
139 |
TInt iValue;
|
williamr@2
|
140 |
};
|
williamr@2
|
141 |
|
williamr@2
|
142 |
class TCommDbPublishSubscribeNotification
|
williamr@2
|
143 |
/**
|
williamr@2
|
144 |
@internalComponent
|
williamr@2
|
145 |
@released
|
williamr@2
|
146 |
*/
|
williamr@2
|
147 |
{
|
williamr@2
|
148 |
public:
|
williamr@2
|
149 |
TCommDbPublishSubscribeNotification();
|
williamr@2
|
150 |
void Set(TUid aUid, TInt aVal);
|
williamr@2
|
151 |
public:
|
williamr@2
|
152 |
TUid iUid;
|
williamr@2
|
153 |
TInt iValue;
|
williamr@2
|
154 |
};
|
williamr@2
|
155 |
|
williamr@2
|
156 |
protected:
|
williamr@2
|
157 |
// internal
|
williamr@2
|
158 |
IMPORT_C CCommsDatabaseBase();
|
williamr@2
|
159 |
// internal
|
williamr@2
|
160 |
virtual void CreateDatabaseL() =0;
|
williamr@2
|
161 |
//
|
williamr@2
|
162 |
void DoClose();
|
williamr@2
|
163 |
CCommsDbTableView* DoOpenViewMatchingUintL(const TDesC& aTableName, const TDesC& aColumnToMatch, TUint32 aValueToMatch, TBool aIncludeHiddenRecords);
|
williamr@2
|
164 |
CCommsDbTableView* DoOpenViewMatchingTextL(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC8& aValueToMatch, TBool aIncludeHiddenRecords);
|
williamr@2
|
165 |
CCommsDbTableView* DoOpenViewMatchingTextL(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC16& aValueToMatch, TBool aIncludeHiddenRecords);
|
williamr@2
|
166 |
CCommsDbTableView* DoOpenTableViewL(const TDesC& aTableName, const TDesC& aSqlQuery);
|
williamr@2
|
167 |
CCommsDbTableView* DoOpenIAPTableViewL(const TDesC& aTableName,const TDesC& aSqlQuery);
|
williamr@2
|
168 |
//
|
williamr@2
|
169 |
void PopulateDialLocationL(TUint32 aId, TDialLocation& aLocation);
|
williamr@2
|
170 |
void PopulateChargeCardL(TUint32 aId, TChargeCard& aChargeCard);
|
williamr@2
|
171 |
void BeginInternalTransactionL();
|
williamr@2
|
172 |
TInt CommitInternalTransaction();
|
williamr@2
|
173 |
void RollbackInternalTransaction();
|
williamr@2
|
174 |
void DatabaseUpdateHasOccurred();
|
williamr@2
|
175 |
void NotifyChangeL(const TDesC& aSetting, TUint32 aVal);
|
williamr@2
|
176 |
TInt NotifyAllChanges();
|
williamr@2
|
177 |
|
williamr@2
|
178 |
TUint32 GetNewNumber(TUid aUid);
|
williamr@2
|
179 |
TInt CheckDBCapability( RDbs::TPolicyType aType, const TDesC& aField, const RMessagePtr2* aMessage );
|
williamr@2
|
180 |
void ConvertToUid(const TDesC& aSetting, TUint32 aVal, TCommDbPublishSubscribeNotification& aNotification);
|
williamr@2
|
181 |
|
williamr@2
|
182 |
inline RDbNamedDatabase* Database();
|
williamr@2
|
183 |
protected:
|
williamr@2
|
184 |
//internal
|
williamr@2
|
185 |
CCommsDatabaseImpl* iImpl;
|
williamr@2
|
186 |
RDbNamedDatabase iDatabase;
|
williamr@2
|
187 |
RDbNotifier iNotifier;
|
williamr@2
|
188 |
// store container data for deletion after session is finished
|
williamr@2
|
189 |
//RPointerArray<CMDBElement> iTransactionCache;
|
williamr@2
|
190 |
|
williamr@2
|
191 |
TInt iNotifierOpenError;
|
williamr@2
|
192 |
TBool iShowHiddenRecords;
|
williamr@2
|
193 |
TBool iImplNotCreated;
|
williamr@2
|
194 |
TBool iInInternalTransaction;
|
williamr@2
|
195 |
|
williamr@2
|
196 |
RArray<TCommDbPublishSubscribeNotification> iNotifications;
|
williamr@2
|
197 |
private:
|
williamr@2
|
198 |
// Check access to database fields
|
williamr@2
|
199 |
TInt DoCheckReadCapabilityL( const TDesC& aField, const RMessagePtr2* aMessage );
|
williamr@2
|
200 |
TInt DoCheckWriteCapabilityL( const TDesC& aField, const RMessagePtr2* aMessage );
|
williamr@2
|
201 |
|
williamr@2
|
202 |
TBool ConvertTableName(const TDesC& aTableName, TDes& aResult);
|
williamr@2
|
203 |
};
|
williamr@2
|
204 |
|
williamr@2
|
205 |
class CCommsDatabase : public CCommsDatabaseBase
|
williamr@2
|
206 |
/**
|
williamr@2
|
207 |
Accesses the communications database through the DBMS.
|
williamr@2
|
208 |
|
williamr@2
|
209 |
An object of this type must be constructed and opened by a client before any
|
williamr@2
|
210 |
of the tables in the database can be accessed, e.g. to create views and access
|
williamr@2
|
211 |
template records.
|
williamr@2
|
212 |
|
williamr@2
|
213 |
Implements the pure virtual functions CreateDatabaseL() and DoOpen().
|
williamr@2
|
214 |
Responsible for Global settings and Connection Preferences. Has utility
|
williamr@2
|
215 |
functions for accessing Global and Agent tables. No additional state (to
|
williamr@2
|
216 |
CCommsDatabaseBase) is stored.
|
williamr@2
|
217 |
@publishedAll
|
williamr@2
|
218 |
@released */
|
williamr@2
|
219 |
{
|
williamr@2
|
220 |
public:
|
williamr@2
|
221 |
IMPORT_C static CCommsDatabase* NewL();
|
williamr@2
|
222 |
IMPORT_C static CCommsDatabase* NewL(TBool aUseDefaultDb);
|
williamr@2
|
223 |
IMPORT_C static CCommsDatabase* NewL(TCommDbOpeningMethod &aOpeningMethod);
|
williamr@2
|
224 |
IMPORT_C virtual ~CCommsDatabase();
|
williamr@2
|
225 |
IMPORT_C void GetGlobalSettingL(const TDesC& aSetting, TUint32& aValue);
|
williamr@2
|
226 |
IMPORT_C void GetGlobalSettingL(const TDesC& aSetting, TDes& aValue);
|
williamr@2
|
227 |
IMPORT_C void SetGlobalSettingL(const TDesC& aSetting, TUint32 aValue);
|
williamr@2
|
228 |
IMPORT_C void SetGlobalSettingL(const TDesC& aSetting, const TDesC& aValue);
|
williamr@2
|
229 |
IMPORT_C void ClearGlobalSettingL(const TDesC& aSetting);
|
williamr@2
|
230 |
IMPORT_C void GetDefaultTsyL(TDes& aValue);
|
williamr@2
|
231 |
|
williamr@2
|
232 |
// Deprecated. Past use: Gets settings (Modem, Chargecard, and Service) for the dial out IAP.
|
williamr@2
|
233 |
IMPORT_C void GetCurrentDialOutSettingL(const TDesC& aSetting, TUint32& aValue);
|
williamr@2
|
234 |
// Deprecated. Past use: Retrieve settings for the dial in IAP.
|
williamr@2
|
235 |
IMPORT_C void GetCurrentDialInSettingL(const TDesC& aSetting, TUint32& aValue);
|
williamr@2
|
236 |
// Open a connection preference view.
|
williamr@2
|
237 |
IMPORT_C CCommsDbConnectionPrefTableView* OpenConnectionPrefTableLC();
|
williamr@2
|
238 |
// Open a connection preference view containing connections of the
|
williamr@2
|
239 |
// specified direction.
|
williamr@2
|
240 |
IMPORT_C CCommsDbConnectionPrefTableView* OpenConnectionPrefTableLC(TCommDbConnectionDirection aDirection);
|
williamr@2
|
241 |
// Open a connection preference view containing connections of the
|
williamr@2
|
242 |
// specified direction excluding connections of rank zero.
|
williamr@2
|
243 |
IMPORT_C CCommsDbConnectionPrefTableView* OpenConnectionPrefTableInRankOrderLC(TCommDbConnectionDirection aDirection);
|
williamr@2
|
244 |
// Open a connection preference view containing connections of the
|
williamr@2
|
245 |
// specified direction and rank.
|
williamr@2
|
246 |
IMPORT_C CCommsDbConnectionPrefTableView* OpenConnectionPrefTableViewOnRankLC(TCommDbConnectionDirection aDirection, TUint32 aRank);
|
williamr@2
|
247 |
|
williamr@2
|
248 |
//DEPRECATED : Agent table has been removed. These functions have been
|
williamr@2
|
249 |
// stubbed to return KErrNotSupported or leave with the same error.
|
williamr@2
|
250 |
// Access agent settings. `aService` is one of: (`DIAL_OUT_ISP`,
|
williamr@4
|
251 |
// `DIAL_IN_ISP`, `OUTGOING_WCDMA'). */
|
williamr@2
|
252 |
IMPORT_C void SetAgentL(const TDesC& aService, const TDesC& aAgent);
|
williamr@2
|
253 |
|
williamr@2
|
254 |
IMPORT_C void SetAgentExtL(const TDesC& aService, const TDesC& aAgentExt);
|
williamr@2
|
255 |
IMPORT_C void GetAgentL(const TDesC& aService, TDes& aAgent);
|
williamr@2
|
256 |
IMPORT_C void GetAgentExtL(const TDesC& aService, TDes& aAgentExt);
|
williamr@2
|
257 |
IMPORT_C void ClearAgentAndExtL(const TDesC& aService);
|
williamr@2
|
258 |
IMPORT_C void SetAgentClientTimeoutL(const TDesC& aService, TInt aClientTimeout);
|
williamr@2
|
259 |
IMPORT_C void SetAgentRouteTimeoutL(const TDesC& aService, TInt aRouteTimeout);
|
williamr@2
|
260 |
IMPORT_C TInt GetAgentClientTimeoutL(const TDesC& aService);
|
williamr@2
|
261 |
IMPORT_C TInt GetAgentRouteTimeoutL(const TDesC& aService);
|
williamr@2
|
262 |
|
williamr@2
|
263 |
/** Open a view on the IAP table containing records that match the
|
williamr@2
|
264 |
bearers and direction specified. `aBearerSet` is a bit mask of type
|
williamr@2
|
265 |
`TCommDbBearer`. */
|
williamr@2
|
266 |
IMPORT_C CCommsDbTableView* OpenIAPTableViewMatchingBearerSetLC(TUint32 aBearerSet, TCommDbConnectionDirection aDirection);
|
williamr@2
|
267 |
|
williamr@2
|
268 |
/** Open a viewon the IAP table containing records which match the specified network */
|
williamr@2
|
269 |
IMPORT_C CCommsDbTableView* OpenIAPTableViewMatchingNetworkLC(TUint32 aNetwork);
|
williamr@2
|
270 |
|
williamr@2
|
271 |
// Open a view on the proxy table containing records that match the
|
williamr@2
|
272 |
// service id and type specified.
|
williamr@2
|
273 |
IMPORT_C CCommsDbTableView* OpenViewOnProxyRecordLC(TUint32 aServiceId, const TDesC& aServiceType);
|
williamr@2
|
274 |
|
williamr@2
|
275 |
// Functionality re-implemented to facilitate BC with 6.1
|
williamr@2
|
276 |
IMPORT_C static CCommsDatabase* NewL(TCommDbDatabaseType aDbType);
|
williamr@2
|
277 |
// Creates a `CCommsDatabase` as with `NewL()`. The method of opening:
|
williamr@2
|
278 |
// (Created, CopiedDefault or Opened) is returned in `aOpeningMethod`.
|
williamr@2
|
279 |
IMPORT_C static CCommsDatabase* NewL(TCommDbDatabaseType aDbType, TCommDbOpeningMethod &aOpeningMethod);
|
williamr@2
|
280 |
|
williamr@2
|
281 |
private:
|
williamr@2
|
282 |
enum TGlobalSettingType
|
williamr@2
|
283 |
{
|
williamr@2
|
284 |
ENotASetting,
|
williamr@2
|
285 |
EGlobalSetting,
|
williamr@2
|
286 |
ECompatibilitySetting
|
williamr@2
|
287 |
};
|
williamr@2
|
288 |
protected:
|
williamr@2
|
289 |
CCommsDatabase();
|
williamr@2
|
290 |
void DoOpenL(TCommDbOpeningMethod& aOpeningMethod,TBool aUseDefaultDb);
|
williamr@2
|
291 |
private:
|
williamr@2
|
292 |
/** CCommsDatabaseBase pure virtuals */
|
williamr@2
|
293 |
|
williamr@2
|
294 |
virtual void CreateDatabaseL();
|
williamr@2
|
295 |
CCommsDbTableView* OpenGlobalSettingsTableLC(const TDesC& aSetting, TBool& aExists);
|
williamr@2
|
296 |
TGlobalSettingType GlobalSettingTypeL(const TDesC& aSetting) const;
|
williamr@2
|
297 |
|
williamr@2
|
298 |
};
|
williamr@2
|
299 |
|
williamr@2
|
300 |
class CCommsDbTemplateRecord;
|
williamr@2
|
301 |
|
williamr@2
|
302 |
class CCommsDbTableView : public CBase
|
williamr@2
|
303 |
/**
|
williamr@2
|
304 |
|
williamr@2
|
305 |
The view on a specific table in the database.
|
williamr@2
|
306 |
|
williamr@2
|
307 |
Includes the necessary behaviour for navigating through the records in
|
williamr@2
|
308 |
the view and reading and writing to columns within a record.
|
williamr@2
|
309 |
|
williamr@2
|
310 |
Uses a CCommsDatabase and has an RDbView to read from and write to database. Created via
|
williamr@2
|
311 |
CCommsDatabase::OpenTableLC() (which opens a view of all the records in the table) or one
|
williamr@2
|
312 |
of the OpenViewLC...() functions (which open a specific view of the table):
|
williamr@2
|
313 |
|
williamr@2
|
314 |
CCommsDatabase::OpenTableLC()
|
williamr@2
|
315 |
|
williamr@2
|
316 |
CCommsDatabase::OpenViewMatchingUintLC()
|
williamr@2
|
317 |
|
williamr@2
|
318 |
CCommsDatabase::OpenViewMatchingBoolLC()
|
williamr@2
|
319 |
|
williamr@2
|
320 |
CCommsDatabase::OpenViewMatchingTextLC()
|
williamr@2
|
321 |
|
williamr@2
|
322 |
CCommsDatabase::OpenViewLC()
|
williamr@2
|
323 |
|
williamr@2
|
324 |
Note that the above five functions have been withdrawn in CCommsDatabase and
|
williamr@2
|
325 |
are now implemented in CCommsDatabaseBase.
|
williamr@2
|
326 |
@publishedAll
|
williamr@2
|
327 |
@released */
|
williamr@2
|
328 |
{
|
williamr@2
|
329 |
public:
|
williamr@2
|
330 |
friend class CCommsDatabaseBase;
|
williamr@2
|
331 |
friend class CCommsDbTemplateRecord;
|
williamr@2
|
332 |
public:
|
williamr@2
|
333 |
// Low level view creation. Use if `CCommsDatabase::OpenTableLC()` or
|
williamr@2
|
334 |
//`CCommsDatabase::OpenViewLC...()` are not sufficient.
|
williamr@2
|
335 |
static CCommsDbTableView* NewL(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDbQuery& aQuery, TBool aUseTemplate = ETrue);
|
williamr@2
|
336 |
static CCommsDbTableView* NewLC(const TDesC& aTableName, CCommsDatabaseBase& aDb);
|
williamr@2
|
337 |
// additional constructors, commdb shim specific
|
williamr@2
|
338 |
static CCommsDbTableView* NewLC(CCommsDatabaseBase& aDb, const TDesC& aTableName, TBool aUseTamplate = ETrue); // ETrue if template is instantiating
|
williamr@2
|
339 |
static CCommsDbTableView* NewL(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC8& aValueToMatch);
|
williamr@2
|
340 |
static CCommsDbTableView* NewL(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC16& aValueToMatch);
|
williamr@2
|
341 |
static CCommsDbTableView* NewL(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDesC& aColumnToMatch, TUint32 aValueToMatch);
|
williamr@2
|
342 |
static CCommsDbTableView* NewLC(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDesC& aColumnToMatch, TBool aValueToMatch);
|
williamr@2
|
343 |
// this two are for IAP table only so table name is not needed
|
williamr@2
|
344 |
static CCommsDbTableView* NewLC(CCommsDatabaseBase& aDb, TUint32 aBearerSet, TCommDbConnectionDirection aDirection);
|
williamr@2
|
345 |
static CCommsDbTableView* NewLC(CCommsDatabaseBase& aDb, TUint32 aNetworkId);
|
williamr@2
|
346 |
// this one is for Proxie table only
|
williamr@2
|
347 |
static CCommsDbTableView* NewLC(CCommsDatabaseBase& aDb, TUint32 aServiceId, const TDesC& aServiceType);
|
williamr@2
|
348 |
|
williamr@2
|
349 |
CCommsDbTableView(CCommsDatabaseBase& aDb, const TDesC& aTableName);
|
williamr@2
|
350 |
|
williamr@2
|
351 |
IMPORT_C virtual ~CCommsDbTableView();
|
williamr@2
|
352 |
|
williamr@2
|
353 |
// Add a new record to this table. The record number is returned.
|
williamr@2
|
354 |
// `PutRecordChanges()` is called to complete the transaction
|
williamr@2
|
355 |
IMPORT_C TInt InsertRecord(TUint32& aId);
|
williamr@2
|
356 |
/** Add a new record to this table. Filling all empty fields with values copied
|
williamr@2
|
357 |
from record currently pointed at. The record number is returned.
|
williamr@2
|
358 |
`PutRecordChanges()` is called to complete the transaction */
|
williamr@2
|
359 |
IMPORT_C TInt InsertCopyRecord(TUint32& aId);
|
williamr@2
|
360 |
/** Modify the current record of this view. `PutRecordChanges()` is called
|
williamr@2
|
361 |
to complete the transaction */
|
williamr@2
|
362 |
IMPORT_C TInt UpdateRecord();
|
williamr@2
|
363 |
// Remove the current record from the table.
|
williamr@2
|
364 |
IMPORT_C TInt DeleteRecord();
|
williamr@2
|
365 |
// Store an inserted or updated record back to the database.
|
williamr@2
|
366 |
IMPORT_C TInt PutRecordChanges(TBool aHidden = EFalse, TBool aReadOnly = EFalse);
|
williamr@2
|
367 |
// Cancel pending changes since an insert or update.
|
williamr@2
|
368 |
IMPORT_C void CancelRecordChanges();
|
williamr@2
|
369 |
//
|
williamr@2
|
370 |
// Navigate throught the records in the view
|
williamr@2
|
371 |
//
|
williamr@2
|
372 |
IMPORT_C TInt GotoFirstRecord();
|
williamr@2
|
373 |
IMPORT_C TInt GotoNextRecord();
|
williamr@2
|
374 |
IMPORT_C TInt GotoPreviousRecord();
|
williamr@2
|
375 |
//
|
williamr@2
|
376 |
// Access data from the current record
|
williamr@2
|
377 |
//
|
williamr@2
|
378 |
IMPORT_C void ReadTextL(const TDesC& aColumn, TDes8& aValue);
|
williamr@2
|
379 |
IMPORT_C void ReadTextL(const TDesC& aColumn, TDes16& aValue);
|
williamr@2
|
380 |
IMPORT_C HBufC* ReadLongTextLC(const TDesC& aColumn);
|
williamr@2
|
381 |
IMPORT_C void ReadUintL(const TDesC& aColumn, TUint32& aValue);
|
williamr@2
|
382 |
IMPORT_C void ReadBoolL(const TDesC& aColumn, TBool& aValue);
|
williamr@2
|
383 |
// Determine the type and attributes of a column. The type is one of:
|
williamr@2
|
384 |
// (EDbColBit, EDbColUint32, EDbColText8, EDbColText16, EDbColLongText16).
|
williamr@2
|
385 |
// The attribute is a bit mask of: (ENotNull and EAutoIncrement).
|
williamr@2
|
386 |
IMPORT_C void ReadTypeAttribL(const TDesC& aColumn, TDbColType& aColType, TUint32& aAttrib);
|
williamr@2
|
387 |
// Null columns return 0, integers and bools 1, strings return their length in characters.
|
williamr@2
|
388 |
IMPORT_C void ReadColumnLengthL(const TDesC& aColumn, TInt& aLength);
|
williamr@2
|
389 |
|
williamr@2
|
390 |
//
|
williamr@2
|
391 |
// Modify an inserted or modified record. Must call `PutRecordChanges()`
|
williamr@2
|
392 |
// to store the changes.
|
williamr@2
|
393 |
//
|
williamr@2
|
394 |
IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC8& aValue);
|
williamr@2
|
395 |
IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC16& aValue);
|
williamr@2
|
396 |
IMPORT_C void WriteLongTextL(const TDesC& aColumn, const TDesC& aValue);
|
williamr@2
|
397 |
IMPORT_C void WriteUintL(const TDesC& aColumn, const TUint32& aValue);
|
williamr@2
|
398 |
IMPORT_C void WriteBoolL(const TDesC& aColumn, const TBool& aValue);
|
williamr@2
|
399 |
IMPORT_C void SetNullL(const TDesC& aColumn);
|
williamr@2
|
400 |
|
williamr@2
|
401 |
IMPORT_C void ReadColumnMaxLengthL(const TDesC& aColumn, TInt& aLength);
|
williamr@2
|
402 |
inline CCommsDatabaseBase* Database() const { return &iDb; }
|
williamr@2
|
403 |
|
williamr@2
|
404 |
void OpenL(const TDbQuery& aQuery);
|
williamr@2
|
405 |
|
williamr@2
|
406 |
inline void GetTableName(TDes& aTableName) const;
|
williamr@2
|
407 |
protected:
|
williamr@2
|
408 |
TDbColNo ColNumL(const TDesC& aColumn) const;
|
williamr@2
|
409 |
void Close();
|
williamr@2
|
410 |
void ConstructL(const TDesC& aTableName, TBool aShowHidden, TBool aUseTemplate);
|
williamr@2
|
411 |
void ConstructL(const TDbQuery& aQuery, TBool aUseTemplate);
|
williamr@2
|
412 |
RDbRowSet::TAccess GetL();
|
williamr@2
|
413 |
|
williamr@2
|
414 |
// All other ConstructructL methods are added for commdb shimm
|
williamr@2
|
415 |
void ConstructL(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC8& aValueToMatch);
|
williamr@2
|
416 |
void ConstructL(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC16& aValueToMatch);
|
williamr@2
|
417 |
void ConstructL(const TDesC& aTableName, const TDesC& aColumnToMatch, TUint32 aValueToMatch);
|
williamr@2
|
418 |
void ConstructL(const TDesC& aTableName, const TDesC& aColumnToMatch, TBool aValueToMatch);
|
williamr@2
|
419 |
void ConstructL(TUint32 aBearerSet, TCommDbConnectionDirection aDirection);
|
williamr@2
|
420 |
void ConstructL(TUint32 aNetworkId);
|
williamr@2
|
421 |
void ConstructL(TUint32 aServiceId, const TDesC& aServiceType);
|
williamr@2
|
422 |
// used for template creation only
|
williamr@2
|
423 |
void ConstructL(const TDesC& aTableName);
|
williamr@2
|
424 |
|
williamr@2
|
425 |
private:
|
williamr@2
|
426 |
enum TTableState {
|
williamr@2
|
427 |
EClosed,
|
williamr@2
|
428 |
EOpenIdle,
|
williamr@2
|
429 |
EInsert,
|
williamr@2
|
430 |
EUpdate
|
williamr@2
|
431 |
};
|
williamr@2
|
432 |
private:
|
williamr@2
|
433 |
TBool TableWithTemplateRecord() const;
|
williamr@2
|
434 |
TInt InsertTemplateRecord();
|
williamr@2
|
435 |
TInt DoInsertRecord(TBool aType, TUint32& aId, TBool aIsTemplate);
|
williamr@2
|
436 |
TInt DoPutRecordChanges(TBool aHidden = EFalse, TBool aReadOnly = EFalse, TBool aIsTemplateCall = EFalse);
|
williamr@2
|
437 |
|
williamr@2
|
438 |
private:
|
williamr@2
|
439 |
TTableState iState;
|
williamr@2
|
440 |
CCommsDbTemplateRecord* iTemplate;
|
williamr@2
|
441 |
TBool iTsyNameChanged;
|
williamr@2
|
442 |
TUint32 iInsertedRecordIndex;
|
williamr@2
|
443 |
TUint32 iCurrentId;
|
williamr@2
|
444 |
|
williamr@2
|
445 |
protected:
|
williamr@2
|
446 |
CCommsDatabaseBase& iDb;
|
williamr@2
|
447 |
TBuf<KCommsDbSvrMaxColumnNameLength> iTableName;
|
williamr@2
|
448 |
RDbView iTableView;
|
williamr@2
|
449 |
CCommDbTableExtension* iTableExt;
|
williamr@2
|
450 |
};
|
williamr@2
|
451 |
|
williamr@2
|
452 |
|
williamr@2
|
453 |
|
williamr@2
|
454 |
|
williamr@2
|
455 |
|
williamr@2
|
456 |
/**
|
williamr@2
|
457 |
Convert a legacy field name to a CommsDat element Id
|
williamr@2
|
458 |
|
williamr@2
|
459 |
@internalTechnology
|
williamr@2
|
460 |
@param aFieldName A legacy commdb field name in the format "tableName\fieldName"
|
williamr@2
|
461 |
@return A Commsdat element Id
|
williamr@2
|
462 |
*/
|
williamr@2
|
463 |
class CommDbShimUtil
|
williamr@2
|
464 |
{
|
williamr@2
|
465 |
public:
|
williamr@2
|
466 |
IMPORT_C static TMDBElementId GetElementIdFromFieldNameL(const TDesC& aFieldName);
|
williamr@2
|
467 |
};
|
williamr@2
|
468 |
|
williamr@2
|
469 |
// SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
williamr@2
|
470 |
|
williamr@2
|
471 |
|
williamr@2
|
472 |
#include <commdb.inl>
|
williamr@2
|
473 |
|
williamr@2
|
474 |
#endif
|
williamr@2
|
475 |
// COMMDB_H
|