Oh that helps a lot, thanks a lot!
I have a question. Lets say you wanted to specifically create a database via App Delegate from the database that is preloaded with the phone.
IE:
Start game = Create a new database ('savegame.db') from the preloaded database ('readonly.db') and drop any ('savegame.db') that might already exist. In other words, never use 'readonly.db' as a resource except for reading.
Continue game = Load the ('savegame.db')
I have another question relating sqlite.
Can you combine primary key (INTEGER PRIMARY KEY) with the indexes, or rather should you?
Background
I am learning SQLite and seeing how it differs to MySQL, and I downloaded an app and explored its sql database.
The one thing I don't understand is why the programmer opted to use indexes rather than the primary keys.
According to the docs on
sqlite, "The PRIMARY KEY attribute normally creates a UNIQUE index on the column or columns that are specified as the PRIMARY KEY."
In the database I am looking at, the programmer:
1. Does not use primary keys at all
2. Has an index for every primary key. ie:
Code:
CREATE UNIQUE INDEX admin_flags_pk_index ON admin_flags(flag_id ASC)
So, my question is -- can someone clarify whether a unique index needs to be created for primary key's?