#1 mORMot 1 » Mormot and linux » 2018-11-17 21:04:42

burimm
Replies: 1

Can someone tell me, which of samples from 01 to 37 works on linux?

#2 Re: mORMot 1 » SynDBExploreFrame how to properly fill Dataset » 2017-04-18 20:06:13

Thanks @ab,

it works great if I put here:

begin
fJSONBuffer := Rows.FetchAllAsJSON(false);
lDataSet:=JSONToDataSet(Self, fJSONBuffer);
dbGrid1.DataSource.DataSet := lDataSet;
//....other lines non changed
.......
end

but, if I put here:

begin
fJSONBuffer := Rows.FetchAllAsJSON(false);
//....other lines non changed
.......

lDataSet:=JSONToDataSet(Self, fJSONBuffer);
dbGrid1.DataSource.DataSet := lDataSet;
end

there is an error:
TsynSQLTableDataset1: Field name missing

if i click BtnExec again - the same error but the number is incremented like
TsynSQLTableDataset2: Field name missing

Who is changing fJSONBuffer?

#3 mORMot 1 » SynDBExploreFrame how to properly fill Dataset » 2017-04-18 14:24:03

burimm
Replies: 2

Hi,
I have started to experiment with mormot - with sample 12 - SynDBExplorer.
In this segment of code:

with Frame do begin
              fJSONBuffer := Rows.FetchAllAsJSON(false);
              Stop := Timer.Stop;
              Table := TSQLTableJSON.Create('',pointer(fJSONBuffer),length(fJSONBuffer));
              fGrid := TSQLTableToGrid.Create(DrawGrid,Table,nil);
              fGrid.SetAlignedByType(sftCurrency,alRight);
              fGrid.OnValueText := OnText;
              fGrid.SetFieldFixedWidth(100);
              fGrid.FieldTitleTruncatedNotShownAsHint := true;
              DrawGrid.Options := DrawGrid.Options-[goRowSelect];
              DrawGrid.OnDblClick := self.OnGridDblClick;
              RowsCount := Table.RowCount;
              RowsSize := length(fJSONBuffer);
end;

I want to create a dataset and fill it so I can use it with my grid. Firstly just in read only mode.
During my experimenting i came to this (after declaring  F: TStringStream and lDataSet  : TDataSet)

with Frame do begin
              //....... the same code as above
              //....... and just added my code before end

              F:=TStringstream.Create('',TEncoding.UTF8);
              fGrid.Table.GetJSONValues( F,True);
              lDataSet:=JSONToDataSet(Self, F.DataString);
              dbGrid1.DataSource.DataSet := lDataSet;
              F.Free;
end 
// this works ok and very fast

My question is: How to do it without using  DrawGrid and fGrid as in this sample ??

Board footer

Powered by FluxBB