#1 2026-02-01 17:22:21

rcla
Member
Registered: 2025-12-13
Posts: 12

Orm with Boolean type and Batch

Basically, I'm using ORM with an external PostgreSQL database.

  
  TOrmBuy = class(TOrm)
  private
    fcant: integer;
    fprice: integer;
    fdescrip: RawUtf8;
    factive: Boolean;
    fexpimp: Boolean;
  published
    property cant: integer read fcant write fcant;
    property price: integer read fprice write fprice;
    property descrip: RawUtf8 read fdescrip write fdescrip;
    property active: Boolean read factive write factive;
    property expimp: Boolean read fexpimp write fexpimp;
  end;
  
  myBuy := TOrmBuy.Create;
  
  //This is filled in with the respective data 
  //Just to give one example (The values are actually filled in another function) 
  for i := 0 to 300 do
  begin
    myBuy.cant := 3;
    myBuy.active := True;
    ServerDB.Add(myBuy, True);
  end;

 
It works perfectly well. But obviously it will take some time.
 
That's why I decided to use Batch.

  myBatch := TRestBatch.Create(ServerDB.Orm,nil); 
  
  for i := 0 to 300 do
  begin
    myBuy.cant := 3;
    myBuy.active := True;
    myBatch.Add(myBuy,True);
  end;
  
  cresu := ServerDB.BatchSend(myBatch);

 
But there is an exception and it doesn't work:
TSqlDBPostgresLib Error "active" is type boolean but the expression is of type bigint

I understand that SQLite doesn't have a boolean type, but why does it work without Batch?

What do I need to do to make it work?

Thank you for any help you can provide.

Offline

Board footer

Powered by FluxBB