我正在使用Sql-Lite Db阅读Google Chrome历史记录。
表名:访问次数 结构:
+-----+------------------+-----------+-----+--------+-----+
| "0" | "id" | "INTEGER" | "0" | "NULL" | "1" |
| "1" | "url" | "INTEGER" | "1" | "NULL" | "0" |
| "2" | "visit_time" | "INTEGER" | "1" | "NULL" | "0" |
| "3" | "from_visit" | "INTEGER" | "0" | "NULL" | "0" |
| "4" | "transition" | "INTEGER" | "1" | "0" | "0" |
| "5" | "segment_id" | "INTEGER" | "0" | "NULL" | "0" |
| "6" | "visit_duration" | "INTEGER" | "1" | "0" | "0" |
+-----+------------------+-----------+-----+--------+-----+
我试图找出过渡意味着什么然后我找到了链接:Page Transitions并根据它Google Chrome stores a transition value which identifies the type of transition between pages. These are stored in the history database to separate visits, and are reported by the renderer for page navigations.
有许多类型的过渡,例如LINK
,TYPED
等......
在sql lite表中Google Chrome
整数值。
问题
如何从整数值中找出过渡?
DB中还有一些表,但它们都不包含任何表示这些值含义的表。
其他表格是:
答案 0 :(得分:1)
可能有点晚了,但我会把这个留给其他人。
以下是Chromium来源的相关代码 -
基本思想是从数据库中取整数值并转换为十六进制。 对其执行逻辑AND 操作并将结果转换回整数。 通过switch case运行它并获取字符串值。
对于Eg:在Javascript中,您可以执行以下操作。
>> "822083585".toString(16) & 0xff
1
>> "1610612736".toString(16) & 0xff
0
答案 1 :(得分:0)
基于@jayarma S答案和https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/content/public/common/page_transition_types.h
您可以按以下方式映射过渡类型:
您可以通过应用核心掩码获得这些核心转换类型值:0xFF
还有一些限定词也可以定义过渡:
您可以通过应用限定符掩码获取这些限定符转换类型值:0xFFFFFF00
这是一个SQLite查询,用于获取转换类型:
select u1.title as to_url_title,
u1.url as to_url,
CASE vs.transition & 0xff
WHEN 0
THEN 'LINK'
WHEN 1
THEN 'TYPED'
WHEN 2
THEN 'AUTO_BOOKMARK'
WHEN 3
THEN 'AUTO_SUBFRAME'
WHEN 4
THEN 'MANUAL_SUBFRAME'
WHEN 5
THEN 'GENERATED'
WHEN 6
THEN 'START_PAGE'
WHEN 7
THEN 'FORM_SUBMIT'
WHEN 8
THEN 'RELOAD'
WHEN 9
THEN 'KEYWORD'
WHEN 10
THEN 'KEYWORD_GENERATED'
ELSE NULL
END core_transition_type,
CASE vs.transition & 0xFFFFFF00
WHEN 0x01000000
THEN 'FORWARD_BACK'
WHEN 0x02000000
THEN 'FROM_ADDRESS_BAR'
WHEN 0x04000000
THEN 'HOME_PAGE'
WHEN 0x10000000
THEN 'CHAIN_START'
WHEN 0x20000000
THEN 'CHAIN_END'
WHEN 0x40000000
THEN 'CLIENT_REDIRECT'
WHEN 0x80000000
THEN 'SERVER_REDIRECT'
WHEN 0xC0000000
THEN 'IS_REDIRECT_MASK'
ELSE NULL
END qualifier_transition_type
from visits as vs
join urls u1 on u1.id = vs.url
order by vs.visit_time DESC;