Hi Joanne,
On Wed, 12 Dec 2007 16:20:17 -0800 (PST), Joanne Pham
<[EMAIL PROTECTED]> wrote:
>Hi Igor,
>Thanks for the response.
>Basiclly there is no SQL logic in SQLite.
I'm not sure what you mean here.
>I would like to check if the database version is xyz
>then I will have different action and if then database
>version is abc then I will have different action.
>So SQLite doesn't allow this luxury.
Sure it does, it even gives you a choice:
- use the schema version SQLite automatically maintains.
- set and use your own version number;
The only thing you can't do is use the version directly in SQL,
that is:
SELECT * FROM test1 WHERE ID = (PRAGMA schema_version);
is not a valid statement.
Both techniques are demonstrated below.
sqlite_version():3.5.3
CREATE TABLE test1 (
ID INTEGER PRIMARY KEY NOT NULL,
t1_name text
);
PRAGMA schema_version;
: 1
PRAGMA user_version;
: 0
PRAGMA user_version = 6001;
CREATE INDEX idx_t1_name ON test1 (t1_name);
PRAGMA schema_version;
: 2
PRAGMA user_version;
: 6001
CREATE TABLE test2 (
ID INTEGER PRIMARY KEY NOT NULL,
t2_name text
);
PRAGMA schema_version;
: 3
PRAGMA user_version;
: 6001
PRAGMA user_version = 6002;
INSERT INTO test1 VALUES (1,'alpha');
INSERT INTO test2 VALUES (2,'beta');
PRAGMA schema_version;
: 3
PRAGMA user_version;
: 6002
>Thanks,
>JP
I hope this helps,
--
( Kees Nuyt
)
c[_]
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------