Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am writing some scanner for Google Chrome cookies, as stored in a SQLite database. It also has an option to delete cookies, however I didn't find any ID field. The most similar is creation_utc, I don't have much info about it, but I found out that it is some kind of timestamp. I would like to know if this value is unique or not.

I need this because while deleting some cookies I use a few fields, and it is not an optimal way to do it. If creation_utc is unique, it would take less time to delete the cookies.

share|improve this question

3 Answers 3

up vote 0 down vote accepted

By design, each combination of domain and path can only have one cookie with a specific name. (If a server sends a new cookie, the old one is replaced.)

So even when the database has another primary key (like you're suggesting in your own answer), I still feel the domain and path should be the real primary key.

share|improve this answer
    
I used this time-stamp converter and found that value in database cannot be converted into time format because is too big. So I think Google Chrome uses some advanced time-stamp and counts milliseconds, it let use this as primary key. –  ST3 Aug 26 '13 at 7:49

I have found an answer. I used query: PRAGMA table_info(cookies) it gave result all columns, their types and etc. One of the attributes was called pk (primary key). All columns had set to 0, but creation_utc is set to 1, so it is primary key.

share|improve this answer
    
This is, technically, correct; .schema Cookies tells you the same. Weird. –  Arjan Aug 26 '13 at 8:09

I guess creation_utc = UTC when the cookie was created. So no, it doesn't guarantee uniqueness.

If you just want to delete cookies for a single site, you can use this answer.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.