rgdawson 8 Posted October 9 I use Sqlite in several applications. I came across a simple little interface years ago from a Yury Plashenkov (https://github.com/plashenkov/SQLite3-Delphi-FPC)) and I thought it was simple and brilliant. Awhile later, I created my own based on Yury’s style, but taking advantage of some modern Delphi language features like interfaces and anonymous methods plus other goodies. (Yah, I read Nick Hodges book and needed something to do.) My version is on GitHub at (https://github.com/rgdawson/Rgd.Sqlite3) for anyone interested. The other day, it dawned on me that I could statically link the Sqlite3 binary into the exe quite easily, which was a surprise to me. Just include the unit FireDAC.Phys.SQLiteWrapper.Stat and presto, the Sqlite3 binary is statically linked and no more need to distribute sqlite3.dll with my project. As of Delphi 12.2, the version of Sqlite is 3.46.0. (I never tried this before Delphi 12, so YMMV) I use only the Pro version of Delphi, which does not include the source code to FireDAC, but I was able to include the unit and just let the IDE’s editor hints show me the function prototypes, like so: I had gotten used to compiling my own version of Sqlite, leaving out features I didn’t need to make it smaller/faster. And yes, you lose that ability when you statically link Delphi’s FireDAC version, which is not customizable and has every feature built in it. But any speed differences appear negligible to me, and I’ll trade having a bigger exe for the simplicity of a single executable file. Anyway, I'm sure many of you already knew how to do this and are thinking "big deal" , but I didn't. (I'm not a big FireDAC user.) This sort of made my day today being able to statically link Sqlite3 without using FireDAC for my access layer. I’d thought I’d share. 1 Share this post Link to post
Uwe Raabe 2063 Posted October 9 There are several SQLiteWrapper units supporting different libraries and linkage: FireDAC.Phys.SQLiteWrapperStat.pas, FireDAC.Phys.SQLiteWrapper.FDEStat.pas and FireDAC.Phys.SQLiteWrapper.SEEStat.pas, while dynamic linking is implemented in FireDAC.Phys.SQLiteWrapper.pas as default. There is also a way to select the required one: Drop a TFDPhysSQLiteDriverLink onto your main form or data module and set its EngineLinkage property to your needs. This even allows to switch linkage at runtime. Share this post Link to post
rgdawson 8 Posted October 9 8 minutes ago, Uwe Raabe said: There are several SQLiteWrapper units supporting different libraries and linkage: FireDAC.Phys.SQLiteWrapperStat.pas, FireDAC.Phys.SQLiteWrapper.FDEStat.pas and FireDAC.Phys.SQLiteWrapper.SEEStat.pas, while dynamic linking is implemented in FireDAC.Phys.SQLiteWrapper.pas as default. There is also a way to select the required one: Drop a TFDPhysSQLiteDriverLink onto your main form or data module and set its EngineLinkage property to your needs. This even allows to switch linkage at runtime. Thank you, sir. Yes, I discovered those, too. Today's project was a console app, designed to be run from a script on some server and query data out of a massive MS Project File and sent to some other server as Json. I had not yet thought about using the TFDPhysSQLiteDriverLink component since I'm not using FireDAC, per se. Now I have something new to think about. 🙂 I did once create an app where the data needed to be encrypted and I did use FireDAC as the access layer for that. I may experiment with using FDEStat and see if I can access encrypted data without using FireDAC otherwise. Cheers Share this post Link to post
Rollo62 538 Posted October 10 (edited) Maybe this has also to be considered https://docwiki.embarcadero.com/RADStudio/Athens/en/What's_New#FireDAC_SQLite_Version_Update https://blogs.embarcadero.com/new-firedac-driver-for-sqlite-see/ https://www.youtube.com/watch?v=hhzkxjYKv-g Quote RAD Studio 12.0 adds support to SQLite 3.42 while maintaining the option of using SQLite 3.31.1 with FireDAC encryption (FDE). Since version 3.42, SQLite dropped the mechanism FireDAC uses for encryption support, so it can no longer be used. Hence, there are three different ways of using SQLite with FireDAC: Use the latest version without FireDAC encryption. Use the paid SQLite EE (with the native SQLite encryption support), which FireDAC has supported since RAD Studio 11.0. Continue using SQLite 3.31.1 or previous versions with FireDAC encryption (FDE). When using encryption, you seemed to be locked in into an older version from 2020, if I understand this right. Either you use the paid EE, or the outdated FDE. Edited October 10 by Rollo62 Share this post Link to post
rgdawson 8 Posted October 10 Correct. As described, Sqlite did remove the SQLITE_HAS_CODEC compile option after 3.31.1. So, when you statically link with FireDAC.Phys.SQLiteWrapper.FDEStat.pas, that is the version you get. I was able to quickly re-wicker my simple Sqlite3 library to be able to use the FDEStat version on encrypted databases and for the rare times I need to encrypt the data, 3.31.1 is plenty fine, I guess, and a couple thousand dollar cheaper. I don't expect to ever get a paid SEE license due to cost. I'm happy to have options (1) and (3) at this point. And I just like doing Sqlite data access using a very simple, very thin layer to its native interface. FireDAC in its full glory is sorta overkill for my needs. I am pleased with what Delphi has done with regards to Sqlite in Version 12.x. Share this post Link to post