#1 Re: mORMot 2 » OrmTableDataSet.Close and OrmTableDataSet.Free is very slow » 2024-04-10 17:45:38

I know, but the interesting thing is why the speed is still low when datasource is set to nil. But when beginupdate is executed, the problem is solved.

#2 Re: mORMot 2 » OrmTableDataSet.Close and OrmTableDataSet.Free is very slow » 2024-04-05 09:49:14

I debugged it, closing is slow.

But you are right. I changed my code and sloved I don't khow why!!!!

    vwMain.BeginUpdate(); //cxgrid 
    //DataSource1.DataSet := nil;

#3 mORMot 2 » OrmTableDataSet.Close and OrmTableDataSet.Free is very slow » 2024-04-05 07:19:13

anouri
Replies: 4

Hello and thanks.
The following statements are very slow, for a json that has 300 records. It takes a few seconds:

  DataSource1.DataSet := nil;

  OrmTableDataSet.Close;
  OrmTableDataSet.Free;
  
  OrmTableDataSet := TOrmTableDataSet.CreateFromJson(nil , json);
 
  DataSource1.DataSet := OrmTableDataSet;

#4 Re: mORMot 2 » Beginner's questions... » 2024-04-02 19:43:53

Hi AB
many thanks to excellent mormot2 framework.
,what is the wrong with swagger :
(when I use TNullableUtf8Text)

Resolver error at paths./InvoiceService/Insert.post.parameters.0.schema.properties.AInvoice.properties.remarks.$ref
Could not resolve reference: Could not resolve pointer: /definitions/TNullableUtf8Text does not exist in document.

#5 Re: mORMot 2 » Beginner's questions... » 2024-03-04 21:40:31

Thank you.
Setter solved the problem. but i have alot of tables (600 tables), with many enum fields. I want to use existing database structure as possible.

procedure TOrmInvoice.SetSize(const Value: RawUtf8);
begin
  //xxlarge,xlarge,large,medium,small
  if Value = 'xxlarge' then
    FSize := '1'
  else if Value = 'xlarge' then
    FSize := '2'
  else if Value = 'large' then
    FSize := '3'
  else if Value = 'medium' then
    FSize := '4'
  else if Value = 'small' then
    FSize := '5';
end;

publish
  Size: RawUtf8;

field data type is enum('xxlarge','xlarge','large','medium','small');
I don't know where this conversion is happen. In orm level or Zeus level.

#6 Re: mORMot 2 » Beginner's questions... » 2024-03-04 11:37:38

I have truble in mormot + mysql + enum fields.
Imagine that the data type is enum('large','small') when entering information in the corresponding orm class, it should be written like this (Otherwise, the error "Data truncated for column 'column_name' will be generated):

Rec.size := '1';

That is, we must enter the enum index. While I used the enum text itself in the previous software:

query.fieldbyname('size').asstring := 'large';

The solution that comes to my mind is to find the corresponding index by a function based on the enum text and write like this:
Rec.size := Get_inum_index('large');

#7 Re: mORMot 2 » Beginner's questions... » 2024-03-03 08:42:30

Hi.
For reports I have very complex sql,what is the best way for executing this kind of sql?
Is it correct using :

function TReportService.Report: RawJson;
var
  MyComplexSql: RawUtf8;
begin
  MyComplexSql := 'my sql with left joins and subquery ...';
  Result := TRestServerDB(Self.Server).DB.ExecuteJson(MyComplexSql, True);
end;

#8 Re: mORMot 2 » Beginner's questions... » 2024-03-01 16:14:59

Hi AB. Thank you for very good mORMot framework.
This code work client side.
var
  OrmTable: TOrmTable;
  OrmTableDataSet: TOrmTableDataSet;
begin
  OrmTable := HttpClient.ExecuteList([],'select * from user limit 10');
  ShowMessage(OrmTable.RowCount.ToString);
  OrmTableDataSet := TOrmTableDataSet.Create(nil, OrmTable);

  DataSource1.DataSet := OrmTableDataSet;
end;


but in server side not working:Result is empty. I can't find why

procedure TUserService.List(var ATable: TOrmTable); //UserService is interface base service
begin
  ATable := Self.Server.ExecuteList([],'select * from user');
end;

#9 Re: mORMot 2 » Beginner's questions... » 2024-02-25 12:32:20

Hello . I want to check one of the demos related to mormot1 but TCQRSResult is missing in mormot2. What is its equivalent?

Board footer

Powered by FluxBB