Sqlite - ATTACH DATABASE

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
mariuszekpl
Senior Boarder
Senior Boarder
Posts: 54
Joined: 30.09.2008, 10:59

Sqlite - ATTACH DATABASE

Post by mariuszekpl »

I have two databases:
dane.db and dane2.db

in dane.db i have table app_storage
in dane2.db i have table app_storage too :)

In ZConnection2: TZConnection; I open dane.db ;

I attach dane2.db to database dane.db:

Code: Select all

 path := ExtractFilePath(application.ExeName)  ;
  ZSQLProcessor1.Script.text :=  format( ' ATTACH DATABASE "%s\dane2.db" as dane2 ',[path]);
I open dane2.app_storage table (It is table app_storage from dane2.db)

But if i edit data in dane2.app_storage i edit data in app_storage (but in dane.db )

2008-09-30 10:41:38 cat: Execute, proto: sqlite-3, msg: SELECT * FROM dane2.app_storage

2008-09-30 10:41:38 cat: Execute, proto: sqlite-3, msg: PRAGMA table_info('app_storage')
2008-09-30 10:41:40 cat: Execute, proto: sqlite-3, msg: UPDATE "app_storage" SET "key"='22222' WHERE "id"=1
2008-09-30 10:41:41 cat: Execute, proto: sqlite-3, msg: UPDATE "app_storage" SET "key"='222222' WHERE "id"=2
2008-09-30 10:41:42 cat: Execute, proto: sqlite-3, msg: UPDATE "app_storage" SET "key"='2222222' WHERE "id"=3
2008-09-30 10:41:44 cat: Execute, proto: sqlite-3, msg: UPDATE "app_storage" SET "key"='222222222' WHERE "id"=4
But should be:
2008-09-30 10:41:38 cat: Execute, proto: sqlite-3, msg: SELECT * FROM dane2.app_storage

2008-09-30 10:41:38 cat: Execute, proto: sqlite-3, msg: PRAGMA table_info('dane2.app_storage')
2008-09-30 10:41:40 cat: Execute, proto: sqlite-3, msg: UPDATE "dane2.app_storage" SET "key"='22222' WHERE "id"=1
2008-09-30 10:41:41 cat: Execute, proto: sqlite-3, msg: UPDATE "dane2.app_storage" SET "key"='222222' WHERE "id"=2
2008-09-30 10:41:42 cat: Execute, proto: sqlite-3, msg: UPDATE "dane2.app_storage" SET "key"='2222222' WHERE "id"=3
2008-09-30 10:41:44 cat: Execute, proto: sqlite-3, msg: UPDATE "dane2.app_storage" SET "key"='222222222' WHERE "id"=4
procedure TZGenericCachedResolver.PostUpdates(Sender: IZCachedResultSet;
UpdateType: TZRowUpdateType; OldRowAccessor, NewRowAccessor: TZRowAccessor);

->

function TZGenericCachedResolver.FormUpdateStatement(Columns: TObjectList;
OldRowAccessor, NewRowAccessor: TZRowAccessor): string;

->

function TZGenericCachedResolver.DefineTableName: string;

->

function TZGenericCachedResolver.ComposeFullTableName(Catalog, Schema,
Table: string): string;


Of course i can use ZUpdateSQL to generate update SQL to edit dane2.app_storage table but better way should be correct zeos commponents :D
You do not have the required permissions to view the files attached to this post.
mariuszekpl
Senior Boarder
Senior Boarder
Posts: 54
Joined: 30.09.2008, 10:59

Small patch to add support attach database in sqlite

Post by mariuszekpl »

I fix it :)
In attachment file you can find my ZDbcSqLiteMetadata.pas
You do not have the required permissions to view the files attached to this post.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Committed to SVN Testing Branch (rev. 478). I Intend to apply this to 6.6-patches branch as well.

Mark
Image
Post Reply