#1 2018-04-15 11:30:58

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Backup/Restore inmemory sqlite database to/from Stream or BLOB

Hi,

Is there a way to do this without disk usage involved?

Last edited by Leslie7 (2018-04-15 11:32:13)

Offline

#2 2018-04-15 11:37:12

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Backup/Restore inmemory sqlite database to/from Stream or BLOB

I guess so, check https://synopse.info/forum/viewtopic.php?id=4478 which mentions the newly added sqlite feature https://www.sqlite.org/c3ref/serialize.html

Last edited by edwinsn (2018-04-15 11:39:07)


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#3 2018-04-15 17:57:25

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: Backup/Restore inmemory sqlite database to/from Stream or BLOB

Edwin,

I took a look at this, but it seemed that it was saving the entire database, index data included, so the size of the result is larger than necessary. For some use cases this could be the desired behavior though.

Last edited by Leslie7 (2018-04-15 22:15:03)

Offline

#4 2018-04-16 03:26:59

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Backup/Restore inmemory sqlite database to/from Stream or BLOB

@Leslie,
The old backup API does save the entire db data including the indexes either, it's the same in this regard. Not sure how to exclude the indexes...


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#5 2018-04-16 07:46:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,706
Website

Re: Backup/Restore inmemory sqlite database to/from Stream or BLOB

You may use ISQLDBRows.FetchAllToBinary of SynDBSQLite3 from SELECT * FROM TABLE to create a raw binary content of the database, without the indexes.
Then TSQLDBProxyStatementRandomAccess is able to read the data back.

Offline

Board footer

Powered by FluxBB