views:

25

answers:

1

I need to use SQLite database file as a file for storing information, and I want to store the version of the file in the SQLite database file.

How can I do this? I mean, how to store unique (only one) data in SQLite? I don't want to use store the info by making table for this, as the version info is just one number.

+1  A: 

For SQLite, which is an embedded database, after all, there's nothing wrong with using a single table for holding a unique value like this.

sqlite> CREATE TABLE AppVersion (version);
sqlite> INSERT INTO AppVersion VALUES('1.0');
sqlite> SELECT * FROM AppVersion;
1.0
sqlite> UPDATE AppVersion SET version='1.1';
sqlite> SELECT * FROM AppVersion;
1.1

It's an embedded database. You expect good performance when you use it, not perfect performance. A single extra table (holding only a single row ever) shouldn't make any difference to any reasonable application.

Mark Rushakoff