PDA

View Full Version : Implementation help (database application)



jiveaxe
22nd January 2010, 17:06
Hi,
I have some doubts about the future development of my application; now it is essentially a database application which shows informations of a magazine's issues (articles, stories, authors, etc). All the data are stored in a sqlite file and the program queries it. Periodically I release new version of this file that the program downloads and installs. With the next main version I'd like to let the user add annotations, rate articles, etc. and, perhaps, build a sort of social network. But these personal informations must be stored somewhere; it can't be the file above since il will be replaced by new versions; I can't use a second database file because it isn't possible at the same time query two databases. Perhaps I should rethink the entire data structure, but this is a new field for me and I do not know what would be the best way. So here I am asking your suggestions on this matter or pointing me to a similar project.

Very thanks

tangential
5th February 2010, 02:01
http://www.sqlite.org/lang_attach.html

The above should help. Rather than replacing the database, have a set of tables that are the core information. either, use them attached, or attach your update database, get rid of the old info, and replace it from the new database.

so, for example, if you attach the database as "updates", you can then "insert into infotable select * from updates.infotable"

Hope this helps.

jiveaxe
5th February 2010, 17:58
Very thanks tangential,
your solution is great and simple; I've tried it in the console for now, but it should work with qt. Only an updates to your query:

insert or replace into infotable select * from updates.infotable

This for avoid the unique primary key error.

Regards