I am trying to query the SQL dialect of the Firebird database (using the built-in driver):
procedure TFrmFireDACEmbed.BtnGetDBDialectClick(Sender: TObject);
var
lFDConnection : TFDConnection;
lDriverLink : TFDPhysFBDriverLink;
l : Integer;
begin
if not DlgOpen.Execute then Exit;
lDriverLink := TFDPhysFBDriverLink.Create(nil);
lFDConnection := TFDConnection.Create(nil);
try
lDriverLink.DriverID := 'FBEmbedded';
lDriverLink.VendorLib := 'fbembed.dll'; // 32-bits embedded
lFDConnection.DriverName := S_FD_FBId;
lFDConnection.Params.Database := DlgOpen.FileName;
lFDConnection.Params.Add('Server=127.0.0.1');
lFDConnection.Params.UserName := 'SYSDBA';
lFDConnection.Params.Password := 'masterkey';
lFDConnection.LoginPrompt := False;
lFDConnection.Open;
l := lFDConnection.Params.IndexOf('SQLDialect');
if l <> -1 then
ShowMessage(lFDConnection.Params[l])
else
ShowMessage('SQLDialect not found');
finally
lFDConnection.Close;
lFDConnection.Free;
lDriverLink.Free;
end;
end;
But lFDConnection.Paramsonly contains DriverID, Database, Server, User_Name, Password.
The inspector shows:
(nil, $2F22820,
And lFDConnection.Params.SQLDialectnot recognized by the compiler.
Digging through the system tables, I found that for a 3 dB dialect
select mon$sql_dialect from mon$database
will return 3, but for an older version mon$databasedoes not exist.
How can I get an SQL dialect for any dialect?
The goal is to rewrite old code that used functions "under the hood", such as isc_attach_database, isc_database_info(which were supposed to be dynamically linked, GetProcAddressetc.).
source