{$ifdef windows}
SQLDBLibraryLoaderWindows.ConnectionType:='SQLite3';
if FileExists('sqlite3-win.dll') then
begin
SQLDBLibraryLoaderWindows.LibraryName := 'sqlite3-win.dll';
SQLDBLibraryLoaderWindows.Enabled := true;
SQLDBLibraryLoaderWindows.LoadLibrary;
// Set the filename of the sqlite database
SQLite3Connection1.DatabaseName := 'QuickHashDBWin.sqlite';
// Create the database
CreateDatabase(SQLite3Connection1.DatabaseName);
if SQLIte3Connection1.Connected then lblConnectionStatus.Caption:= 'SQLite3 Database connection active';
end
else
begin
ShowMessage('Cannot create SQLite database. Ensure you extracted the sqlite-win.dll file from the zip file');
exit;
end;
{$else}
{$ifdef darwin}
SQLDBLibraryLoaderOSX.ConnectionType:='SQLite3';
// OSX sqlite file is a dynamic lib libsqlite3.dylib
if FileExists('/usr/lib/libsqlite3.dylib') then
begin
SQLDBLibraryLoaderOSX.LibraryName := '/usr/lib/libsqlite3.dylib';
SQLDBLibraryLoaderOSX.Enabled := true;
SQLDBLibraryLoaderOSX.LoadLibrary;
// Set the filename of the sqlite database
SQLite3Connection1.DatabaseName := 'QuickHashDBOSX.sqlite';
// Create the database
CreateDatabase(SQLite3Connection1.DatabaseName);
if SQLIte3Connection1.Connected then lblConnectionStatus.Caption:= 'SQLite3 Database connection active';
end
else
begin
ShowMessage('Cannot create SQLite database. Is SQLite installed?');
exit;
end;
{$else}
// If it's 64-bit Linux, use the 64-bit SQLite3 install
if FileExists('/usr/lib/x86_64-linux-gnu/libsqlite3.so.0') then
begin
SQLDBLibraryLoaderLinux.LibraryName := '/usr/lib/x86_64-linux-gnu/libsqlite3.so.0';
SQLDBLibraryLoaderLinux.Enabled := true;
SQLDBLibraryLoaderLinux.LoadLibrary;
// Set the filename of the sqlite database
SQLite3Connection1.DatabaseName := 'QuickHashDBLinux.sqlite';
// Create the database
CreateDatabase(SQLite3Connection1.DatabaseName);
if SQLIte3Connection1.Connected then lblConnectionStatus.Caption:= 'SQLite3 Database connection active';
end
// If it's 32-bit Linux, use the 32-bit SQLite3 install
else if FileExists('/usr/lib/i386-linux-gnu/libsqlite3.so.0') then
begin
SQLDBLibraryLoaderLinux.LibraryName := '/usr/lib/i386-linux-gnu/libsqlite3.so.0';
SQLDBLibraryLoaderLinux.Enabled := true;
SQLDBLibraryLoaderLinux.LoadLibrary;
// Set the filename of the sqlite database
SQLite3Connection1.DatabaseName := 'QuickHashDBLinux.sqlite';
// Create the database
CreateDatabase(SQLite3Connection1.DatabaseName);
if SQLIte3Connection1.Connected then lblConnectionStatus.Caption:= 'SQLite3 Database connection active';
end
else
begin
ShowMessage('Cannot create SQLite database. Ensure SQLite3 is installed in your Linux distribution');
exit;
end;
{$endif}
{$endif}