15 |
15 |
16 |
16 |
17 |
17 |
18 #include "cmtpdpidstore.h" |
18 #include "cmtpdpidstore.h" |
19 #include "dbutility.h" |
19 #include "dbutility.h" |
|
20 #include "mtpdebug.h" |
|
21 #include "OstTraceDefinitions.h" |
|
22 #ifdef OST_TRACE_COMPILER_IN_USE |
|
23 #include "cmtpdpidstoreTraces.h" |
|
24 #endif |
|
25 |
20 |
26 |
21 |
27 |
22 _LIT(KSQLDPIDTableName, "DPIDStore"); |
28 _LIT(KSQLDPIDTableName, "DPIDStore"); |
23 _LIT(KSQLInsertDPIDObjectText, "INSERT INTO DPIDStore (DataProviderId, Uid) VALUES (%u, %u)"); |
29 _LIT(KSQLInsertDPIDObjectText, "INSERT INTO DPIDStore (DataProviderId, Uid) VALUES (%u, %u)"); |
24 _LIT(KSQLCreateDPIDTableText, "CREATE TABLE DPIDStore (DataProviderId UNSIGNED INTEGER, Uid UNSIGNED INTEGER )"); |
30 _LIT(KSQLCreateDPIDTableText, "CREATE TABLE DPIDStore (DataProviderId UNSIGNED INTEGER, Uid UNSIGNED INTEGER )"); |
61 */ |
67 */ |
62 void CMTPDPIDStore::CreateDPIDStoteTableL() |
68 void CMTPDPIDStore::CreateDPIDStoteTableL() |
63 { |
69 { |
64 if (!DBUtility::IsTableExistsL(iDatabase, KSQLDPIDTableName)) |
70 if (!DBUtility::IsTableExistsL(iDatabase, KSQLDPIDTableName)) |
65 { |
71 { |
66 User::LeaveIfError(iDatabase.Execute(KSQLCreateDPIDTableText)); |
72 LEAVEIFERROR(iDatabase.Execute(KSQLCreateDPIDTableText), |
|
73 OstTrace0( TRACE_ERROR, CMTPDPIDSTORE_CREATEDPIDSTOTETABLEL, "TABLE DPIDStore create failed!" )); |
67 } |
74 } |
68 iSqlStatement.Format(KSQLGetDPIDUID); |
75 iSqlStatement.Format(KSQLGetDPIDUID); |
69 RDbView view; |
76 RDbView view; |
70 CleanupClosePushL(view); |
77 CleanupClosePushL(view); |
71 User::LeaveIfError(view.Prepare(iDatabase, TDbQuery(iSqlStatement))); |
78 LEAVEIFERROR(view.Prepare(iDatabase, TDbQuery(iSqlStatement)), |
72 User::LeaveIfError(view.Evaluate()); |
79 OstTrace0( TRACE_ERROR, DUP1_CMTPDPIDSTORE_CREATEDPIDSTOTETABLEL, "view for DPIDStore prepare failed!" )); |
|
80 LEAVEIFERROR(view.Evaluate(), |
|
81 OstTrace0( TRACE_ERROR, DUP2_CMTPDPIDSTORE_CREATEDPIDSTOTETABLEL, "view evaluate failed!" )); |
73 while (view.NextL()) |
82 while (view.NextL()) |
74 { |
83 { |
75 view.GetL(); |
84 view.GetL(); |
76 iDPIDs.AppendL(view.ColInt64(EDPIDStoreDataProviderId)); |
85 iDPIDs.AppendL(view.ColInt64(EDPIDStoreDataProviderId)); |
77 iDPUIDs.AppendL(view.ColInt64(EDPIDStoreUid)); |
86 iDPUIDs.AppendL(view.ColInt64(EDPIDStoreUid)); |