|
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: SQLite Connection class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 #ifndef C_CMDMSQLITECONNECTION_H |
|
25 #define C_CMDMSQLITECONNECTION_H |
|
26 |
|
27 #include <e32base.h> |
|
28 |
|
29 #include "sqldb.h" // Symbian SQLite |
|
30 #include "cmdmmain.h" // TCMQueryCmdType |
|
31 |
|
32 /* Forward declarations. */ |
|
33 class CCmFillRule; |
|
34 class CCmMediaServerFull; |
|
35 class CCmStoreRule; |
|
36 class CCmBaseListItem; |
|
37 class CCmFillListItem; |
|
38 class CCmStoreListItem; |
|
39 class CCmDriveInfo; |
|
40 |
|
41 |
|
42 // CLASS DECLARATION |
|
43 /** |
|
44 * Class represents methods to communication with SQLite database API. |
|
45 * @lib cmdatabasemanager.lib |
|
46 * @since S60 5.1 |
|
47 */ |
|
48 NONSHARABLE_CLASS( CCmDmSQLiteConnection ): public CBase |
|
49 { |
|
50 |
|
51 public: |
|
52 |
|
53 // ID types |
|
54 enum TTypeOfID |
|
55 { |
|
56 ERuleGroupID = 1, |
|
57 ERuleID, |
|
58 ERuleParamID, |
|
59 EMediaServerID, |
|
60 EStoredID, |
|
61 EFilledID, |
|
62 EStoreRuleID, |
|
63 EStoreRuleParamID, |
|
64 EFillFileListId, |
|
65 EStoreFileListId |
|
66 }; |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 */ |
|
71 static CCmDmSQLiteConnection* NewL(); |
|
72 |
|
73 /** |
|
74 * Two-phased constructor. |
|
75 */ |
|
76 static CCmDmSQLiteConnection* NewLC(); |
|
77 |
|
78 /** |
|
79 * Destructor. |
|
80 */ |
|
81 virtual ~CCmDmSQLiteConnection(); |
|
82 |
|
83 /** |
|
84 * Open database (creates if doesn't exist) |
|
85 * |
|
86 * @since S60 5.1 |
|
87 * @param aDb, Database filename and path |
|
88 * @return TInt, Error code |
|
89 */ |
|
90 TInt OpenDb( const TDesC& aDb ); |
|
91 |
|
92 /** |
|
93 * Close opened database |
|
94 * |
|
95 * @since S60 5.1 |
|
96 * @param None |
|
97 * @return None |
|
98 */ |
|
99 void CloseDb(); |
|
100 |
|
101 /** |
|
102 * Initializes Database ids |
|
103 * |
|
104 * @since S60 5.1 |
|
105 * @param None |
|
106 * @return None |
|
107 */ |
|
108 void InitIDs(); |
|
109 |
|
110 /** |
|
111 * Initializes Database id |
|
112 * |
|
113 * @since S60 5.1 |
|
114 * @param aType, ID type |
|
115 * @return None |
|
116 */ |
|
117 void SetID( TTypeOfID aType ); |
|
118 |
|
119 /** |
|
120 * Backups id to database |
|
121 * |
|
122 * @since S60 5.1 |
|
123 * @param aType, ID type |
|
124 * @param aID, ID value |
|
125 * @return None |
|
126 */ |
|
127 void BackUpIdL( TTypeOfID aType, TUint64 aID ); |
|
128 |
|
129 /** |
|
130 * Loads Database ids |
|
131 * |
|
132 * @since S60 5.1 |
|
133 * @param None |
|
134 * @return None |
|
135 */ |
|
136 void LoadIDs(); |
|
137 |
|
138 /** |
|
139 * Loads Database id |
|
140 * |
|
141 * @since S60 5.1 |
|
142 * @param aId, ID value |
|
143 * @param aType, ID type |
|
144 * @return None |
|
145 */ |
|
146 void LoadIDL( TUint64& aId, TTypeOfID aType ); |
|
147 |
|
148 /** |
|
149 * Creates db file |
|
150 * @since S60 5.1 |
|
151 * @param aDb, Database filename and path |
|
152 * @return TInt, error code |
|
153 */ |
|
154 TInt CreateDbFile( const TDesC& aDb ); |
|
155 |
|
156 /** |
|
157 * Check Validity of database |
|
158 * |
|
159 * @since S60 5.1 |
|
160 * @param None |
|
161 * @return ETrue if database is OK |
|
162 */ |
|
163 TBool Validate(); |
|
164 |
|
165 /** |
|
166 * Execute sql command (not a query) |
|
167 * |
|
168 * @since S60 5.1 |
|
169 * @param aCommand, SQL clause to be executed (can include wildcards) |
|
170 * @return TInt, KErrNone if successful, otherwise one of the error codes. |
|
171 */ |
|
172 void ExecuteL( const TDesC8& aCommand ); |
|
173 |
|
174 /** |
|
175 * Sets fill file list into db |
|
176 * |
|
177 * @since S60 5.1 |
|
178 * @param aItems, fill list item array |
|
179 * @return TInt, Error code |
|
180 */ |
|
181 TInt SetFillFiles( RPointerArray<CCmFillListItem>& aItems ); |
|
182 |
|
183 /** |
|
184 * Sets store file list into db |
|
185 * |
|
186 * @since S60 5.1 |
|
187 * @param aItems, store list item array |
|
188 * @return TInt, Error code |
|
189 */ |
|
190 TInt SetStoreFilesL( RPointerArray<CCmStoreListItem>& aItems ); |
|
191 |
|
192 /** |
|
193 * Set one store file into db |
|
194 * |
|
195 * @since S60 5.1 |
|
196 * @param aItem, store list item |
|
197 * @return TInt, Error code |
|
198 */ |
|
199 TInt AddStoreFile( CCmStoreListItem& aItem ); |
|
200 |
|
201 /** |
|
202 * Add stored media into database |
|
203 * |
|
204 * @since S60 5.1 |
|
205 * @param aFileName, store file name |
|
206 * @param aUDN, mediaserver udn |
|
207 * @param aTimeStamp, timestamp |
|
208 * @return TInt, Error code |
|
209 */ |
|
210 TInt AddStoredL( |
|
211 const TDesC& aFileName, |
|
212 const TDesC8& aUDN, |
|
213 TTime aTimeStamp ); |
|
214 |
|
215 /** |
|
216 * Add fill rule into database |
|
217 * |
|
218 * @since S60 5.1 |
|
219 * @param aFillRule, fill list |
|
220 * @return TInt, Error code |
|
221 */ |
|
222 TInt AddFillRuleL( CCmFillRule* aFillRule ); |
|
223 |
|
224 /** |
|
225 * Add fill rule specific media servers |
|
226 * |
|
227 * @since S60 5.1 |
|
228 * @param aFillRule, fill list |
|
229 * @return TInt, Error code |
|
230 */ |
|
231 TInt AddFillRuleMediaServersL( CCmFillRule* aFillRule ); |
|
232 |
|
233 /** |
|
234 * Add fill rule informations and parameters |
|
235 * |
|
236 * @since S60 5.1 |
|
237 * @param aFillRule, fill list |
|
238 * @return TInt, Error code |
|
239 */ |
|
240 TInt AddFillRuleRulesAndParamsL( CCmFillRule* aFillRule ); |
|
241 |
|
242 /** |
|
243 * Add store rule |
|
244 * |
|
245 * @since S60 5.1 |
|
246 * @param aStoreRule, store list |
|
247 * @return TInt, Error code |
|
248 */ |
|
249 TInt AddStoreRuleL( CCmStoreRule* aStoreRule ); |
|
250 |
|
251 /** |
|
252 * Add store rule informations and parameters |
|
253 * |
|
254 * @since S60 5.1 |
|
255 * @param aStoreRule, store list |
|
256 * @return TInt, Error code |
|
257 */ |
|
258 TInt AddStoreRuleParamsL( CCmStoreRule* aStoreRule ); |
|
259 |
|
260 /** |
|
261 * Add store rule mediaServers |
|
262 * |
|
263 * @since S60 5.1 |
|
264 * @param aStoreRule, store list |
|
265 * @return TInt, Error code |
|
266 */ |
|
267 TInt AddStoreRuleMediaServersL( CCmStoreRule* aStoreRule ); |
|
268 |
|
269 /** |
|
270 * Add media server info into database |
|
271 * |
|
272 * @since S60 5.1 |
|
273 * @param aMediaServer, media server |
|
274 * @return TInt, Error code |
|
275 */ |
|
276 TInt AddMediaServerL( CCmMediaServerFull* aMediaServer ); |
|
277 |
|
278 /** |
|
279 * Add hash value |
|
280 * |
|
281 * @since S60 5.1 |
|
282 * @param aMediaServer, media server id |
|
283 * @param aHashValue, hash value |
|
284 * @return TInt, Error code |
|
285 */ |
|
286 TInt AddHashValue( TInt64 aMediaServerId, |
|
287 CCmSearchResponseHash* aHashValue ); |
|
288 |
|
289 /** |
|
290 * Query hash value |
|
291 * |
|
292 * @since S60 5.1 |
|
293 * @param aMediaServer, media server id |
|
294 * @param aHashValues, hash values |
|
295 * @return TInt, Error code |
|
296 */ |
|
297 TInt QueryHashValuesL( TInt aMediaServer, |
|
298 RPointerArray<CCmSearchResponseHash>& aHashValues ); |
|
299 |
|
300 /** |
|
301 * Sets is active status of the media server |
|
302 * Sets the Media server's name |
|
303 * @since S60 5.1 |
|
304 * @param aServers, server list |
|
305 * @return TInt, Error code |
|
306 */ |
|
307 TInt SetMediaServersL( |
|
308 RPointerArray<CCmMediaServerFull>& aServers ); |
|
309 |
|
310 /** |
|
311 * Sets last syncs time |
|
312 * @since S60 5.1 |
|
313 * @param None |
|
314 * @return TInt, Error code |
|
315 */ |
|
316 TInt SetSyncTime(); |
|
317 |
|
318 /** |
|
319 * Gets last syncs time |
|
320 * @since S60 5.1 |
|
321 * @param aTime last sync time |
|
322 * @return TInt, Error code |
|
323 */ |
|
324 TInt GetSyncTime( TTime& aTime ); |
|
325 |
|
326 /** |
|
327 * Sets Progress info |
|
328 * @since S60 5.1 |
|
329 * @param aTransferred how many files transferred |
|
330 * @param aTotalCount how many will be trasferred |
|
331 * @return TInt, Error code |
|
332 */ |
|
333 TInt SetProgressInfo( TInt aTransferred, TInt aTotalCount ); |
|
334 |
|
335 /** |
|
336 * Gets Progress info |
|
337 * @since S60 5.1 |
|
338 * @param aTransferred how many files transferred |
|
339 * @param aTotalCount how many will be trasferred |
|
340 * @return TInt, Error code |
|
341 */ |
|
342 TInt GetProgressInfo( TInt& aTransferred, TInt& aTotalCount ); |
|
343 |
|
344 /** |
|
345 * Sets Drives info |
|
346 * @since S60 5.1 |
|
347 * @param aDrives, drives to be set into database |
|
348 * @return TInt, None |
|
349 */ |
|
350 void SetDrivesL( RPointerArray<CCmDriveInfo>& aDrives ); |
|
351 |
|
352 /** |
|
353 * Delete media server info from the database |
|
354 * |
|
355 * @since S60 5.1 |
|
356 * @param aUDN, server udn |
|
357 * @return TInt, Error code |
|
358 */ |
|
359 TInt DeleteMediaServer( const TDesC8& aUDN ); |
|
360 |
|
361 /** |
|
362 * Delete fill rule |
|
363 * |
|
364 * @since S60 5.1 |
|
365 * @param aName, fill list name |
|
366 * @return TInt, Error code |
|
367 */ |
|
368 TInt DeleteFillRuleByName( const TDesC8& aName ); |
|
369 |
|
370 /** |
|
371 * Delete all fill rules |
|
372 * |
|
373 * @since S60 5.1 |
|
374 * @param None |
|
375 * @return TInt, Error code |
|
376 */ |
|
377 TInt DeleteAllFillRules(); |
|
378 |
|
379 /** |
|
380 * Delete all store rules |
|
381 * |
|
382 * @since S60 5.1 |
|
383 * @param None |
|
384 * @return TInt, Error code |
|
385 */ |
|
386 TInt DeleteAllStoreRules(); |
|
387 |
|
388 /** |
|
389 * Delete all fill files |
|
390 * |
|
391 * @since S60 5.1 |
|
392 * @param None |
|
393 * @return TInt, Error code |
|
394 */ |
|
395 TInt DeleteFillFiles(); |
|
396 |
|
397 /** |
|
398 * Delete all store files |
|
399 * |
|
400 * @since S60 5.1 |
|
401 * @param None |
|
402 * @return TInt, Error code |
|
403 */ |
|
404 TInt DeleteStoreFiles(); |
|
405 |
|
406 /** |
|
407 * Delete deleted items |
|
408 * |
|
409 * @since S60 5.1 |
|
410 * @param None |
|
411 * @return None |
|
412 */ |
|
413 void DeleteDeletedItemsL(); |
|
414 |
|
415 /** |
|
416 * Delete deleted media servers |
|
417 * |
|
418 * @since S60 5.1 |
|
419 * @param None |
|
420 * @return None |
|
421 */ |
|
422 void DeleteDeletedMediaServersL(); |
|
423 |
|
424 /** |
|
425 * Deletes hash values |
|
426 * |
|
427 * @since S60 5.1 |
|
428 * @param aMediaServerId, media server id |
|
429 * @param aSearchIndex, search index |
|
430 * @return None |
|
431 */ |
|
432 void DeleteHashValuesL( const TInt aMediaserverId, |
|
433 const TInt aSearchIndex ); |
|
434 |
|
435 /** |
|
436 * Update media server info |
|
437 * |
|
438 * @since S 60 5.1 |
|
439 * @param aMediaServer, mediaserver |
|
440 * @return TInt, Error code |
|
441 */ |
|
442 TInt UpdateMediaServerInfo( CCmMediaServerFull* aMediaServer ); |
|
443 |
|
444 /** |
|
445 * Update Fill rules selected state |
|
446 * |
|
447 * @since S60 5.1 |
|
448 * @param aName, fill list name |
|
449 * @param aSelected, selection status |
|
450 * @return TInt, Error code |
|
451 */ |
|
452 TInt UpdateFillRuleSelected( const TDesC8& aName, TInt aSelected ); |
|
453 |
|
454 /** |
|
455 * update the fill rule realsize and realcount field |
|
456 * @since S60 5.1 |
|
457 * @return TInt, error code |
|
458 */ |
|
459 TInt UpdateFillRuleGroupInfo(); |
|
460 |
|
461 /** |
|
462 * Update download history |
|
463 * |
|
464 * @since S60 5.1 |
|
465 * @param aMediaServerId, mediaserver id |
|
466 * @param aDownloadData, download data size |
|
467 * @param aDownloadTime, download time |
|
468 * @return TInt, Error code |
|
469 */ |
|
470 TInt UpdateDownloadHistory( TUint aMediaServerId, TInt64& aDownloadData, |
|
471 TInt64& aDownloadTime ); |
|
472 |
|
473 /** |
|
474 * Update upload history |
|
475 * |
|
476 * @since S60 5.1 |
|
477 * @param aMediaServerId, mediaserver id |
|
478 * @param aUploadData, upload data size |
|
479 * @param aUploadTime, upload time |
|
480 * @return TInt, Error code |
|
481 */ |
|
482 TInt UpdateUploadHistory( TUint aMediaServerId, TInt64& aUploadData, |
|
483 TInt64& aUploadTime ); |
|
484 |
|
485 /** |
|
486 * Update status values |
|
487 * |
|
488 * @since S60 5.1 |
|
489 * @param aStatusValues, item statuses |
|
490 * @return TInt, Error code |
|
491 */ |
|
492 TInt UpdateStatusValues( |
|
493 RPointerArray<CCmBaseListItem>& aStatusValues ); |
|
494 |
|
495 /** |
|
496 * Update fill list drive statuses |
|
497 * |
|
498 * @since S60 5.1 |
|
499 * @param aDrive, drive info |
|
500 * @para aDriveSelected, if ETrue drive selected but slot changed |
|
501 * @return None |
|
502 */ |
|
503 void UpdateFillListDriveStatusesL( CCmDriveInfo* aOrigDrive, |
|
504 CCmDriveInfo* aNewDrive, TBool aDriveSelected ); |
|
505 |
|
506 /** |
|
507 * Update fill list item priorities and status |
|
508 * |
|
509 * @since S60 5.1 |
|
510 * @param aContainer, fill list container |
|
511 * @return TInt, Error code |
|
512 */ |
|
513 TInt UpdateFillListItemPriority( CCmFillRuleContainer* aContainer ); |
|
514 |
|
515 /** |
|
516 * Update fill selection state into fill file table |
|
517 * |
|
518 * @since S60 5.1 |
|
519 * @param aListName, fill list name |
|
520 * @param aState, list status |
|
521 * @return None |
|
522 */ |
|
523 void SetFillListStateL( const TUint aListName, |
|
524 TCmFillRuleStatus aState ); |
|
525 |
|
526 /** |
|
527 * Restoring file statuses |
|
528 * |
|
529 * @since S60 5.1 |
|
530 * @param aFileNames, array of filled items |
|
531 * @param aListName, list name |
|
532 * @return None |
|
533 */ |
|
534 void RestoreFileStatusesL( |
|
535 const RPointerArray<CCmFillListItem>& aItems, |
|
536 const TDesC8& aListName ); |
|
537 |
|
538 /** |
|
539 * DoRestoring file statuses |
|
540 * |
|
541 * @since S60 5.1 |
|
542 * @param aItems, array of filled items |
|
543 * @param aStatus, Status to be restored |
|
544 * @return None |
|
545 */ |
|
546 void DoRestoreFileStatusesL( |
|
547 const RPointerArray<CCmFillListItem>& aItems, |
|
548 const TUint aStatus ); |
|
549 |
|
550 /** |
|
551 * Initializes all reference ids to zero |
|
552 * @since S60 5.1 |
|
553 * @param None |
|
554 * @return None |
|
555 */ |
|
556 void SetRefIdsToZero(); |
|
557 |
|
558 /** |
|
559 * Increment image shrinking history info |
|
560 * @since S60 5.1 |
|
561 * @param aImageCount, image count |
|
562 * @param aMilliSeconds, shrinking time |
|
563 * @return TInt, Error code |
|
564 */ |
|
565 TInt IncrementShrinkTimeL( TInt aImageCount, |
|
566 TInt aMilliSeconds ); |
|
567 |
|
568 /** |
|
569 * Prepare query |
|
570 * |
|
571 * @since S60 5.1 |
|
572 * @param Type, query type |
|
573 * @return None |
|
574 */ |
|
575 void PrepareQueryCmdL( TCMQueryCmdType aType ); |
|
576 |
|
577 /** |
|
578 * Query fill rule |
|
579 * |
|
580 * @since S60 5.1 |
|
581 * @param aFillRule, fill list |
|
582 * @return TInt, Error code |
|
583 */ |
|
584 TInt QueryFillRuleL( CCmFillRule* aFillRule ); |
|
585 |
|
586 /** |
|
587 * Query fill rule servers |
|
588 * |
|
589 * @since S60 5.1 |
|
590 * @param aFillRule, fill list |
|
591 * @param aRuleGroupID, rule group id |
|
592 * @return TInt, Error code |
|
593 */ |
|
594 TInt QueryFillRuleServersL( CCmFillRule* aFillRule, |
|
595 TUint64 aRuleGroupID ); |
|
596 |
|
597 /** |
|
598 * Query fill rule params |
|
599 * |
|
600 * @since S60 5.1 |
|
601 * @param aFillRule, fill list |
|
602 * @return TInt, Error code |
|
603 */ |
|
604 TInt QueryFillRuleParamsL( CCmFillRule* aFillRule ); |
|
605 |
|
606 /** |
|
607 * Query selected ( 1 = selected and 0 = unselected ) |
|
608 * fill rule names |
|
609 * |
|
610 * @since S60 5.1 |
|
611 * @param aNames, list names |
|
612 * @param aSelected, selection status |
|
613 * @return None |
|
614 */ |
|
615 void QuerySelectedFillRuleNamesL( RPointerArray<HBufC8>& aNames, |
|
616 TInt aSelected ); |
|
617 |
|
618 /** |
|
619 * Query names of all fill rules |
|
620 * |
|
621 * @since S60 5.1 |
|
622 * @param aNames, on return fill rule names |
|
623 * @return None |
|
624 */ |
|
625 void QueryFillRuleNamesL( RPointerArray<HBufC8>& aNames ); |
|
626 |
|
627 /** |
|
628 * Query store rule |
|
629 * |
|
630 * @since S60 5.1 |
|
631 * @param aStoreRule, store list |
|
632 * @return TInt, Error code |
|
633 */ |
|
634 TInt QueryStoreRuleL( CCmStoreRule* aStoreRule ); |
|
635 |
|
636 /** |
|
637 * Query store rule defs |
|
638 * |
|
639 * @since S60 5.1 |
|
640 * @param aStoreRule, store list |
|
641 * @param aRuleGroupID, rule group id |
|
642 * @return TInt, Error code |
|
643 */ |
|
644 TInt QueryStoreRuleDefsL( CCmStoreRule* aStoreRule, |
|
645 TUint64 aRuleGroupID ); |
|
646 |
|
647 /** |
|
648 * Query store rule names |
|
649 * |
|
650 * @since S60 5.1 |
|
651 * @param aNames, store list names |
|
652 * @return None |
|
653 */ |
|
654 void QueryStoreRuleNamesL( RPointerArray<HBufC8>& aNames ); |
|
655 |
|
656 /** |
|
657 * Query selected store rule namess |
|
658 * |
|
659 * @since S60 5.1 |
|
660 * @param aNames, store list names |
|
661 * @param aSelected, selection status |
|
662 * @return TInt, Error code |
|
663 */ |
|
664 void QuerySelectedStoreRuleNamesL( RPointerArray<HBufC8>& aNames, |
|
665 TInt aSelected ); |
|
666 |
|
667 /** |
|
668 * Query media server |
|
669 * |
|
670 * @since S60 5.1 |
|
671 * @param aMediaServer, mediaserver |
|
672 * @return TInt, Error code |
|
673 */ |
|
674 TInt QueryMediaServerL( CCmMediaServerFull* aMediaServer ); |
|
675 |
|
676 /** |
|
677 * Query media server Id |
|
678 * |
|
679 * @since S60 5.1 |
|
680 * @param aUDN, server udn |
|
681 * @return TInt64, Server id |
|
682 */ |
|
683 TInt64 QueryMediaServerId( const TDesC8& aUDN ); |
|
684 |
|
685 /** |
|
686 * Query media server udn |
|
687 * |
|
688 * @since S60 5.1 |
|
689 * @param aUDN, server udn |
|
690 * @param aId, server id |
|
691 * @return TInt, Error code |
|
692 */ |
|
693 TInt QueryMediaServerUdn( HBufC8*& aUdn, |
|
694 const TInt32 aId ); |
|
695 |
|
696 /** |
|
697 * Query all media servers |
|
698 * |
|
699 * @since S60 5.1 |
|
700 * @param aMediaServer, mediaserver |
|
701 * @return TInt, Error code |
|
702 */ |
|
703 TInt QueryAllMediaServersL( CCmMediaServerFull* aMediaServer ); |
|
704 |
|
705 /** |
|
706 * Get media servers |
|
707 * |
|
708 * @since S60 5.1 |
|
709 * @param aMediaServers, mediaserver list |
|
710 * @return None |
|
711 */ |
|
712 void GetMediaServersL( |
|
713 RPointerArray<CCmMediaServerFull>& aMediaServers ); |
|
714 |
|
715 /** |
|
716 * Query all lowest priority filled files |
|
717 * |
|
718 * @since S60 5.1 |
|
719 * @param aDrive, drive id |
|
720 * @param aFilled, list of filled items |
|
721 * @return TInt, Error code |
|
722 */ |
|
723 TInt GetLowPriorityFilledFilesL( TInt aDrive, |
|
724 RPointerArray<CCmFillListItem>& aFilled ); |
|
725 |
|
726 /** |
|
727 * Query all files defined in fill file list using fill list name as |
|
728 * a query parameter |
|
729 * |
|
730 * @since S60 5.1 |
|
731 * @param aItems, fill list items |
|
732 * @param aName, fill list name |
|
733 * @param aStatus, selection status |
|
734 * @return TInt, Error code |
|
735 */ |
|
736 TInt QueryFillFileListL( |
|
737 RPointerArray<CCmBaseListItem>& aItems, |
|
738 const TDesC8& aName, |
|
739 TUint aStatus ); |
|
740 |
|
741 /** |
|
742 * Query fill file list |
|
743 * @since S60 5.1 |
|
744 * @param aItems, fill list items |
|
745 * @param aStatus, list status |
|
746 * @return TInt, Error code |
|
747 */ |
|
748 TInt GetAllFillFilesL( |
|
749 RPointerArray<CCmFillListItem>& aItems, TUint aStatus ); |
|
750 |
|
751 /** |
|
752 * Query all files defined in store file list using store list name as |
|
753 * a query parameter |
|
754 * |
|
755 * @since S60 5.1 |
|
756 * @param aItems, store list items |
|
757 * @param aName, store list name |
|
758 * @param aStatus, store list status |
|
759 * @return TInt, Error code |
|
760 */ |
|
761 TInt QueryStoreFileListL( |
|
762 RPointerArray<CCmBaseListItem>& aItems, |
|
763 const TDesC8& aName, |
|
764 TUint aStatus ); |
|
765 |
|
766 /** |
|
767 * Query store file list |
|
768 * @since S60 5.1 |
|
769 * @param aItems, store list items |
|
770 * @param aStatus, list status |
|
771 * @return TInt, Error code |
|
772 */ |
|
773 TInt GetAllStoreFilesL( |
|
774 RPointerArray<CCmStoreListItem>& aItems, TUint aStatus ); |
|
775 |
|
776 /** |
|
777 * Query all files defined in fill file list |
|
778 * |
|
779 * @since S60 5.1 |
|
780 * @param aItems, fill list items |
|
781 * @return TInt, Error code |
|
782 */ |
|
783 TInt QueryAllFillFilesL( RPointerArray<CCmFillListItem>& aItems); |
|
784 |
|
785 /** |
|
786 * Query all files defined in store file list |
|
787 * |
|
788 * @since S60 5.1 |
|
789 * @param aItems, store list items |
|
790 * @return TInt, Error code |
|
791 */ |
|
792 TInt QueryAllStoreFilesL( RPointerArray<CCmStoreListItem>& aItems ); |
|
793 |
|
794 /** |
|
795 * Query stored row |
|
796 * |
|
797 * @since S60 5.1 |
|
798 * @param aFiles, stored items |
|
799 * @param aUDN, server udn |
|
800 * @param aAmount, item count |
|
801 * @return None |
|
802 */ |
|
803 void QueryStoredRowL( |
|
804 RPointerArray<HBufC16>& aFiles, |
|
805 const TDesC8& aUDN, |
|
806 TInt aAmount ); |
|
807 |
|
808 /** |
|
809 * Query transfer history |
|
810 * |
|
811 * @since S60 5.1 |
|
812 * @param aUdn, server udn |
|
813 * @param aDownloadData, downloaded data |
|
814 * @param aUploadData, uploaded data |
|
815 * @param aDownloadTime, download time |
|
816 * @param aUploadTime, upload time |
|
817 * @return None |
|
818 */ |
|
819 void QueryTransferHistory( |
|
820 const TDesC8& aUdn, |
|
821 TInt64& aDownloadData, |
|
822 TInt64& aUploadData, |
|
823 TInt64& aDownloadTime, |
|
824 TInt64& aUploadTime ); |
|
825 |
|
826 |
|
827 /** |
|
828 * Query deleted items list |
|
829 * |
|
830 * @since S60 5.1 |
|
831 * @param aUdn, server udn |
|
832 * @param aArray, deleted items |
|
833 * @param aStatus, item status |
|
834 * @return None |
|
835 */ |
|
836 void QueryDeletedItemsListsL( |
|
837 RPointerArray<CCmBaseListItem>& aArray, TUint aStatus ); |
|
838 |
|
839 /** |
|
840 * Query drives |
|
841 * |
|
842 * @since S60 5.1 |
|
843 * @param aDrives, drive array |
|
844 * @return None |
|
845 */ |
|
846 void QueryDrivesL( RPointerArray<CCmDriveInfo>& aDrives ); |
|
847 |
|
848 /** |
|
849 * Avarage image shrinking time |
|
850 * |
|
851 * @since S60 5.1 |
|
852 * @param None |
|
853 * @return TInt, Avarage image shrinking time in millisecond |
|
854 */ |
|
855 TInt GetAvgImageShrinkTime(); |
|
856 |
|
857 /** |
|
858 * Get list name using list id |
|
859 * |
|
860 * @since S60 5.1 |
|
861 * @param aListName, name of the fill list |
|
862 * @param aListId, id of the named list |
|
863 * @return None |
|
864 */ |
|
865 void GetFillListNameL( HBufC8*& aListName, |
|
866 const TInt64 aListId ); |
|
867 |
|
868 /** |
|
869 * Returns size of the named fill list |
|
870 * |
|
871 * @since S60 5.1 |
|
872 * @param aListName, fill list name |
|
873 * @param aStatus, list status |
|
874 * @return TInt64, size of the list |
|
875 */ |
|
876 TInt64 FillListSize( const TDesC8& aListName, TUint aStatus ); |
|
877 |
|
878 /** |
|
879 * Returns size of the named store list |
|
880 * |
|
881 * @since S60 5.1 |
|
882 * @param aListName, store list name |
|
883 * @param aStatus, lis status |
|
884 * @return TInt64, size of the list |
|
885 */ |
|
886 TInt64 StoreListSize( const TDesC8& aListName, TUint aStatus ); |
|
887 |
|
888 /** |
|
889 * Returns file count which are waiting to be stored |
|
890 * |
|
891 * @since S60 5.1 |
|
892 * @param aStatus, item status |
|
893 * @return TInt, size of the list |
|
894 */ |
|
895 TInt StoreFileCount( TUint aStatus ); |
|
896 |
|
897 /** |
|
898 * Returns file count which are waiting to be stored |
|
899 * |
|
900 * @since S60 5.1 |
|
901 * @param None |
|
902 * @return TInt, size of the list |
|
903 */ |
|
904 TInt StoreFileCountNoDuplicates(); |
|
905 |
|
906 /** |
|
907 * Returns file count which are waiting to be filled |
|
908 * |
|
909 * @since S60 5.1 |
|
910 * @param aStatus, item status |
|
911 * @return TInt, size of the list |
|
912 */ |
|
913 TInt FillFileCount( TUint aStatus ); |
|
914 |
|
915 /** |
|
916 * Returns data amount filled |
|
917 * @since S60 v3.1 |
|
918 * @param aID id of fill rule |
|
919 * @return sum of file sizes |
|
920 */ |
|
921 TInt64 BytesFilled( TUint aID ); |
|
922 |
|
923 /** |
|
924 * @since S60 5.1 |
|
925 * @param aMediaServerId, mediaserver id |
|
926 * @param aStatus, item status |
|
927 * @return TInt64, sum of file sizes |
|
928 */ |
|
929 TInt64 KBytesToBeFilled( TUint8 aMediaServerId, |
|
930 TUint aStatus ); |
|
931 |
|
932 /** |
|
933 * Returns data amount to be stored |
|
934 * |
|
935 * @since S60 5.1 |
|
936 * @param aMediaServerId, mediaserver id |
|
937 * @param aStatus, item status |
|
938 * @return TInt64, sum of file sizes |
|
939 */ |
|
940 TInt64 KBytesToBeStored( TUint8 aMediaServerId, |
|
941 TUint aStatus ); |
|
942 |
|
943 /** |
|
944 * Updates list size and approx. transfer time |
|
945 * |
|
946 * @since S60 5.1 |
|
947 * @param aService, service |
|
948 * @param aCount, pieces |
|
949 * @param aTime, in milliseconds |
|
950 * @return TInt, error code |
|
951 */ |
|
952 TInt UpdateTransferInfo( TCmService aService, |
|
953 TInt aCount, TInt aTime ); |
|
954 |
|
955 /** |
|
956 * Updates file status |
|
957 * |
|
958 * @since S60 5.1 |
|
959 * @param aStatus, transfer status |
|
960 * @param aFid, file id |
|
961 * @param aMsId, server id |
|
962 * @return None |
|
963 */ |
|
964 void UpdateStoreTransferStatus( TUint aStatus, |
|
965 TInt64 aFid, TInt64 aMsId ); |
|
966 |
|
967 /** |
|
968 * Updates file status |
|
969 * |
|
970 * @since S60 5.1 |
|
971 * @param aStatus, transfer status |
|
972 * @param aItem, fill list item |
|
973 * @return None |
|
974 */ |
|
975 void UpdateFillTransferStatus( TUint aStatus, |
|
976 CCmFillListItem* aItem ); |
|
977 |
|
978 /** |
|
979 * Get list size and approx. transfer time |
|
980 * |
|
981 * @since S60 5.1 |
|
982 * @param aService, service |
|
983 * @param aCount, pieces |
|
984 * @param aTime, in milliseconds |
|
985 * @return TInt, error code |
|
986 */ |
|
987 TInt GetTransferInfo( TCmService aService, TInt& aCount, TInt& aTime ); |
|
988 |
|
989 /** |
|
990 * Files to be stored and included into specified list |
|
991 * |
|
992 * @since S60 5.1 |
|
993 * @param aListName, store list name |
|
994 * @param aStatus, list status |
|
995 * @param aCount, pieces |
|
996 * @return TInt, error code |
|
997 */ |
|
998 TInt GetStoreFileCount( |
|
999 const TDesC8& aListName, |
|
1000 TUint aStatus, |
|
1001 TInt& aCount ); |
|
1002 |
|
1003 /** |
|
1004 * Files to be filled and included into specified list |
|
1005 * |
|
1006 * @since S60 5.1 |
|
1007 * @param aListName, fill list name |
|
1008 * @param aStatus, list status |
|
1009 * @param aCount, pieces |
|
1010 * @return TInt, error code |
|
1011 */ |
|
1012 TInt GetFillFileCount( |
|
1013 const TDesC8& aListName, |
|
1014 TUint aStatus, |
|
1015 TInt& aCount ); |
|
1016 |
|
1017 /** |
|
1018 * Files to be stored |
|
1019 * @since S60 5.1 |
|
1020 * @param aCount, file count |
|
1021 * @param aStatus, status |
|
1022 * @return None |
|
1023 */ |
|
1024 void GetStoreFileCountNoDuplicatesL( TInt& aCount, TUint aStatus ); |
|
1025 |
|
1026 /** |
|
1027 * Sets fill list real information |
|
1028 * |
|
1029 * @since S60 5.1 |
|
1030 * @param aListId, fill list id |
|
1031 * @param aRealCount, real item count |
|
1032 * @param aRealSize, real data size |
|
1033 * @return None |
|
1034 */ |
|
1035 void SetFillListRealCountAndSizeL( TInt64 aListId, |
|
1036 TInt64 aRealCount, TInt64 aRealSize ); |
|
1037 |
|
1038 /** |
|
1039 * Deletes in active rule servers |
|
1040 * @since S60 5.1 |
|
1041 * @param None |
|
1042 * @return TInt, error code |
|
1043 */ |
|
1044 TInt DeleteInActiveRuleServers(); |
|
1045 |
|
1046 /** |
|
1047 * Deletes in active rule servers |
|
1048 * |
|
1049 * @since S60 5.1 |
|
1050 * @param None |
|
1051 * @return TInt, error code |
|
1052 */ |
|
1053 TInt DeleteInActiveFiles(); |
|
1054 |
|
1055 /** |
|
1056 * Deletes item by FillListId |
|
1057 * |
|
1058 * @since S60 5.1 |
|
1059 * @param FillListId, fill list id |
|
1060 * @return TInt error code |
|
1061 */ |
|
1062 TInt DeleteItemsByFillListId( TInt aFillListId ); |
|
1063 |
|
1064 /** |
|
1065 * Returns rule id with defined type |
|
1066 * |
|
1067 * @since S60 5.1 |
|
1068 * @param aName, rule name |
|
1069 * @param aType, rule type |
|
1070 * @return TInt64, Rule id |
|
1071 */ |
|
1072 TInt64 RuleId( const TDesC8& aName, TCmRuleType aType ); |
|
1073 |
|
1074 |
|
1075 private: |
|
1076 |
|
1077 /** |
|
1078 * Performs the first phase of two phase construction. |
|
1079 */ |
|
1080 CCmDmSQLiteConnection(); |
|
1081 |
|
1082 /** |
|
1083 * Performs the second phase construction. |
|
1084 */ |
|
1085 void ConstructL(); |
|
1086 |
|
1087 |
|
1088 private: |
|
1089 |
|
1090 /** |
|
1091 * iDatabase, interface to Sqlite database |
|
1092 */ |
|
1093 RSqlDatabase iDatabase; |
|
1094 |
|
1095 /** |
|
1096 * iStatement, interface to Sqlite database |
|
1097 */ |
|
1098 RSqlStatement iStatement; |
|
1099 |
|
1100 /** |
|
1101 * rule group id |
|
1102 */ |
|
1103 TUint64 iRuleGroupID; |
|
1104 /** |
|
1105 * rule id |
|
1106 */ |
|
1107 TUint64 iRuleID; |
|
1108 /** |
|
1109 * rule param id |
|
1110 */ |
|
1111 TUint64 iRuleParamID; |
|
1112 /** |
|
1113 * mediaserver id |
|
1114 */ |
|
1115 TUint64 iMediaServerID; |
|
1116 /** |
|
1117 * stored id |
|
1118 */ |
|
1119 TUint64 iStoredID; |
|
1120 /** |
|
1121 * filled id |
|
1122 */ |
|
1123 TUint64 iFilledID; |
|
1124 /** |
|
1125 * store rule id |
|
1126 */ |
|
1127 TUint64 iStoreRuleID; |
|
1128 /** |
|
1129 * store rule param id |
|
1130 */ |
|
1131 TUint64 iStoreRuleParamID; |
|
1132 /** |
|
1133 * fill file id |
|
1134 */ |
|
1135 TUint64 iFillFileId; |
|
1136 /** |
|
1137 * store file id |
|
1138 */ |
|
1139 TUint64 iStoreFileId; |
|
1140 /** |
|
1141 * Query handle |
|
1142 */ |
|
1143 TInt iHandle; |
|
1144 |
|
1145 }; |
|
1146 |
|
1147 #endif // C_CMDMSQLITECONNECTION_H |