0
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2009 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:
|
|
15 |
* CSetUpCommDb.h
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef _CSetUpCommDb_H
|
|
22 |
#define _CSetUpCommDb_H
|
|
23 |
|
|
24 |
/*****************************************************************************
|
|
25 |
*
|
|
26 |
* System Includes
|
|
27 |
*
|
|
28 |
****************************************************************************/
|
|
29 |
#include <commdb.h>
|
|
30 |
|
|
31 |
/*****************************************************************************
|
|
32 |
*
|
|
33 |
* Local Includes
|
|
34 |
*
|
|
35 |
****************************************************************************/
|
|
36 |
|
|
37 |
/*****************************************************************************
|
|
38 |
*
|
|
39 |
* Types
|
|
40 |
*
|
|
41 |
****************************************************************************/
|
|
42 |
typedef enum {
|
|
43 |
TCommDB_Success,
|
|
44 |
TCommDB_ErrorInitCommDb,
|
|
45 |
TCommDB_ErrorTableNotFound,
|
|
46 |
TCommDB_ErrorUpdatingRecord,
|
|
47 |
TCommDB_ErrorReadingRecord,
|
|
48 |
TCommDB_ErrorColNotFound,
|
|
49 |
TCommDB_ErrorColTypeValueNotSupported,
|
|
50 |
TCommDB_ErrorConvertingToUnicode,
|
|
51 |
TCommDB_ErrorUnexpectedColType,
|
|
52 |
TCommDB_RecNotFound
|
|
53 |
}TCommDBError;
|
|
54 |
|
|
55 |
typedef enum {
|
|
56 |
TCOMMBD_IDLE,
|
|
57 |
TCOMMBD_CONNECTED
|
|
58 |
}TCommDbStatus;
|
|
59 |
|
|
60 |
/*****************************************************************************
|
|
61 |
*
|
|
62 |
* Class Definition
|
|
63 |
*
|
|
64 |
****************************************************************************/
|
|
65 |
class CSetUpCommDb : public CBase
|
|
66 |
{
|
|
67 |
|
|
68 |
public:
|
|
69 |
// Constructor sets all member data to null
|
|
70 |
IMPORT_C CSetUpCommDb();
|
|
71 |
|
|
72 |
// Deletes the pointer, sets it to null.
|
|
73 |
IMPORT_C ~CSetUpCommDb();
|
|
74 |
|
|
75 |
// Method to initialise the database.
|
|
76 |
IMPORT_C TCommDBError initialise(void);
|
|
77 |
|
|
78 |
IMPORT_C TCommDBError updateEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
|
|
79 |
|
|
80 |
IMPORT_C TCommDBError getAsciiEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TDes8& aFieldValue, int* aErrCode);
|
|
81 |
IMPORT_C TCommDBError getUnicodeEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TDes16& aFieldValue, int* aErrCode);
|
|
82 |
IMPORT_C TCommDBError getIntEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TUint32& aFieldValue, int* aErrCode);
|
|
83 |
IMPORT_C TCommDBError getBoolEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TBool& aFieldValue, int* aErrCode);
|
|
84 |
|
|
85 |
private:
|
|
86 |
CCommsDbTableView* openTableL( CCommsDatabase *aDbComms, TPtrC aTable );
|
|
87 |
|
|
88 |
TCommDBError FindAndUpdateRecord( CCommsDbTableView *aTable, TUint32 aRecordID, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
|
|
89 |
TCommDBError UpdateField( CCommsDbTableView *aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode );
|
|
90 |
int SetUnicodeString(CCommsDbTableView* aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
|
|
91 |
int SetUnicodeStringLong(CCommsDbTableView* aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
|
|
92 |
HBufC16 *ConvertAsciiToUnicode( char *aAsciiString );
|
|
93 |
|
|
94 |
TCommDBError FindRecordAndGetType( CCommsDbTableView *aTable, TUint32 aRecordID, TPtrC aFieldName, TDbColType *aColType, int* aErrCode );
|
|
95 |
|
|
96 |
|
|
97 |
CCommsDatabase *iDbComms;
|
|
98 |
TCommDbStatus iStatus;
|
|
99 |
|
|
100 |
};
|
|
101 |
|
|
102 |
#endif
|