You are not logged in.
Pages: 1
Hello, I am trying to implement the mormot unit with a third-party component called Digital-metaphor Reportbuilder, this has a feature that can be seen here: http://www.digital-metaphors.com:8080/D … DE_Plugins to add other database manager, and I'm working well but I had to make a small change to the sources, since I want this to work with several databases, the problem is that the reporbuilder needs to update some tables and I am using TSynDBDataSet that allows me to apply changes in the tables, this is all fine but when the tables are blank the TSynDBDataSet the ColumnDataSize calculation is wrong and if I use IgnoreColumnDataSize it works as a memo field even worse since reporbuilder is stricter with the definition of the table, for that reason make some changes so that the user that create a ClientDataSet with TSynDBDataSet is the one that decides how is the definition of the table and not the same mormot, being able to achieve something like this:
DataClient:=TSynDBDataSet.Create(nil);
DataClient.CommandText:='SELECT FOLDERID,FOLDERNAME,PARENTID FROM FOLDERS';
Ds1.DataSet:=DataClient;
DataClient.Connection:=FProp;
DataClient.OwnerDef:=True; // MY PROPERTY
with DataClient.FieldDefs do
begin
Clear;
Add('folderid',ftLargeint, 0);
Add('foldername',ftWideString, 60);
Add('parentid',ftLargeint);
end;
DataClient.Open;
the change I made in the unit SynDBVCL procedure InternalInitFieldDefs
procedure TSynBinaryDataSet.InternalInitFieldDefs;
var F: integer;
DBType: TFieldType;
S:String;
N:Integer;
begin
FieldDefs.Clear;
****************ADD*************
if (Owner is TSynDBDataSet) then begin
if TSynDBDataSet((Self).Owner).OwnerDef then begin //property add OwnerDef
with TSynDBDataSet((Self).Owner) do begin
for F := 0 to FieldDefList.Count-1 Do
TSynBinaryDataSet(Self).FieldDefs.Add(FieldDefList[F].Name,FieldDefList[F].DataType,FieldDefList[F].Size);
End;
exit;
end
end;
*************************************
if fDataAccess=nil then
exit;
for F := 0 to fDataAccess.ColumnCount-1 do
with fDataAccess.Columns[F] do begin
case ColumnType of
SynCommons.ftInt64: DBType := ftLargeint;
SynCommons.ftDate: DBType := ftDateTime;
SynCommons.ftUTF8: DBType := ftWideString; // means UnicodeString for Delphi 2009+
SynCommons.ftBlob: DBType := ftBlob;
SynCommons.ftDouble, SynCommons.ftCurrency: DBType := ftFloat;
else raise EDatabaseError.CreateFmt(
'GetFieldData ColumnType=%s',[TSQLDBFieldTypeToString(ColumnType)]);
end;
FieldDefs.Add(UTF8ToString(ColumnName),DBType,ColumnValueDBSize);
end;
end;
Any suggestion that you can do this in another way thanks.
Last edited by Ghiber (2018-02-22 17:53:35)
Offline
Maybe my TSynRestDataset in third-party samples can help you.
Esteban
Offline
ok thank you very much I will try it
Offline
Pages: 1