Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-02

TSqlite3Dataset and Attach Database

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Malcolm Poole

Hi,

Can anyone tell me if it is possible to attach another database file to a TSQlite3Dataset before opening a query.

I've tried using 'ATTACH "<filename>" AS dataDB;' as the first line of the DS SQL but I always get an error: 'dataDB is already in use'.

No error is returned if I run the SQL using
sqlite3_exec(DS.SqliteHandle...) but of course I can't access the returned table using the 'Fields' functions.

Thanks,

Malcolm

Reply by email

Malcolm Poole
to Malcolm Poole
Malcolm Poole wrote
Can anyone tell me if it is possible to attach another database file to a TSQlite3Dataset before opening a query.

OK, I worked this one out myself: I called
TSQlite3Dataset.ExecSQL('ATTACH "<filename>" AS dataDB;') before calling TSQlite3Dataset.Open and it worked.

It's amazing how the mere action of sending a question to a mailing list can stimulate the brain :)

Sorry about the noise,

Malcolm

Reply by email