Jump to content
weabow

[SOLVED] Delphi 12, FireDac, SQLite : capability not supported

Recommended Posts

Hi there,

 

I've an app which runs fine on Delphi 11, using crypted (aes-256) SQLite db, throught FireDac.

 

This code no longer runs under Delphi 12.

 

An error is fired from FireDAC.Phys.SQLiteWrapper.pas, procedure TSQLiteDatabase.Key(const AKey: String);, line 2119 : if Assigned(Lib.Fsqlite3_key) then begin...

 

It seems that Lib.Fsqlite3_key is not assigned.

 

Any idea will be very appreciated...

Edited by weabow

Share this post


Link to post

That same DocWiki page stated "The default linkage mode is static with SQLite version 3.31.1 with FDE."  so I would assume it would be backwards compatible.

Share this post


Link to post

It may depend on the uses list and its order. The different Stat units register different default values:

{FireDAC.Phys.SQLiteWrapper.FDEStat}
initialization
  TSQLiteLib.GLibClasses[slDefault] := TSQLiteLibFDEStat;
  TSQLiteLib.GLibClasses[slFDEStatic] := TSQLiteLibFDEStat;

{FireDAC.Phys.SQLiteWrapper.SSEStat}
initialization
  TSQLiteLib.GLibClasses[slDefault] := TSQLiteLibSEEStat;
  TSQLiteLib.GLibClasses[slSEEStatic] := TSQLiteLibSEEStat;

{FireDAC.Phys.SQLiteWrapper.Stat}
initialization
  TSQLiteLib.GLibClasses[slDefault] := TSQLiteLibStat;
  TSQLiteLib.GLibClasses[slStatic] := TSQLiteLibStat;

Manually adding FireDAC.Phys.SQLiteWrapper.FDEStat to the uses may solve the problem. I'd rather set the mode to an explicit value instead relying on a volatile default.

Share this post


Link to post

Thanks for your replies.


I've read the FireDAC SQLite Version Update  and I understand I have to use option 3 : Continue using SQLite 3.31.1 or previous versions with FireDAC encryption (FDE).

 

But I didn't see anywhere how to do that (sorry, it's not my best expertise).

 

What's the code I need to put and where ?

Share this post


Link to post

[SOLVED]

 

I've put on app boot a on the main form :

 

TFDPhysSQLiteDriverLink,

 

with the property :

EngineLinkage -> sIFDEStatic

 

Maybee an idea do do that from code ?

Edited by weabow
  • Like 1
  • Thanks 1

Share this post


Link to post

May be a stupid question; but I am correct with the option 'EngineLinkage -> sIFDEStatic' I don't need any external DLL? ( Now I deploy sqlite3.dll to all my clients ). Or is this other behaviour...

Share this post


Link to post

I think it depends on the OS target.

On Windows, I do not add any file

On Android, I add lib-native-activity.so

On MacOs I add libcdsqlite.dylib and libcrypto.dylib

On IOS I add ... nothing

On Linux I add ... nothing

 

But I'm not sure all these libraries concern SQLite

 

Share this post


Link to post
5 minutes ago, weabow said:

I think it depends on the OS target.

On Windows, I do not add any file

On Android, I add lib-native-activity.so

On MacOs I add libcdsqlite.dylib and libcrypto.dylib

On IOS I add ... nothing

On Linux I add ... nothing

 

But I'm not sure all these libraries concern SQLite

 

Great! I work only on the Windows platform. One DLL less 😉  So the Embarcadero guys did a translation found on the SQLITE.ORG source code to Delphi-Pascal? 

Share this post


Link to post
On 11/13/2023 at 10:46 AM, emileverh said:

So the Embarcadero guys did a translation found on the SQLITE.ORG source code to Delphi-Pascal? 

They just use OBJ just like with Zip and RegExp

Share this post


Link to post
On 11/13/2023 at 7:45 AM, weabow said:

[SOLVED]

 

I've put on app boot a on the main form :

 

TFDPhysSQLiteDriverLink,

 

with the property :

EngineLinkage -> sIFDEStatic

 

Maybee an idea do do that from code ?

You saved my day.

kind regards

gebhard

Share this post


Link to post

If someone want this in code, not in UI Designer:
 

I just created an object "FDPhysSQLiteDriverLink " at initialization and set the property. Works for me.

 

uses
  FireDAC.Phys.SQLiteWrapper.FDEStat,
  FireDAC.Phys.SQLiteWrapper,
  ...
 


var
  FDPhysSQLiteDriverLink : TFDPhysSQLiteDriverLink;

initialization
  FDPhysSQLiteDriverLink := TFDPhysSQLiteDriverLink.Create(nil);
  FDPhysSQLiteDriverLink.EngineLinkage  := slFDEStatic; // compatibility Delphi >=12
finalization  
  FDPhysSQLiteDriverLink.Free;
end.

 

Share this post


Link to post

No way for me to have the

TFDPhysSQLiteDriverLink

 with those uses... Can't find library

Share this post


Link to post

@weabow TFDPhysSQLiteDriverLink is in FireDAC.Phys.SQLite.pas

But if you copy-paste from here it won't work because after last "k" character there are some non-visible chars: EF BB BF EF BB BF                                                                            

 

Edited by Cristian Peța

Share this post


Link to post
Posted (edited)

i add unit FireDAC.Phys.SQLiteWrapper.FDEStat and now work :classic_cheerleader:

Edited by kabiri

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

×