[yunqa.de] Re: DISQLITE3: Sqlite file opens with pro version, but not personal version

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Fri, 25 Sep 2015 07:57:35 +0200

On 25.09.2015 00:06, Michael Hooker wrote:

Could it be that Disqlite3 personal is limited to sqlite3 files with certain
extensions ?

No, database file name extensions do not matter to DISQLite3, neither professional nor personal.

CREATE TABLE Sessions(SessionID integer primary key,LocationID integer not
null,StartTime datetime not null,EndTime datetime,CONSTRAINT LocationIDfk
FOREIGN KEY (LocationID) REFERENCES Locations);
>
CREATE TRIGGER SessionIDdeltrig BEFORE DELETE ON Sessions FOR EACH ROW BEGIN
DELETE FROM Flights WHERE SessionID = OLD.SessionID;END;

The table above uses features unsupported by DISQLite3 Personal, in particular table constraints and triggers. DISQLite3 supports those features, look at the feature chart here:

http://www.yunqa.de/delphi/doku.php/products/sqlite3/feature_chart

Before you can open the database with DISQLite3 Personal, you must remove constraints. SQLite does not have a dedicated command for this, but you can create a new table without constraints, transfer the data, delete the old table, and rename the new one. Here is an simple script for the table above that you can run in SQLiteSpy:

CREATE TABLE Temp AS SELECT * FROM Sessions;
DROP TABLE Sessions;
ALTER TABLE Temp RENAME TO Sessions;

Notice that this will drop indexes, so queries might run slower unless you recreate the indexes. Triggers are also dropped, but they do not effect reading the database.

Ralf
_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: