1

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.

ST3
  • 745
  • 2
  • 7
  • 22

3 Answers3

1

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.

ST3
  • 745
  • 2
  • 7
  • 22
1

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.

Arjan
  • 30,974
  • 14
  • 75
  • 112
  • I used [this](http://coderstoolbox.net/unixtimestamp/) 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 07:49
0

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.

gronostaj
  • 55,965
  • 20
  • 120
  • 179