FireDAC.Phys.SQLite.TFDSQLiteSecurity.SetPassword

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure SetPassword;

C++

void __fastcall SetPassword(void);

Properties

Type Visibility Source Unit Parent
procedure
function
public
FireDAC.Phys.SQLite.pas
FireDAC.Phys.SQLite.hpp
FireDAC.Phys.SQLite TFDSQLiteSecurity

Description

Adds the password and encrypts the database.

Use the SetPassword method to add a password and encrypt an unencrypted database. To perform this operation the Password must be specified.

Good practice before the SetPassword call:

  • Back up the original database file, manually or using TFDSQLiteBackup.
  • Verify the original database file, using CheckOnly. If there are errors, do not encrypt the database.

Note: Due to current SQLite encryption limitation, the SetPassword call fails when the database has blob fields with a value size greater than 1 DB page and the database does not fit into the SQLite cache. In this case, further access to the encrypted database will return the "database disk image is malformed" error.

In this case:

  • Restore the original database from backup.
  • Include soSetLargeCache into Options.
  • Perform SetPassword.

Note: The same considerations apply to the ChangePassword and RemovePassword calls.

See Also