SQLDBLibraryLoader doesn't work with Sqlite
Original Reporter info from Mantis: franciscoluiz
-
Reporter name: Francisco Luiz
Original Reporter info from Mantis: franciscoluiz
- Reporter name: Francisco Luiz
Description:
The SQLDBLibraryLoader component does not work when you specify the name of the SQLite library, when the name is different from sqlite3.dll.
Related here: http://forum.lazarus.freepascal.org/index.php/topic,19257.0.html
Steps to reproduce:
Start a new project.
Put SQLDBLibraryLoader component on form.
Write on FormCreate:
SQLDBLibraryLoader1.ConnectionType := 'SQLite3';
SQLDBLibraryLoader1.LibraryName := ExtractFilePath(Application.ExeName) + '\SOMELIB.dll';
SQLDBLibraryLoader1.Enabled := True;
SQLDBLibraryLoader1.LoadLibrary;
// make sure that the file SOMELIB.dll exists and is a valid sqlite library.
Put one button and one SQLTransaction1 on form, their source code:
var
SQLConnector1: TSQLConnector;
begin
SQLConnector1 := TSQLConnector.Create(nil);
SQLConnector1.DatabaseName := ExtractFilePath(Application.ExeName) + '\sqlitedb.dat';
SQLConnector1.ConnectorType := 'SQLite3';
SQLConnector1.Transaction := SQLTransaction1;
SQLConnector1.Connected := True;
SQLQuery1.DataBase := SQLConnector1;
SQLQuery1.Close;
SQLQuery1.SQL.Clear;
SQLQuery1.SQL.Add('select count(*) as count from table_that_exists');
SQLQuery1.Open;
Caption := SQLQuery1.FieldByName('count').AsString;