I'm trying to query the SQL dialect of a Firebird database (using the embedded 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 the lFDConnection.Params
only contains DriverID
, Database
, Server
, User_Name
, Password
.
The inspector shows:
(nil, $2F22820, #$D#$A, nil, 0, ',', '"', '=', [soWriteBOM,soTrailingLineBreak,soUseLocale], (('DriverID=FB', nil), ('Database=D:\Temp\KLANTEN.GDB', nil), ('Server=127.0.0.1', nil), ('User_Name=SYSDBA', nil), ('Password=masterkey', nil), ('', nil), ('', nil), ('', nil)), 5, 8, False, dupIgnore, False, (FireDAC.Stan.Def.TFDDefinition.ParamsChanged,$2F5C4F0), (FireDAC.Stan.Def.TFDDefinition.ParamsChanging,$2F5C4F0), False, TFDConnectionDef($2F5C534) as IFDStanDefinition)
And lFDConnection.Params.SQLDialect
is not recognized by the compiler.
Digging though the system tables I found that for a dialect 3 db the query
select mon$sql_dialect from mon$database
will return 3, but for an older version mon$database
does not exist.
How can I retrieve the SQL dialect for any dialect?
The intention is to rewrite old code that used 'under the hood' functions like isc_attach_database
, isc_database_info
(which had to be dynamically linked, GetProcAddress
, etc).