#1 Re: mORMot 2 » ObjectToJSON problem » 2023-08-16 20:10:36

Not sure why the original code was written the way it was. I will go with that approach. 

Thank you

#2 Re: mORMot 2 » ObjectToJSON problem » 2023-08-16 17:06:18

I apologize for not posting the complete definition of my TSQLOrders

  TSQLOrders = class(TOrmVirtualTableAutoID)
  private
    fOrderID: Integer;
    fPart_Number: RawUTF8;
    fOrderNumber: RawUTF8;
    fMoldSize: Integer;
    fState: RawUTF8;
    fWeight: Double;
  published
    property OrderID: Integer read fOrderID write fOrderID;
    property OrderNumber: UTF8String read fOrderNumber write fOrderNumber;
    property State: UTF8String read fState write fState;
    property Part_Number: UTF8String read fPart_Number write fPart_Number;
    property Weight: Double read fWeight write fWeight;
    property MoldSize: Integer read fMoldSize write fMoldSize;
  end;

#3 mORMot 2 » ObjectToJSON problem » 2023-08-16 16:39:51

srclark71
Replies: 4

I am currently upgrading some projects to mORMot2 and have come across something that stopped working.  I can't really say why it was done this way and I have since made a workaround using just the TSQLJsonTable to read the data on the client side.  Any ideas as to why this doesn't work or if I maybe missed something?

  TSQLOrders = class(TOrmVirtualTableAutoID)


    aTable := TSQLTableJSON.Create('', JsonRecordSet);
    try
      newOrders := TSQLOrders.Create;
      try
        newOrders.FillPrepare(aTable);
        Result := ObjectToJSON(newOrders.FillTable);
      finally
        newOrders.Free;
      end;
    finally
      aTable.Free;
    end;
...
    Result = '{}'

#4 Re: mORMot 2 » TRestStorageExternal question » 2023-08-07 15:43:41

Thanks, this resolves my worries and I can move on with my updating.

#5 mORMot 2 » TRestStorageExternal question » 2023-08-07 14:26:01

srclark71
Replies: 2

I have been looking into updating our existing application to mORMot 2 and have a question about turning off the auto ID on a certain table.

I created a test application which is connecting to my SQL server fine using a TSQLRestServerDB.  My question is about accessing the TRestStorageExternal.Instance.

I came up with this and it doesn't throw any errors but am wondering if this is the correct way of coding this.  In my existing application I would just pass in the TSQLRestServerDB, but now it is needing a TRestOrmServer.

  MyServer := TSQLRestServerDB.Create(Model,':memory:');

  MyServer.CreateMissingTables;
  MyServer.AcquireExecutionMode[execORMGet] := amBackgroundORMSharedThread;
  MyServer.AcquireExecutionMode[execORMWrite] := amBackgroundORMSharedThread;
  MyServer.DB.UseCache := false;

  VStorage := TRestStorageExternal.Instance(TSQLUser, TRestOrmServer(MyServer.Server));

  if Assigned(VStorage) then
  begin
    VStorage.EngineAddForcedID := -1;
  end;

Thanks for any help

Board footer

Powered by FluxBB