2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * 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
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #ifndef _CSetUpCommDb_H
21 #define _CSetUpCommDb_H
23 /*****************************************************************************
27 ****************************************************************************/
30 /*****************************************************************************
34 ****************************************************************************/
36 /*****************************************************************************
40 ****************************************************************************/
43 TCommDB_ErrorInitCommDb,
44 TCommDB_ErrorTableNotFound,
45 TCommDB_ErrorUpdatingRecord,
46 TCommDB_ErrorReadingRecord,
47 TCommDB_ErrorColNotFound,
48 TCommDB_ErrorColTypeValueNotSupported,
49 TCommDB_ErrorConvertingToUnicode,
50 TCommDB_ErrorUnexpectedColType,
59 /*****************************************************************************
63 ****************************************************************************/
64 class CSetUpCommDb : public CBase
68 // Constructor sets all member data to null
69 IMPORT_C CSetUpCommDb();
71 // Deletes the pointer, sets it to null.
72 IMPORT_C ~CSetUpCommDb();
74 // Method to initialise the database.
75 IMPORT_C TCommDBError initialise(void);
77 IMPORT_C TCommDBError updateEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
79 IMPORT_C TCommDBError getAsciiEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TDes8& aFieldValue, int* aErrCode);
80 IMPORT_C TCommDBError getUnicodeEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TDes16& aFieldValue, int* aErrCode);
81 IMPORT_C TCommDBError getIntEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TUint32& aFieldValue, int* aErrCode);
82 IMPORT_C TCommDBError getBoolEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TBool& aFieldValue, int* aErrCode);
85 CCommsDbTableView* openTableL( CCommsDatabase *aDbComms, TPtrC aTable );
87 TCommDBError FindAndUpdateRecord( CCommsDbTableView *aTable, TUint32 aRecordID, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
88 TCommDBError UpdateField( CCommsDbTableView *aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode );
89 int SetUnicodeString(CCommsDbTableView* aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
90 int SetUnicodeStringLong(CCommsDbTableView* aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
91 HBufC16 *ConvertAsciiToUnicode( char *aAsciiString );
93 TCommDBError FindRecordAndGetType( CCommsDbTableView *aTable, TUint32 aRecordID, TPtrC aFieldName, TDbColType *aColType, int* aErrCode );
96 CCommsDatabase *iDbComms;
97 TCommDbStatus iStatus;