function TDatabaseBase.GetSQLByName(SQLName:
string):
string;
var
SQLStream: TResourceStream;
SQLStrings: TStringList;
SQLStringsDecrypt: TStringList;
begin
Result := '
';
SQLStrings := TStringList.Create;
try
SQLStringsDecrypt := TStringList.Create;
try
SQLStream := TResourceStream.Create(HInstance, SQLName, PWideChar(conDatabaseResourceGroupString));
// MSSQL2012 z.B. entsprechend des Ressourcennamens den du vergeben hast
try
try
SQLStrings.LoadFromStream(SQLStream);
SQLStringsDecrypt.Text := TToolsCrypt.Decrypt(SQLStrings.Text, conKey);
// nur bei verschlüsseltem SQL nötig
Result := SQLStringsDecrypt.Text;
except
Result := '
';
end;
finally
SQLStream.Free;
end;
finally
SQLStringsDecrypt.Free;
end;
finally
SQLStrings.Free;
end;
end;
...
procedure TDatabase.FillList(List: TBlubbFieldList; TableName:
string);
var
I: Integer;
Qry: TFDQuery;
Field: TBlubbField;
begin
Qry := CreateQuery;
try
Qry.SQL.Text := Format(GetSQLByName('
TABLE_FIELDLIST'), [TableName]);
Qry.Open;
if not Qry.Eof
then
begin
List.Clear;
for I := 0
to Qry.Fields.Count - 1
do
begin
Field := TBlubbField.Create;
Field.FieldIndex := I;
Field.FieldName := Qry.Fields[I].FieldName;
Field.Fieldype := Qry.Fields[I].DataType;
List.Add(Field);
end;
end;
finally
Qry.Free;
end;
end;