Jump to content
dkounal

Attach tFDmemTables to memory sqlite database

Recommended Posts

Sqlite give the possibility to create two different ':memory:' databases and attach tables from the one database to the other.

Using firedac with a ':memory:' sqlite database, is it possible to attach TFDmemtables as sqlite (virtual) tables? If so, how?

Thank you in advance

Share this post


Link to post
37 minutes ago, Dmitry Arefiev said:

Thank you very much for your response

I have seen this documentation and I have already used TFDlocalSQL with TFDMemTables ONLY

The question is: In an existing TFDConnection fot SQLite with TFDTables and TFDQueries attached to it, can I add also a TFDLocalSQL and attach TFDMemTables?

I notice for example that multiple results are not supported that "If the application is using base datasets and local datasets connected to the same SQLite connection, the connection must be enabled explicitly before any dataset on this connection is opened/executed/prepared. Otherwise, an exception is raised."

I am not having the Enterprise version and I am a bit blind to use it in many cases, like the TFDDatSRow object that is not explained anywhere neither in the book of Jensen.

I have also find that in the above link, the examples at the end of the page goes to a Not Found http error

Thank you again in advance

Share this post


Link to post

see if my samples help you, here using SQLite driver on "memory" database ==>  :memory:   on two FDConnnection components, but you can use DB distincts, as you desire!

  • IMPORTANT:
    • Datasets with "unique names" in all system
    • the order of open can necessary to avoid "AV"
    • when creating by code is necessary add (register) the "datasets" with "names" on LocalSQL component - see on Help System!
    • when open this project you can see some "errors", but is because the components is defined as "open" by default here! just close all datasets, LocalSQL and FDConns
    • using FDMemTables, you needs save the "structure", firstly to use in LocalSQL - of course, already in tables, the structures already is saved on Database file!
  • RAD Studio 10.3.3 Arch
    • VCL project in 32bits 

Form components:

image.thumb.png.ff868a455e9dbda46c710adb58d89988.png

 

Project source

VCL_LocalSQL_and_FDMemTable_FDQuery_2_FDConnection_SQLite_DB_in_Memory.zip

 

hug

Edited by emailx45
  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×