Firefox Bookmarks SQLite structure

前端 未结 5 1884
暖寄归人
暖寄归人 2021-01-30 00:02

I am trying to write a Firefox 3 add-on which will enable me to easily re-tag bookmarks. For example I have some bookmarks tagged \"development\" and some tagged \"Development\"

5条回答
  •  一生所求
    2021-01-30 00:13

    You probably already found out yourself, but tags are applied as follows:

    The central place for all URLS in the database is moz_places. The table moz_bookmarks refers to it by the foreign key column fk.

    If you tag a bookmark, there are multiple entries in moz_bookmarks, all having the same reference fk: The first is the bookmark itself (having the title in the title column) For each tag, there's an additional entriy in moz_bookmarks having the same foreign key fk and refering to the tag in the parent coumn (which points to the moz_bookmarks row for the tag).

    If you have a bookmark 'http://stackoverflow.com' titled 'Stackoverflow' with tags 'programming' and 'info', you will get:

    moz_places
    ----------
    id    url   (some more)
    3636  http://stackoverflow.com
    
    moz_bookmarks
    -------------
    id    type    fk     parent    title          (other columns omitted...)
    332   1       3636   5         Stackoverflow  (parent=5 -> unfiled folder)
    333   2       (NULL) 4         programming    (programming tag, parent=4 -> tags folder)
    334   1       3636   333       (NULL)         (link to 'programming' tag)
    335   2       (NULL) 4         info           (info tag, parent=4 see above)
    336   1       3636   335       (NULL)         (link to 'info' tag)
    

    Hope this helps...

提交回复
热议问题