1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ : 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef nsPlacesIndexes_h__ 8 #define nsPlacesIndexes_h__ 9 10 #define CREATE_PLACES_IDX(__name, __table, __columns, __type) \ 11 NS_LITERAL_CSTRING( \ 12 "CREATE " __type " INDEX IF NOT EXISTS " __table "_" __name \ 13 " ON " __table " (" __columns ")" \ 14 ) 15 16 /** 17 * moz_places 18 */ 19 #define CREATE_IDX_MOZ_PLACES_URL_HASH \ 20 CREATE_PLACES_IDX( \ 21 "url_hashindex", "moz_places", "url_hash", "" \ 22 ) 23 24 #define CREATE_IDX_MOZ_PLACES_FAVICON \ 25 CREATE_PLACES_IDX( \ 26 "faviconindex", "moz_places", "favicon_id", "" \ 27 ) 28 29 #define CREATE_IDX_MOZ_PLACES_REVHOST \ 30 CREATE_PLACES_IDX( \ 31 "hostindex", "moz_places", "rev_host", "" \ 32 ) 33 34 #define CREATE_IDX_MOZ_PLACES_VISITCOUNT \ 35 CREATE_PLACES_IDX( \ 36 "visitcount", "moz_places", "visit_count", "" \ 37 ) 38 39 #define CREATE_IDX_MOZ_PLACES_FRECENCY \ 40 CREATE_PLACES_IDX( \ 41 "frecencyindex", "moz_places", "frecency", "" \ 42 ) 43 44 #define CREATE_IDX_MOZ_PLACES_LASTVISITDATE \ 45 CREATE_PLACES_IDX( \ 46 "lastvisitdateindex", "moz_places", "last_visit_date", "" \ 47 ) 48 49 #define CREATE_IDX_MOZ_PLACES_GUID \ 50 CREATE_PLACES_IDX( \ 51 "guid_uniqueindex", "moz_places", "guid", "UNIQUE" \ 52 ) 53 54 /** 55 * moz_historyvisits 56 */ 57 58 #define CREATE_IDX_MOZ_HISTORYVISITS_PLACEDATE \ 59 CREATE_PLACES_IDX( \ 60 "placedateindex", "moz_historyvisits", "place_id, visit_date", "" \ 61 ) 62 63 #define CREATE_IDX_MOZ_HISTORYVISITS_FROMVISIT \ 64 CREATE_PLACES_IDX( \ 65 "fromindex", "moz_historyvisits", "from_visit", "" \ 66 ) 67 68 #define CREATE_IDX_MOZ_HISTORYVISITS_VISITDATE \ 69 CREATE_PLACES_IDX( \ 70 "dateindex", "moz_historyvisits", "visit_date", "" \ 71 ) 72 73 /** 74 * moz_bookmarks 75 */ 76 77 #define CREATE_IDX_MOZ_BOOKMARKS_PLACETYPE \ 78 CREATE_PLACES_IDX( \ 79 "itemindex", "moz_bookmarks", "fk, type", "" \ 80 ) 81 82 #define CREATE_IDX_MOZ_BOOKMARKS_PARENTPOSITION \ 83 CREATE_PLACES_IDX( \ 84 "parentindex", "moz_bookmarks", "parent, position", "" \ 85 ) 86 87 #define CREATE_IDX_MOZ_BOOKMARKS_PLACELASTMODIFIED \ 88 CREATE_PLACES_IDX( \ 89 "itemlastmodifiedindex", "moz_bookmarks", "fk, lastModified", "" \ 90 ) 91 92 #define CREATE_IDX_MOZ_BOOKMARKS_GUID \ 93 CREATE_PLACES_IDX( \ 94 "guid_uniqueindex", "moz_bookmarks", "guid", "UNIQUE" \ 95 ) 96 97 /** 98 * moz_annos 99 */ 100 101 #define CREATE_IDX_MOZ_ANNOS_PLACEATTRIBUTE \ 102 CREATE_PLACES_IDX( \ 103 "placeattributeindex", "moz_annos", "place_id, anno_attribute_id", "UNIQUE" \ 104 ) 105 106 /** 107 * moz_items_annos 108 */ 109 110 #define CREATE_IDX_MOZ_ITEMSANNOS_PLACEATTRIBUTE \ 111 CREATE_PLACES_IDX( \ 112 "itemattributeindex", "moz_items_annos", "item_id, anno_attribute_id", "UNIQUE" \ 113 ) 114 115 /** 116 * moz_keywords 117 */ 118 119 #define CREATE_IDX_MOZ_KEYWORDS_PLACEPOSTDATA \ 120 CREATE_PLACES_IDX( \ 121 "placepostdata_uniqueindex", "moz_keywords", "place_id, post_data", "UNIQUE" \ 122 ) 123 124 #endif // nsPlacesIndexes_h__ 125