Sqlite - ATTACH DATABASE
Posted: 30.09.2008, 12:04
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:
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 )
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
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]);
But if i edit data in dane2.app_storage i edit data in app_storage (but in dane.db )
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('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
procedure TZGenericCachedResolver.PostUpdates(Sender: IZCachedResultSet;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
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