18 #ifndef DBSQLCONSTANTS_H |
18 #ifndef DBSQLCONSTANTS_H |
19 #define DBSQLCONSTANTS_H |
19 #define DBSQLCONSTANTS_H |
20 |
20 |
21 #include <cntdef.hrh> |
21 #include <cntdef.hrh> |
22 |
22 |
|
23 |
23 const TInt KInitialValue = -1; |
24 const TInt KInitialValue = -1; |
24 const TInt KNumOfTables = 16; |
25 const TInt KNumOfTables = 16; |
25 const TInt KNumColInPrefTable = 6; |
26 const TInt KNumColInPrefTable = 6; |
26 const TInt KNumColInContactTable = 16; |
27 const TInt KNumColInContactTable = 16; |
27 const TInt KNumColInGroupTable = 3; |
28 const TInt KNumColInGroupTable = 3; |
28 const TInt KNumColInCommTable = 5; |
29 const TInt KNumColInCommTable = 5; |
29 const TInt KNumColInPredSearchTable = 7; |
30 const TInt KNumColInPredSearchTable = 7; |
30 const TInt KNumColInPresenceTable = 5; |
31 const TInt KNumColInPresenceTable = 5; |
|
32 // TODO: qwerty-mail tables are not yet added here |
31 |
33 |
32 // tables in the contact database |
34 // tables in the contact database |
33 _LIT(KSqlContactTableName,"contact"); |
35 _LIT(KSqlContactTableName, "contact"); |
34 _LIT(KSqlContactGroupTableName,"groups"); |
36 _LIT(KSqlContactGroupTableName, "groups"); |
35 _LIT(KSqlContactPrefTableName,"preferences"); |
37 _LIT(KSqlContactPrefTableName, "preferences"); |
36 _LIT(KSqlContactCommAddrTableName,"comm_addr"); |
38 _LIT(KSqlContactCommAddrTableName, "comm_addr"); |
37 _LIT(KSqlContactPredSearchTable0,"predictivesearch0"); |
39 _LIT(KSqlContactPredSearchTable0, "predictivesearch0"); |
38 _LIT(KSqlContactPredSearchTable1,"predictivesearch1"); |
40 _LIT(KSqlContactPredSearchTable1, "predictivesearch1"); |
39 _LIT(KSqlContactPredSearchTable2,"predictivesearch2"); |
41 _LIT(KSqlContactPredSearchTable2, "predictivesearch2"); |
40 _LIT(KSqlContactPredSearchTable3,"predictivesearch3"); |
42 _LIT(KSqlContactPredSearchTable3, "predictivesearch3"); |
41 _LIT(KSqlContactPredSearchTable4,"predictivesearch4"); |
43 _LIT(KSqlContactPredSearchTable4, "predictivesearch4"); |
42 _LIT(KSqlContactPredSearchTable5,"predictivesearch5"); |
44 _LIT(KSqlContactPredSearchTable5, "predictivesearch5"); |
43 _LIT(KSqlContactPredSearchTable6,"predictivesearch6"); |
45 _LIT(KSqlContactPredSearchTable6, "predictivesearch6"); |
44 _LIT(KSqlContactPredSearchTable7,"predictivesearch7"); |
46 _LIT(KSqlContactPredSearchTable7, "predictivesearch7"); |
45 _LIT(KSqlContactPredSearchTable8,"predictivesearch8"); |
47 _LIT(KSqlContactPredSearchTable8, "predictivesearch8"); |
46 _LIT(KSqlContactPredSearchTable9,"predictivesearch9"); |
48 _LIT(KSqlContactPredSearchTable9, "predictivesearch9"); |
47 _LIT(KSqlContactPredSearchTable10,"predictivesearch10"); |
49 _LIT(KSqlContactPredSearchTable10, "predictivesearch10"); |
48 _LIT(KSqlContactPredSearchTable11,"predictivesearch11"); |
50 _LIT(KSqlContactPredSearchTable11, "predictivesearch11"); |
49 _LIT(KSqlContactPresenceTableName, "presence"); |
51 _LIT(KSqlContactPresenceTableName, "presence"); |
|
52 // There are also 44 qwerty-mail tables (qm0..qm43) |
|
53 |
50 |
54 |
51 enum TDatabaseTables |
55 enum TDatabaseTables |
52 { |
56 { |
53 EContactPrefTableName, |
57 EContactPrefTableName, |
54 EContactTableName, |
58 EContactTableName, |
64 KContactPredSearchTable7Name, |
68 KContactPredSearchTable7Name, |
65 KContactPredSearchTable8Name, |
69 KContactPredSearchTable8Name, |
66 KContactPredSearchTable9Name, |
70 KContactPredSearchTable9Name, |
67 KContactPredSearchTable10Name, |
71 KContactPredSearchTable10Name, |
68 KContactPredSearchTable11Name |
72 KContactPredSearchTable11Name |
|
73 // TODO: qwerty-mail tables are not yet added here |
69 }; |
74 }; |
70 |
75 |
71 // columns for contact table |
76 // columns for contact table |
72 _LIT(KContactId, "contact_id"); |
77 _LIT(KContactId, "contact_id"); |
73 _LIT(KContactTemplateId, "template_id"); |
78 _LIT(KContactTemplateId, "template_id"); |
373 _LIT(KPresenceStatusMsgParam, ":status_message"); |
378 _LIT(KPresenceStatusMsgParam, ":status_message"); |
374 _LIT(KPresenceCreateStmnt, |
379 _LIT(KPresenceCreateStmnt, |
375 "CREATE TABLE presence (contact_id INTEGER NOT NULL,\ |
380 "CREATE TABLE presence (contact_id INTEGER NOT NULL,\ |
376 account_uri VARCHAR(255),service_name VARCHAR(255),\ |
381 account_uri VARCHAR(255),service_name VARCHAR(255),\ |
377 status INTEGER, status_msg VARCHAR(255),\ |
382 status INTEGER, status_msg VARCHAR(255),\ |
378 CONSTRAINT contactid_fk FOREIGN KEY (contact_id) REFERENCES contact(contact_id) ON DELETE CASCADE);"); |
383 CONSTRAINT contactid_fk FOREIGN KEY (contact_id) REFERENCES contact(contact_id) ON DELETE CASCADE);"); |
|
384 |
|
385 |
|
386 // Predictive search for qwerty mail tables |
|
387 // columns |
|
388 _LIT(KPredSearchQwertyMailContactId, "contact_id"); |
|
389 _LIT(KPredSearchQwertyMailNameAsNumber, "n"); |
|
390 _LIT(KPredSearchQwertyMailNameAsNumber2, "n2"); |
|
391 _LIT(KPredSearchQwertyMailNameAsNumber3, "n3"); |
|
392 _LIT(KPredSearchQwertyMailNameAsNumber4, "n4"); |
|
393 _LIT(KPredSearchQwertyMailNameAsNumber5, "n5"); |
|
394 _LIT(KPredSearchQwertyMailNameAsNumber6, "n6"); |
|
395 _LIT(KPredSearchQwertyMailNameAsNumber7, "n7"); |
|
396 _LIT(KPredSearchQwertyMailFirstName, "first_name"); |
|
397 _LIT(KPredSearchQwertyMailLastName, "last_name"); |
|
398 |
|
399 // parameters |
|
400 _LIT(KPredSearchQwertyMailContactIdParam, ":contact_id"); |
|
401 _LIT(KPredSearchQwertyMailNameAsNumberParam, ":n"); |
|
402 _LIT(KPredSearchQwertyMailNameAsNumberParam2, ":n2"); |
|
403 _LIT(KPredSearchQwertyMailNameAsNumberParam3, ":n3"); |
|
404 _LIT(KPredSearchQwertyMailNameAsNumberParam4, ":n4"); |
|
405 _LIT(KPredSearchQwertyMailNameAsNumberParam5, ":n5"); |
|
406 _LIT(KPredSearchQwertyMailNameAsNumberParam6, ":n6"); |
|
407 _LIT(KPredSearchQwertyMailNameAsNumberParam7, ":n7"); |
|
408 _LIT(KPredSearchQwertyMailFirstNameParam, ":first_name"); |
|
409 _LIT(KPredSearchQwertyMailLastNameParam, ":last_name"); |
|
410 |
|
411 |
379 // Condition strings for searching id |
412 // Condition strings for searching id |
380 _LIT(KSelectCondition_SearchForEqual, "%S == :SeekId"); |
413 _LIT(KSelectCondition_SearchForEqual, "%S == :SeekId"); |
381 |
414 |
382 // SQLITE_SEQUENCE table stuff for getting last row_id |
415 // SQLITE_SEQUENCE table stuff for getting last row_id |
383 _LIT(KSelectLastIdSqlStmnt, "SELECT seq FROM SQLITE_SEQUENCE WHERE name = 'contact';"); |
416 _LIT(KSelectLastIdSqlStmnt, "SELECT seq FROM SQLITE_SEQUENCE WHERE name = 'contact';"); |