The iPhone Notes DB - Terrible
Since I’m developing the iPhoneNotes application i worked alot with the iPhone Notes database. This database is the data-source for my app. But it has a terrible layout:
CREATE TABLE Note (creation_date INTEGER, title TEXT, summary TEXT)
CREATE TABLE note_bodies (note_id INTEGER, data, UNIQUE(note_id))
- column
note_idis assigned to the rowid from theNotetable (don’t like that but it works) - In the Note database is the
titleof the note stored. And in thesummarycolumn is the content of the note store if it isn’t too big (absolutely don’t understand why?!?!) - the
datacolumn from thenote_bodiesdatabase contains the content of the note always. But in a really strange pseudo HTML format. Every line is in adivelement and sometimes it has abrelement at the end of the line. The problem is that thesedivtags are not every time closed correct. So it is impossible to parse it with an XML parser.(I hate things like that) - Because the content of the note is stored twice it has a terrible data redundancy! I don’t understand why that is needed.
So Apple please update the notes application in version 2.0. The actual note’s db is not how things should be done!
Riccardo responded on 22 Jun 2008 at 15:51 #
Hi,
does anybody can tell me how to convert the ITEGER type of the field “creation date” to date type or any timestamp field type?
Many thanks,
Riccardo
V1ru8 responded on 22 Jun 2008 at 16:04 #
NSDate *creationDate = [NSDate dateWithTimeIntervalSince1970:valueOfTheCreationDateField];
Or do you mean directly in the Database? Because I don’t think that SQLite has support for a “Date” format.
Riccardo responded on 22 Jun 2008 at 16:27 #
No, not directly I need to apply a conversion procedure to the field’s value: once imported in a tex field of a filemaker solution.
So I think what you suggested is a good solution, but probably i have to start calculating date from 01/01/1970 00:00? Becacause It seems to contain also a hour value.
Riccardo responded on 22 Jun 2008 at 23:05 #
Good: I found:
the date in iPhon end iPd Touch is indicated in number of secnds starting on 01/01/2001 at 00:00 (GMT).