|
1 /* |
|
2 * Copyright (c) 2008 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: Class that directly interacts with Sqlite database. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System Includes |
|
20 #include <s32strm.h> |
|
21 |
|
22 // User Includes |
|
23 #include "evtdatabase.h" |
|
24 #include "evtdbnotifier.h" |
|
25 #include "evtaction.h" |
|
26 #include "evtconsts.h" |
|
27 #include "evtdebug.h" |
|
28 |
|
29 // Constant |
|
30 const TInt KBufferLength = 512; |
|
31 const TInt KMaxIntLength = 22; |
|
32 |
|
33 // ================ Member funtions for CEvtDatabase class ================== |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CEvtDatabase::CEvtDatabase |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CEvtDatabase::CEvtDatabase( ) |
|
40 { |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // CEvtDatabase::~CEvtDatabase |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 CEvtDatabase::~CEvtDatabase() |
|
48 { |
|
49 // Close Database handle |
|
50 CloseDatabase(); |
|
51 |
|
52 delete iDbNotifier; |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CEvtDatabase::NewL |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CEvtDatabase* CEvtDatabase::NewL( ) |
|
60 { |
|
61 CEvtDatabase* self = NewLC( ); |
|
62 CleanupStack::Pop( self ); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CEvtDatabase::NewLC |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 CEvtDatabase* CEvtDatabase::NewLC( ) |
|
71 { |
|
72 CEvtDatabase* self = new ( ELeave )CEvtDatabase( ); |
|
73 CleanupStack::PushL( self ); |
|
74 self->ConstructL( ); |
|
75 return self; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // CEvtDatabase::ConstructL |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 void CEvtDatabase::ConstructL() |
|
83 { |
|
84 EVTUIDEBUG( "+ CEvtDatabase::OpenDatabaseL()" ); |
|
85 EVTUIDEBUG( "Calling OpenDatabaseL()" ); |
|
86 // Open the handle to Database |
|
87 OpenDatabaseL( ); |
|
88 |
|
89 EVTUIDEBUG( "Calling CEvtDbNotifier::NewL()" ); |
|
90 // Notifier is instantiated to notify and listen to database change. |
|
91 iDbNotifier = CEvtDbNotifier::NewL( *this ); |
|
92 EVTUIDEBUG( "+ CEvtDatabase::OpenDatabaseL()" ); |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CEvtDatabase::CreateOpenDatabaseL |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 void CEvtDatabase::OpenDatabaseL( ) |
|
100 { |
|
101 EVTUIDEBUG( "+ CEvtDatabase::OpenDatabaseL()" ); |
|
102 |
|
103 // First try to open the database. |
|
104 TInt err = iDb.Open( KEventsDbSecureFName() ); |
|
105 |
|
106 // If the database is not present, then a database and schema has to be |
|
107 // created |
|
108 if( KErrNotFound == err ) |
|
109 { |
|
110 CreateOpenDatabaseL( ); // Create Database |
|
111 CreateSchemaL( ); // Create Schema |
|
112 } |
|
113 else if( KErrNone != err ) |
|
114 User::LeaveIfError( err ); // Leave if Open fails for any other reason |
|
115 EVTUIDEBUG( "- CEvtDatabase::OpenDatabaseL()" ); |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // CEvtDatabase::CloseDatabaseL |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 void CEvtDatabase::CloseDatabase() |
|
123 { |
|
124 EVTUIDEBUG( "+ CEvtDatabase::CloseDatabase()" ); |
|
125 // Close db handle |
|
126 iDb.Close(); |
|
127 EVTUIDEBUG( "- CEvtDatabase::CloseDatabase()" ); |
|
128 } |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // CEvtDatabase::CreateDatabaseL |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 void CEvtDatabase::CreateOpenDatabaseL( ) |
|
135 { |
|
136 EVTUIDEBUG( "+ CEvtDatabase::CreateOpenDatabaseL()" ); |
|
137 |
|
138 // To create a Secure Database, we first need to create the Security policy. |
|
139 // Security policy once defined for a database, can not be changed. |
|
140 TSecurityPolicy defaultPolicy( TSecurityPolicy::EAlwaysPass ); |
|
141 RSqlSecurityPolicy securityPolicy; |
|
142 TInt err = securityPolicy.Create( defaultPolicy ); |
|
143 User::LeaveIfError( err ); |
|
144 |
|
145 // Define Security Policy |
|
146 const TSecurityPolicy KSchemaPolicy( ECapabilityLocation ); |
|
147 const TSecurityPolicy KReadWritePolicy( ECapabilityLocation ); |
|
148 |
|
149 // Set the security Policy for Schema and tables |
|
150 securityPolicy.SetDbPolicy( RSqlSecurityPolicy::ESchemaPolicy, |
|
151 KSchemaPolicy ); |
|
152 securityPolicy.SetDbPolicy( RSqlSecurityPolicy::EReadPolicy, |
|
153 KReadWritePolicy ); |
|
154 securityPolicy.SetDbPolicy( RSqlSecurityPolicy::EWritePolicy, |
|
155 KReadWritePolicy ); |
|
156 |
|
157 // CreateL will create and open the handle to database. |
|
158 iDb.CreateL( KEventsDbSecureFName(), securityPolicy ); |
|
159 |
|
160 // Close the Security Policy |
|
161 securityPolicy.Close(); |
|
162 |
|
163 EVTUIDEBUG( "- CEvtDatabase::CreateOpenDatabaseL()" ); |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CEvtDatabase::CreateSchemaL |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 void CEvtDatabase::CreateSchemaL() |
|
171 { |
|
172 EVTUIDEBUG( "+ CEvtDatabase::CreateSchemaL()" ); |
|
173 // Create Tables in database |
|
174 CreateTablesL(); |
|
175 // Create Triggers in database |
|
176 CreateTriggerL(); |
|
177 // Create Indexes in database |
|
178 CreateIndexL(); |
|
179 EVTUIDEBUG( "- CEvtDatabase::CreateSchemaL()" ); |
|
180 } |
|
181 |
|
182 // --------------------------------------------------------------------------- |
|
183 // CEvtDatabase::CreateTablesL |
|
184 // --------------------------------------------------------------------------- |
|
185 // |
|
186 void CEvtDatabase::CreateTablesL() |
|
187 { |
|
188 EVTUIDEBUG( "+ CEvtDatabase::CreateTablesL()" ); |
|
189 |
|
190 // Leave if the creation of tables fail. |
|
191 User::LeaveIfError( |
|
192 iDb.Exec( KCreateEventTable ) ); |
|
193 User::LeaveIfError( |
|
194 iDb.Exec( KCreateActionTable ) ); |
|
195 EVTUIDEBUG( "- CEvtDatabase::CreateTablesL()" ); |
|
196 } |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 // CEvtDatabase::CreateTriggerL |
|
200 // --------------------------------------------------------------------------- |
|
201 // |
|
202 void CEvtDatabase::CreateTriggerL() |
|
203 { |
|
204 EVTUIDEBUG( "+ CEvtDatabase::CreateTriggerL()" ); |
|
205 // Triggers are used to maintain the referential integrity between |
|
206 // Event and Action tables. |
|
207 // This avoids Insert, Update and Delete anamolies. |
|
208 |
|
209 // Leave if the creation of triggers fail. |
|
210 User::LeaveIfError( |
|
211 iDb.Exec( KCreateTriggerActionEventInsert ) ); |
|
212 User::LeaveIfError( |
|
213 iDb.Exec( KCreateTriggerActionEventUpdate ) ); |
|
214 User::LeaveIfError( |
|
215 iDb.Exec( KCreateTriggerActionEventDelete ) ); |
|
216 |
|
217 EVTUIDEBUG( "- CEvtDatabase::CreateTriggerL()" ); |
|
218 } |
|
219 |
|
220 // --------------------------------------------------------------------------- |
|
221 // CEvtDatabase::CreateIndexL |
|
222 // --------------------------------------------------------------------------- |
|
223 // |
|
224 void CEvtDatabase::CreateIndexL() |
|
225 { |
|
226 EVTUIDEBUG( "+ CEvtDatabase::CreateIndexL()" ); |
|
227 // Indexes are created to improve the performance of select Queries |
|
228 // Following indexes are created |
|
229 // 1. Index to "Select Event based on Status and Sort by Subject" |
|
230 // 2. Index to "Select Event based on Unique Event Id" |
|
231 // 3. Index to "Select Event based on Event Id" - (LBT Engine's Id) |
|
232 // 4. Index to "Select Action based on Unique Event Id" |
|
233 |
|
234 // Leave if the creation of indexes fail. |
|
235 User::LeaveIfError( |
|
236 iDb.Exec( KCreateEventStatusSubjectIndex ) ); |
|
237 User::LeaveIfError( |
|
238 iDb.Exec( KCreateEventEvtIdIndex ) ); |
|
239 User::LeaveIfError( |
|
240 iDb.Exec( KCreateActionEvtIdIndex ) ); |
|
241 |
|
242 EVTUIDEBUG( "- CEvtDatabase::CreateIndexL()" ); |
|
243 } |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // CEvtDatabase::GetEventsL |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 void CEvtDatabase::GetEventsL( |
|
250 TEvtEventStatus aEventStatus, |
|
251 RPointerArray<CEvtBasicEventInfo>& aEventArray ) |
|
252 { |
|
253 EVTUIDEBUG( "+ CEvtDatabase::GetEventsL() - Status" ); |
|
254 RSqlStatement stmt; |
|
255 |
|
256 // Prepare the SQL statement to Get Events based on Status |
|
257 stmt.Prepare( iDb, KSelectBasicEventOnStatus ); |
|
258 |
|
259 // Set the Status parameter in SQL statement |
|
260 TInt paramIndex = stmt.ParameterIndex( KStatus ); |
|
261 stmt.BindInt( paramIndex,aEventStatus ); |
|
262 |
|
263 // Pass the SQL statement to get events. |
|
264 GetEventsL( stmt, aEventArray ); |
|
265 |
|
266 // Close statement |
|
267 stmt.Close(); |
|
268 EVTUIDEBUG( "- CEvtDatabase::GetEventsL() - Status" ); |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------------------------- |
|
272 // CEvtDatabase::GetEventsL |
|
273 // --------------------------------------------------------------------------- |
|
274 // |
|
275 void CEvtDatabase::GetEventsL( |
|
276 RPointerArray<CEvtBasicEventInfo>& aEventArray ) |
|
277 { |
|
278 EVTUIDEBUG( "+ CEvtDatabase::GetEventsL() - without Status" ); |
|
279 RSqlStatement stmt; |
|
280 |
|
281 // Prepare the SQL statement to Get Events based on Status |
|
282 stmt.Prepare( iDb, KSelectBasicEvent ); |
|
283 |
|
284 // Pass the SQL statement to get events. |
|
285 GetEventsL( stmt, aEventArray ); |
|
286 |
|
287 // Close statement |
|
288 stmt.Close(); |
|
289 EVTUIDEBUG( "- CEvtDatabase::GetEventsL() - without Status" ); |
|
290 } |
|
291 |
|
292 // --------------------------------------------------------------------------- |
|
293 // CEvtDatabase::GetEventL |
|
294 // --------------------------------------------------------------------------- |
|
295 // |
|
296 CEvtEvent* CEvtDatabase::GetEventL( TEvtEventId aEventId ) |
|
297 { |
|
298 EVTUIDEBUG( "+ CEvtDatabase::GetEventL()" ); |
|
299 |
|
300 RSqlStatement stmt; |
|
301 CEvtEvent* evt = NULL; |
|
302 |
|
303 // Prepare the SQL statement to Get Events based on Id |
|
304 stmt.Prepare( iDb, KSelectEventFromEventId ); |
|
305 |
|
306 // Set the Id parameter in SQL statement |
|
307 TInt paramIndex=stmt.ParameterIndex( KEventId ); |
|
308 stmt.BindInt( paramIndex, aEventId ); |
|
309 |
|
310 // Constants representing the columns in Query |
|
311 TInt columnIndexStatus=0; |
|
312 TInt columnIndexSubject=1; |
|
313 TInt columnIndexPlace=2; |
|
314 TInt columnIndexRadius=3; |
|
315 TInt columnIndexDescription=4; |
|
316 TInt columnIndexRepeat=5; |
|
317 TInt columnIndexActionId=6; |
|
318 TInt columnIndexAction=7; |
|
319 TInt columnIndexActionEvtId=8; |
|
320 |
|
321 // Flag to loop out after the first element is found in database |
|
322 // This is not required as we maintain unique Id for every event. |
|
323 // But to ensure that we do not allocate many events object to evt, |
|
324 // this flag is defined. |
|
325 TBool flag( ETrue ); |
|
326 |
|
327 // Set the other attributes of the Requested Event |
|
328 while( flag && stmt.Next() == KSqlAtRow ) |
|
329 { |
|
330 flag = EFalse; |
|
331 evt = CEvtEvent::NewLC(); |
|
332 |
|
333 // Set the Id of the Requested Event |
|
334 evt->SetEventId(aEventId); |
|
335 |
|
336 TInt value = stmt.ColumnInt( columnIndexStatus ); |
|
337 evt->SetEventStatus( static_cast<TEvtEventStatus>(value) ); |
|
338 |
|
339 TPtrC subject=stmt.ColumnTextL( columnIndexSubject ); |
|
340 evt->SetSubjectL(subject); |
|
341 |
|
342 TPtrC place=stmt.ColumnTextL( columnIndexPlace ); |
|
343 evt->SetPlaceL(place); |
|
344 |
|
345 TReal realvalue = stmt.ColumnReal( columnIndexRadius ); |
|
346 evt->SetRadius( realvalue ); |
|
347 |
|
348 TPtrC desc=stmt.ColumnTextL( columnIndexDescription ); |
|
349 evt->SetDescriptionL(desc); |
|
350 |
|
351 value = stmt.ColumnInt( columnIndexRepeat ); |
|
352 evt->SetRepeat(value); |
|
353 |
|
354 TInt64 value64 = stmt.ColumnInt64( columnIndexActionId ); |
|
355 if( value64 != 0 ) |
|
356 { |
|
357 // Create action instance to set for Event |
|
358 // ownership is not passed. |
|
359 CEvtAction* actn = CEvtAction::NewLC(); |
|
360 |
|
361 // Set the Unique Id for Action |
|
362 actn->SetId( value64 ); |
|
363 |
|
364 // Set Action to an Event only if there is an Action String. |
|
365 TPtrC action = stmt.ColumnTextL( columnIndexAction ); |
|
366 actn->SetActionL( action ); |
|
367 |
|
368 // Set the Event Id |
|
369 TUint32 value32 = stmt.ColumnInt( columnIndexActionEvtId ); |
|
370 actn->SetEvtId( value32 ); |
|
371 |
|
372 // Set the Action to Event |
|
373 evt->SetActionL( actn ); |
|
374 |
|
375 // Pop action after setting. |
|
376 CleanupStack::Pop( actn ); |
|
377 } |
|
378 |
|
379 // Pop the Event object |
|
380 CleanupStack::Pop( evt ); |
|
381 } |
|
382 stmt.Close(); |
|
383 |
|
384 if( flag ) |
|
385 User::Leave( KErrNotFound ); |
|
386 |
|
387 EVTUIDEBUG( "- CEvtDatabase::GetEventL()" ); |
|
388 return evt; |
|
389 } |
|
390 |
|
391 // --------------------------------------------------------------------------- |
|
392 // CEvtDatabase::UpdateEvent |
|
393 // --------------------------------------------------------------------------- |
|
394 // |
|
395 void CEvtDatabase::UpdateEventL( |
|
396 CEvtEvent& aEvtEvent ) |
|
397 { |
|
398 EVTUIDEBUG( "+ CEvtDatabase::UpdateEventL()" ); |
|
399 |
|
400 // Update Event's Attributes. |
|
401 UpdateEventTableL( aEvtEvent ); |
|
402 |
|
403 if( aEvtEvent.HasAction() ) |
|
404 { |
|
405 aEvtEvent.Action().SetEvtId( aEvtEvent.EventId() ); |
|
406 if( CheckIfActionPresentL( aEvtEvent.Action().Id() ) ) |
|
407 UpdateActionL( aEvtEvent.Action() ); |
|
408 else |
|
409 CreateActionL( aEvtEvent.Action() ); |
|
410 } |
|
411 else |
|
412 { |
|
413 DeleteActionL( aEvtEvent.EventId() ); |
|
414 } |
|
415 |
|
416 // Notify the database change for Modify |
|
417 iDbNotifier->DbChangedL( ); |
|
418 EVTUIDEBUG( "- CEvtDatabase::UpdateEventL()" ); |
|
419 } |
|
420 |
|
421 // --------------------------------------------------------------------------- |
|
422 // CEvtDatabase::AddEventL |
|
423 // --------------------------------------------------------------------------- |
|
424 // |
|
425 void CEvtDatabase::AddEventL( CEvtEvent& aEvtEvent ) |
|
426 { |
|
427 EVTUIDEBUG( "+ CEvtDatabase::AddEventL()" ); |
|
428 |
|
429 RSqlStatement stmt; |
|
430 TInt paramIndex; |
|
431 |
|
432 // We need to create the streams to insert large texts. |
|
433 RSqlParamWriteStream subjectStream; |
|
434 RSqlParamWriteStream placeStream; |
|
435 RSqlParamWriteStream descStream; |
|
436 CleanupClosePushL( subjectStream ); |
|
437 CleanupClosePushL( placeStream ); |
|
438 CleanupClosePushL( descStream ); |
|
439 |
|
440 // Prepare the SQL statement to Get Events based on Status |
|
441 stmt.Prepare( iDb, KInsertEvent ); |
|
442 |
|
443 // Set Status |
|
444 paramIndex = stmt.ParameterIndex( KStatus ); |
|
445 stmt.BindInt( paramIndex, aEvtEvent.EventStatus() ); |
|
446 |
|
447 // Set Subject |
|
448 paramIndex = stmt.ParameterIndex( KSubject ); |
|
449 if( KNullDesC() == aEvtEvent.Subject() ) |
|
450 { |
|
451 stmt.BindNull( paramIndex ); |
|
452 } |
|
453 else |
|
454 { |
|
455 subjectStream.BindText( stmt, paramIndex ); |
|
456 subjectStream.WriteL( aEvtEvent.Subject() ); |
|
457 subjectStream.CommitL(); |
|
458 } |
|
459 |
|
460 // Set Place |
|
461 paramIndex = stmt.ParameterIndex( KPlace ); |
|
462 if( KNullDesC() == aEvtEvent.Place() ) |
|
463 { |
|
464 stmt.BindNull( paramIndex ); |
|
465 } |
|
466 else |
|
467 { |
|
468 placeStream.BindText( stmt, paramIndex ); |
|
469 placeStream.WriteL( aEvtEvent.Place() ); |
|
470 placeStream.CommitL(); |
|
471 } |
|
472 |
|
473 // Set Radius |
|
474 paramIndex = stmt.ParameterIndex( KRadius ); |
|
475 stmt.BindReal( paramIndex, aEvtEvent.Radius() ); |
|
476 |
|
477 // Set Description |
|
478 paramIndex = stmt.ParameterIndex( KDescription ); |
|
479 if( KNullDesC() == aEvtEvent.Description() ) |
|
480 { |
|
481 stmt.BindNull( paramIndex ); |
|
482 } |
|
483 else |
|
484 { |
|
485 descStream.BindText( stmt, paramIndex ); |
|
486 descStream.WriteL( aEvtEvent.Description() ); |
|
487 descStream.CommitL(); |
|
488 } |
|
489 |
|
490 // Set Repeat |
|
491 paramIndex = stmt.ParameterIndex( KRepeat ); |
|
492 stmt.BindInt( paramIndex, aEvtEvent.Repeat() ); |
|
493 |
|
494 // Set Event Id |
|
495 paramIndex = stmt.ParameterIndex( KEventId ); |
|
496 stmt.BindInt( paramIndex, aEvtEvent.EventId() ); |
|
497 |
|
498 // Execute the Remove SQL statement |
|
499 User::LeaveIfError( stmt.Exec() ); |
|
500 |
|
501 //Close the streams |
|
502 CleanupStack::PopAndDestroy( &descStream ); |
|
503 CleanupStack::PopAndDestroy( &placeStream ); |
|
504 CleanupStack::PopAndDestroy( &subjectStream ); |
|
505 |
|
506 stmt.Close(); |
|
507 |
|
508 // Insert into Action table If action is present for the event. |
|
509 if( aEvtEvent.HasAction() ) |
|
510 { |
|
511 aEvtEvent.Action().SetEvtId( aEvtEvent.EventId() ); |
|
512 CreateActionL( aEvtEvent.Action() ); |
|
513 } |
|
514 |
|
515 // Notify the database change for Insert |
|
516 iDbNotifier->DbChangedL( ); |
|
517 EVTUIDEBUG( "- CEvtDatabase::AddEventL()" ); |
|
518 } |
|
519 |
|
520 // --------------------------------------------------------------------------- |
|
521 // CEvtDatabase::RemoveEventsL |
|
522 // --------------------------------------------------------------------------- |
|
523 // |
|
524 void CEvtDatabase::RemoveEventsL( const RArray<TEvtEventId>& aEventArray ) |
|
525 { |
|
526 EVTUIDEBUG( "+ CEvtDatabase::RemoveEventsL()" ); |
|
527 // Removing an Event in database should be done in an order of |
|
528 // - remove Action entry and then remove Event entry |
|
529 |
|
530 // Leave if there are no array elements |
|
531 if( aEventArray.Count() == 0 ) |
|
532 User::Leave( KErrArgument ); |
|
533 |
|
534 RSqlStatement stmt; |
|
535 |
|
536 HBufC8* buf = HBufC8::NewLC(KBufferLength); |
|
537 |
|
538 buf->Des().Zero(); |
|
539 TInt tempLength = KOr().Length()+KMultiActionId().Length()+KMaxIntLength; |
|
540 |
|
541 for(TInt i=0; i<aEventArray.Count(); i++ ) |
|
542 { |
|
543 if(buf->Length() == 0) |
|
544 { |
|
545 buf->Des().Zero(); |
|
546 buf->Des().Append(KDeleteMultiAction()); |
|
547 buf->Des().Append(KMultiActionId()); |
|
548 buf->Des().AppendNum(aEventArray[i]); |
|
549 } |
|
550 else |
|
551 { |
|
552 buf->Des().Append(KOr()); |
|
553 buf->Des().Append(KMultiActionId()); |
|
554 buf->Des().AppendNum(aEventArray[i]); |
|
555 } |
|
556 |
|
557 if( i == aEventArray.Count()-1 || KBufferLength - buf->Length() < tempLength ) |
|
558 { |
|
559 // Prepare the SQL statement to Update Status based on Id |
|
560 stmt.Prepare( iDb, *buf ); |
|
561 |
|
562 // Execute the Remove SQL statement |
|
563 User::LeaveIfError( stmt.Exec() ); |
|
564 buf->Des().Zero(); |
|
565 |
|
566 // Close the Connection |
|
567 stmt.Close(); |
|
568 } |
|
569 } |
|
570 |
|
571 buf->Des().Zero(); |
|
572 tempLength = KOr().Length()+KMultiEventId().Length()+KMaxIntLength; |
|
573 |
|
574 for(TInt i=0; i<aEventArray.Count(); i++ ) |
|
575 { |
|
576 if(buf->Length() == 0) |
|
577 { |
|
578 buf->Des().Zero(); |
|
579 buf->Des().Append(KDeleteMultiEvent()); |
|
580 buf->Des().Append(KMultiEventId()); |
|
581 buf->Des().AppendNum(aEventArray[i]); |
|
582 } |
|
583 else |
|
584 { |
|
585 buf->Des().Append(KOr()); |
|
586 buf->Des().Append(KMultiEventId()); |
|
587 buf->Des().AppendNum(aEventArray[i]); |
|
588 } |
|
589 |
|
590 if( i == aEventArray.Count()-1 || KBufferLength - buf->Length() < tempLength ) |
|
591 { |
|
592 // Prepare the SQL statement to Update Status based on Id |
|
593 stmt.Prepare( iDb, *buf ); |
|
594 |
|
595 // Execute the Remove SQL statement |
|
596 User::LeaveIfError( stmt.Exec() ); |
|
597 buf->Des().Zero(); |
|
598 |
|
599 // Close the Connection |
|
600 stmt.Close(); |
|
601 } |
|
602 } |
|
603 |
|
604 CleanupStack::PopAndDestroy( buf ); //buf |
|
605 |
|
606 // Notify the database change for Delete |
|
607 iDbNotifier->DbChangedL( ); |
|
608 EVTUIDEBUG( "- CEvtDatabase::RemoveEventsL()" ); |
|
609 } |
|
610 |
|
611 // --------------------------------------------------------------------------- |
|
612 // CEvtDatabase::UpdateEventsStatusL |
|
613 // --------------------------------------------------------------------------- |
|
614 // |
|
615 void CEvtDatabase::UpdateEventsStatusL( const RArray<TEvtEventId>& aEventArray, TEvtEventStatus aEvtStatus ) |
|
616 { |
|
617 EVTUIDEBUG( "Sync UpdateEventsStatusL"); |
|
618 |
|
619 // Leave if there are no array elements |
|
620 if( aEventArray.Count() == 0 ) |
|
621 User::Leave( KErrArgument ); |
|
622 |
|
623 RSqlStatement stmt; |
|
624 |
|
625 HBufC8* buf = HBufC8::NewLC(KBufferLength); |
|
626 buf->Des().Zero(); |
|
627 TInt tempLength = KOr().Length()+KMultiEventId().Length()+KMaxIntLength; |
|
628 |
|
629 for(TInt i=0; i<aEventArray.Count(); i++ ) |
|
630 { |
|
631 if(buf->Length() == 0) |
|
632 { |
|
633 buf->Des().Zero(); |
|
634 buf->Des().Append(KUpdateMultiStatus()); |
|
635 buf->Des().AppendNum(aEvtStatus); |
|
636 buf->Des().Append(KWhere()); |
|
637 buf->Des().Append(KMultiEventId()); |
|
638 buf->Des().AppendNum(aEventArray[i]); |
|
639 } |
|
640 else |
|
641 { |
|
642 buf->Des().Append(KOr()); |
|
643 buf->Des().Append(KMultiEventId()); |
|
644 buf->Des().AppendNum(aEventArray[i]); |
|
645 } |
|
646 |
|
647 if( i == aEventArray.Count()-1 || KBufferLength - buf->Length() < tempLength ) |
|
648 { |
|
649 // Prepare the SQL statement to Update Status based on Id |
|
650 stmt.Prepare( iDb, *buf ); |
|
651 |
|
652 // Execute the Remove SQL statement |
|
653 User::LeaveIfError( stmt.Exec() ); |
|
654 buf->Des().Zero(); |
|
655 |
|
656 // Close the Connection |
|
657 stmt.Close(); |
|
658 } |
|
659 } |
|
660 |
|
661 CleanupStack::PopAndDestroy( buf ); //buf |
|
662 |
|
663 // Notify the database change for Delete |
|
664 iDbNotifier->DbChangedL( ); |
|
665 } |
|
666 |
|
667 // --------------------------------------------------------------------------- |
|
668 // CEvtDatabase::UpdateEventStatusL |
|
669 // --------------------------------------------------------------------------- |
|
670 // |
|
671 void CEvtDatabase::UpdateEventStatusL( |
|
672 TEvtEventId aEvtId, |
|
673 TEvtEventStatus aEvtStatus) |
|
674 { |
|
675 EVTUIDEBUG( "+ CEvtDatabase::UpdateEventStatusL()" ); |
|
676 RSqlStatement stmt; |
|
677 TInt paramIndex; |
|
678 |
|
679 // Prepare the SQL statement for Status updation |
|
680 stmt.Prepare( iDb, KUpdateEventStatus ); |
|
681 |
|
682 // Set the Status parameter in SQL statement |
|
683 paramIndex=stmt.ParameterIndex( KStatus ); |
|
684 stmt.BindInt( paramIndex, aEvtStatus ); |
|
685 |
|
686 // Set the Id parameter in SQL statement |
|
687 paramIndex=stmt.ParameterIndex( KEventId ); |
|
688 stmt.BindInt64( paramIndex, aEvtId ); |
|
689 |
|
690 // Execute the Update SQL statement |
|
691 User::LeaveIfError( stmt.Exec() ); |
|
692 |
|
693 stmt.Close(); |
|
694 |
|
695 // Notify the database change for Modify |
|
696 iDbNotifier->DbChangedL( ); |
|
697 EVTUIDEBUG( "- CEvtDatabase::UpdateEventStatusL()" ); |
|
698 } |
|
699 |
|
700 // --------------------------------------------------------------------------- |
|
701 // CEvtDatabase::RemoveEventL |
|
702 // --------------------------------------------------------------------------- |
|
703 // |
|
704 void CEvtDatabase::RemoveEventL( TEvtEventId aEventId ) |
|
705 { |
|
706 EVTUIDEBUG( "+ CEvtDatabase::RemoveEventL()" ); |
|
707 |
|
708 // To maintain the Referential Integrity, we have to first delete |
|
709 // Action and then Event |
|
710 DeleteActionL( aEventId ); |
|
711 DeleteEventL( aEventId ); |
|
712 |
|
713 // Notify the database change for Delete |
|
714 iDbNotifier->DbChangedL( ); |
|
715 EVTUIDEBUG( "- CEvtDatabase::RemoveEventL()" ); |
|
716 } |
|
717 |
|
718 // --------------------------------------------------------------------------- |
|
719 // CEvtDatabase::GetEventsL |
|
720 // --------------------------------------------------------------------------- |
|
721 // |
|
722 void CEvtDatabase::GetEventsL( |
|
723 RSqlStatement& aStmt, |
|
724 RPointerArray<CEvtBasicEventInfo>& aEventArray ) |
|
725 { |
|
726 EVTUIDEBUG( "+ CEvtDatabase::GetEventsL() - Generic" ); |
|
727 |
|
728 TInt columnIndexEventId=0; |
|
729 TInt columnIndexStatus=1; |
|
730 TInt columnIndexSubject=2; |
|
731 TInt columnIndexPlace=3; |
|
732 TInt columnIndexRepeat=4; |
|
733 /* |
|
734 Note that the column can be looked up if necessary |
|
735 although this is more expensive |
|
736 TInt columnIndex=aStmt.ColumnIndex("location"); |
|
737 */ |
|
738 |
|
739 // Keep the count of the number of Events object that are pushed on to |
|
740 // Cleanup Stack. So that those many objects can be popped up later. |
|
741 TInt count=0; |
|
742 |
|
743 while( aStmt.Next() == KSqlAtRow ) |
|
744 { |
|
745 count++; |
|
746 CEvtBasicEventInfo* evt = CEvtBasicEventInfo::NewLC(); |
|
747 |
|
748 TUint32 value32 = aStmt.ColumnInt( columnIndexEventId ); |
|
749 evt->SetEventId( value32 ); |
|
750 |
|
751 TInt value = aStmt.ColumnInt( columnIndexStatus ); |
|
752 evt->SetEventStatus( static_cast<TEvtEventStatus>( value ) ); |
|
753 |
|
754 TPtrC subject=aStmt.ColumnTextL( columnIndexSubject ); |
|
755 evt->SetSubjectL( subject ); |
|
756 |
|
757 TPtrC place=aStmt.ColumnTextL( columnIndexPlace ); |
|
758 evt->SetPlaceL( place ); |
|
759 |
|
760 value = aStmt.ColumnInt( columnIndexRepeat ); |
|
761 evt->SetRepeat(value); |
|
762 |
|
763 aEventArray.Append( evt ); |
|
764 } |
|
765 |
|
766 // count number of objects from Cleanup stack |
|
767 CleanupStack::Pop( count ); |
|
768 EVTUIDEBUG( "- CEvtDatabase::GetEventsL() - Generic" ); |
|
769 } |
|
770 |
|
771 // --------------------------------------------------------------------------- |
|
772 // CEvtDatabase::UpdateEventTableL |
|
773 // --------------------------------------------------------------------------- |
|
774 // |
|
775 void CEvtDatabase::UpdateEventTableL( |
|
776 CEvtEvent& aEvtEvent ) |
|
777 { |
|
778 EVTUIDEBUG( "+ CEvtDatabase::UpdateEventTableL()" ); |
|
779 // Update all the attributes of an Event |
|
780 |
|
781 RSqlStatement stmt; |
|
782 TInt paramIndex; |
|
783 |
|
784 // We need to create the streams to insert large texts. |
|
785 RSqlParamWriteStream subjectStream; |
|
786 RSqlParamWriteStream placeStream; |
|
787 RSqlParamWriteStream descStream; |
|
788 CleanupClosePushL( subjectStream ); |
|
789 CleanupClosePushL( placeStream ); |
|
790 CleanupClosePushL( descStream ); |
|
791 |
|
792 // Prepare the SQL statement to Get Events based on Status |
|
793 stmt.Prepare( iDb, KUpdateEvent ); |
|
794 |
|
795 // Set Status |
|
796 paramIndex = stmt.ParameterIndex( KStatus ); |
|
797 stmt.BindInt( paramIndex, aEvtEvent.EventStatus() ); |
|
798 |
|
799 // Set Subject |
|
800 paramIndex = stmt.ParameterIndex( KSubject ); |
|
801 if( KNullDesC() == aEvtEvent.Subject() ) |
|
802 { |
|
803 stmt.BindNull( paramIndex ); |
|
804 } |
|
805 else |
|
806 { |
|
807 subjectStream.BindText( stmt, paramIndex ); |
|
808 subjectStream.WriteL( aEvtEvent.Subject() ); |
|
809 subjectStream.CommitL(); |
|
810 } |
|
811 |
|
812 // Set Place |
|
813 paramIndex = stmt.ParameterIndex( KPlace ); |
|
814 if( KNullDesC() == aEvtEvent.Place() ) |
|
815 { |
|
816 stmt.BindNull( paramIndex ); |
|
817 } |
|
818 else |
|
819 { |
|
820 placeStream.BindText( stmt, paramIndex ); |
|
821 placeStream.WriteL( aEvtEvent.Place() ); |
|
822 placeStream.CommitL(); |
|
823 } |
|
824 |
|
825 // Set Radius |
|
826 paramIndex = stmt.ParameterIndex( KRadius ); |
|
827 stmt.BindReal( paramIndex, aEvtEvent.Radius() ); |
|
828 |
|
829 // Set Description |
|
830 paramIndex = stmt.ParameterIndex( KDescription ); |
|
831 if( KNullDesC() == aEvtEvent.Description() ) |
|
832 { |
|
833 stmt.BindNull( paramIndex ); |
|
834 } |
|
835 else |
|
836 { |
|
837 descStream.BindText( stmt, paramIndex ); |
|
838 descStream.WriteL( aEvtEvent.Description() ); |
|
839 descStream.CommitL(); |
|
840 } |
|
841 |
|
842 // Set Repeat |
|
843 paramIndex = stmt.ParameterIndex( KRepeat ); |
|
844 stmt.BindInt( paramIndex, aEvtEvent.Repeat() ); |
|
845 |
|
846 // Set Id |
|
847 paramIndex = stmt.ParameterIndex( KEventId ); |
|
848 stmt.BindInt( paramIndex, aEvtEvent.EventId() ); |
|
849 |
|
850 // Execute the Remove SQL statement |
|
851 User::LeaveIfError( stmt.Exec() ); |
|
852 |
|
853 //Close the streams |
|
854 CleanupStack::PopAndDestroy( &descStream ); |
|
855 CleanupStack::PopAndDestroy( &placeStream ); |
|
856 CleanupStack::PopAndDestroy( &subjectStream ); |
|
857 |
|
858 stmt.Close(); |
|
859 |
|
860 EVTUIDEBUG( "- CEvtDatabase::UpdateEventTableL()" ); |
|
861 } |
|
862 |
|
863 // --------------------------------------------------------------------------- |
|
864 // CEvtDatabase::DeleteEventL |
|
865 // --------------------------------------------------------------------------- |
|
866 // |
|
867 void CEvtDatabase::DeleteEventL( |
|
868 TEvtEventId aEventId ) |
|
869 { |
|
870 EVTUIDEBUG( "+ CEvtDatabase::DeleteEventL()" ); |
|
871 |
|
872 RSqlStatement stmt; |
|
873 TInt paramIndex; |
|
874 |
|
875 // Prepare the SQL statement to Remove Action based on Id |
|
876 stmt.Prepare( iDb, KDeleteEvent ); |
|
877 |
|
878 // Set the Id parameter in SQL statement |
|
879 paramIndex = stmt.ParameterIndex( KEventId ); |
|
880 stmt.BindInt( paramIndex, aEventId ); |
|
881 |
|
882 // Execute the Remove SQL statement |
|
883 User::LeaveIfError( stmt.Exec() ); |
|
884 |
|
885 stmt.Reset(); |
|
886 stmt.Close(); |
|
887 |
|
888 EVTUIDEBUG( "- CEvtDatabase::DeleteEventL()" ); |
|
889 } |
|
890 |
|
891 // --------------------------------------------------------------------------- |
|
892 // CEvtDatabase::CheckIfEventPresentL |
|
893 // --------------------------------------------------------------------------- |
|
894 // |
|
895 TBool CEvtDatabase::CheckIfEventPresentL( |
|
896 TEvtEventId aId ) |
|
897 { |
|
898 EVTUIDEBUG( "+ CEvtDatabase::DeleteEventL()" ); |
|
899 |
|
900 RSqlStatement stmt; |
|
901 |
|
902 // Prepare the SQL statement to Get Action based on EvtId |
|
903 stmt.Prepare( iDb, KSelectEvent ); |
|
904 |
|
905 // Set the Id parameter in SQL statement |
|
906 TInt paramIndex=stmt.ParameterIndex( KEventId ); |
|
907 stmt.BindInt( paramIndex, aId ); |
|
908 |
|
909 // Flag to Check if the the Action is present |
|
910 TBool flag( EFalse ); |
|
911 |
|
912 // Set the other attributes of the Requested Event |
|
913 while( !flag && stmt.Next() == KSqlAtRow ) |
|
914 { |
|
915 flag = ETrue; |
|
916 } |
|
917 |
|
918 stmt.Close(); |
|
919 EVTUIDEBUG( "- CEvtDatabase::DeleteEventL()" ); |
|
920 |
|
921 return flag; |
|
922 } |
|
923 |
|
924 // --------------------------------------------------------------------------- |
|
925 // CEvtDatabase::CheckIfActionPresentL |
|
926 // --------------------------------------------------------------------------- |
|
927 // |
|
928 TBool CEvtDatabase::CheckIfActionPresentL( |
|
929 TInt64 aId ) |
|
930 { |
|
931 EVTUIDEBUG( "+ CEvtDatabase::CheckIfActionPresentL()" ); |
|
932 |
|
933 RSqlStatement stmt; |
|
934 |
|
935 // Prepare the SQL statement to Get Action based on EvtId |
|
936 stmt.Prepare( iDb, KSelectAction ); |
|
937 |
|
938 // Set the Id parameter in SQL statement |
|
939 TInt paramIndex=stmt.ParameterIndex( KId ); |
|
940 stmt.BindInt64( paramIndex, aId ); |
|
941 |
|
942 // Flag to Check if the the Action is present |
|
943 TBool flag( EFalse ); |
|
944 |
|
945 // Set the other attributes of the Requested Event |
|
946 while( !flag && stmt.Next() == KSqlAtRow ) |
|
947 { |
|
948 flag = ETrue; |
|
949 } |
|
950 |
|
951 stmt.Close(); |
|
952 EVTUIDEBUG( "- CEvtDatabase::CheckIfActionPresentL()" ); |
|
953 |
|
954 return flag; |
|
955 } |
|
956 |
|
957 // --------------------------------------------------------------------------- |
|
958 // CEvtDatabase::GetActionId |
|
959 // --------------------------------------------------------------------------- |
|
960 // |
|
961 TInt64 CEvtDatabase::GetActionId( |
|
962 TEvtEventId aId ) |
|
963 { |
|
964 EVTUIDEBUG( "+ CEvtDatabase::GetActionId()" ); |
|
965 TInt64 id=0; |
|
966 TInt columnIndexActionId=0; |
|
967 |
|
968 RSqlStatement stmt; |
|
969 |
|
970 // Prepare the SQL statement to Get Action based on EvtId |
|
971 stmt.Prepare( iDb, KSelectActionFromEvent ); |
|
972 |
|
973 // Set the Id parameter in SQL statement |
|
974 TInt paramIndex=stmt.ParameterIndex( KEvtId ); |
|
975 stmt.BindInt( paramIndex, aId ); |
|
976 |
|
977 // Flag to Check if the the Action is present |
|
978 TBool flag( EFalse ); |
|
979 |
|
980 // Set the other attributes of the Requested Event |
|
981 while( !flag && stmt.Next() == KSqlAtRow ) |
|
982 { |
|
983 id = stmt.ColumnInt64( columnIndexActionId ); |
|
984 flag = ETrue; |
|
985 } |
|
986 |
|
987 stmt.Close(); |
|
988 EVTUIDEBUG( "- CEvtDatabase::GetActionId()" ); |
|
989 |
|
990 return id; |
|
991 } |
|
992 |
|
993 // --------------------------------------------------------------------------- |
|
994 // CEvtDatabase::CreateActionL |
|
995 // --------------------------------------------------------------------------- |
|
996 // |
|
997 void CEvtDatabase::CreateActionL( |
|
998 CEvtAction& aEvtAction ) |
|
999 { |
|
1000 EVTUIDEBUG( "+ CEvtDatabase::CreateActionL()" ); |
|
1001 |
|
1002 RSqlStatement stmt; |
|
1003 |
|
1004 // Update Action table. |
|
1005 RSqlParamWriteStream actionStream; |
|
1006 CleanupClosePushL( actionStream ); |
|
1007 |
|
1008 // Prepare the SQL statement to update Action based on Id |
|
1009 stmt.Prepare( iDb, KInsertAction ); |
|
1010 |
|
1011 // Set the Action parameter in SQL statement |
|
1012 TInt paramIndex=stmt.ParameterIndex( KAction ); |
|
1013 if( KNullDesC() == aEvtAction.Action() ) |
|
1014 { |
|
1015 stmt.BindNull( paramIndex ); |
|
1016 } |
|
1017 else |
|
1018 { |
|
1019 actionStream.BindText( stmt, paramIndex ); |
|
1020 actionStream.WriteL( aEvtAction.Action() ); |
|
1021 actionStream.CommitL(); |
|
1022 } |
|
1023 |
|
1024 // Set the EvtId parameter in SQL statement |
|
1025 paramIndex=stmt.ParameterIndex( KEvtId ); |
|
1026 stmt.BindInt( paramIndex, aEvtAction.EvtId() ); |
|
1027 |
|
1028 // Actual Query execution that updates the database. |
|
1029 User::LeaveIfError( stmt.Exec() ); |
|
1030 |
|
1031 //Close the stream |
|
1032 CleanupStack::PopAndDestroy( &actionStream ); |
|
1033 stmt.Close(); |
|
1034 |
|
1035 //Set the new Action Id |
|
1036 aEvtAction.SetId( GetActionId( aEvtAction.EvtId() ) ); |
|
1037 |
|
1038 EVTUIDEBUG( "- CEvtDatabase::CreateActionL()" ); |
|
1039 |
|
1040 } |
|
1041 |
|
1042 // --------------------------------------------------------------------------- |
|
1043 // CEvtDatabase::UpdateActionL |
|
1044 // --------------------------------------------------------------------------- |
|
1045 // |
|
1046 void CEvtDatabase::UpdateActionL( |
|
1047 CEvtAction& aEvtAction ) |
|
1048 { |
|
1049 EVTUIDEBUG( "+ CEvtDatabase::UpdateActionL()" ); |
|
1050 |
|
1051 RSqlStatement stmt; |
|
1052 |
|
1053 // Update Action table. |
|
1054 RSqlParamWriteStream actionStream; |
|
1055 CleanupClosePushL( actionStream ); |
|
1056 |
|
1057 // Prepare the SQL statement to update Action based on Id |
|
1058 stmt.Prepare( iDb, KUpdateAction ); |
|
1059 |
|
1060 // Set the Action parameter in SQL statement |
|
1061 TInt paramIndex=stmt.ParameterIndex( KAction ); |
|
1062 if( KNullDesC() == aEvtAction.Action() ) |
|
1063 { |
|
1064 stmt.BindNull( paramIndex ); |
|
1065 } |
|
1066 else |
|
1067 { |
|
1068 actionStream.BindText( stmt, paramIndex ); |
|
1069 actionStream.WriteL( aEvtAction.Action() ); |
|
1070 actionStream.CommitL(); |
|
1071 } |
|
1072 |
|
1073 // Set the EvtId parameter in SQL statement |
|
1074 paramIndex=stmt.ParameterIndex( KEvtId ); |
|
1075 stmt.BindInt( paramIndex, aEvtAction.EvtId() ); |
|
1076 |
|
1077 // Set the Id parameter in SQL statement |
|
1078 paramIndex=stmt.ParameterIndex( KId ); |
|
1079 stmt.BindInt64( paramIndex, aEvtAction.Id() ); |
|
1080 |
|
1081 // Actual Query execution that updates the database. |
|
1082 User::LeaveIfError( stmt.Exec() ); |
|
1083 |
|
1084 //Close the stream |
|
1085 CleanupStack::PopAndDestroy( &actionStream ); |
|
1086 stmt.Close(); |
|
1087 |
|
1088 EVTUIDEBUG( "- CEvtDatabase::UpdateActionL()" ); |
|
1089 } |
|
1090 |
|
1091 // --------------------------------------------------------------------------- |
|
1092 // CEvtDatabase::DeleteActionL |
|
1093 // --------------------------------------------------------------------------- |
|
1094 // |
|
1095 void CEvtDatabase::DeleteActionL( |
|
1096 TEvtEventId aEventId ) |
|
1097 { |
|
1098 EVTUIDEBUG( "+ CEvtDatabase::DeleteActionL()" ); |
|
1099 |
|
1100 RSqlStatement stmt; |
|
1101 TInt paramIndex; |
|
1102 |
|
1103 // Prepare the SQL statement to Remove Action based on Id |
|
1104 stmt.Prepare( iDb, KDeleteAction ); |
|
1105 |
|
1106 // Set the Id parameter in SQL statement |
|
1107 paramIndex = stmt.ParameterIndex( KEvtId ); |
|
1108 stmt.BindInt( paramIndex, aEventId ); |
|
1109 |
|
1110 // Execute the Remove SQL statement |
|
1111 User::LeaveIfError( stmt.Exec() ); |
|
1112 |
|
1113 stmt.Close(); |
|
1114 |
|
1115 EVTUIDEBUG( "- CEvtDatabase::DeleteActionL()" ); |
|
1116 } |
|
1117 |
|
1118 // --------------------------------------------------------------------------- |
|
1119 // CEvtDatabase::SetObserver |
|
1120 // --------------------------------------------------------------------------- |
|
1121 // |
|
1122 void CEvtDatabase::SetObserver( MEvtStorageDbObserver* |
|
1123 aStorageDbObserver ) |
|
1124 { |
|
1125 EVTUIDEBUG( "+ CEvtDatabase::SetObserver()" ); |
|
1126 // Set the Observer to the database |
|
1127 iStorageDbObserver = aStorageDbObserver; |
|
1128 EVTUIDEBUG( "- CEvtDatabase::SetObserver()" ); |
|
1129 } |
|
1130 |
|
1131 // --------------------------------------------------------------------------- |
|
1132 // CEvtDatabase::HandleDbChangedL |
|
1133 // --------------------------------------------------------------------------- |
|
1134 // |
|
1135 void CEvtDatabase::HandleDbChangedL( ) |
|
1136 { |
|
1137 EVTUIDEBUG( "+ CEvtDatabase::HandleDbChangedL()" ); |
|
1138 |
|
1139 // If there is an observer to the database, notify it. |
|
1140 if( iStorageDbObserver ) |
|
1141 { |
|
1142 iStorageDbObserver->HandleStorageDbChangedL( ); |
|
1143 } |
|
1144 EVTUIDEBUG( "- CEvtDatabase::HandleDbChangedL()" ); |
|
1145 } |
|
1146 |
|
1147 // End of File |