Forum > Databases

Firebird 3 + Laz64 + TSQLQuery currency error

(1/4) > >>

Hello guys,

I've been using Lazarus for a lot years. I've built an entire ERP system on Lazarus 1.1 32bit but the project has grown so big that gdb crashes on every start (I think that debug information are too large, 256mb). I think it's time to start to port my project to the newer Lazarus but on every 64 bit release a find this very disturbing conversion problem in saving data to Firebird.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  q : TSQLQuery;  pCurr : Currency;begin    Result := True;   q := TSQLQuery.Create(nil);   try      q.Database := ifDB; // firebird connection      q.SQL.Text := 'UPDATE IF_DIBA_TESTATA SET DIBA_ARTICOLO_BASE_QTA = :par0 WHERE DIBA_ARTICOLO_ID = :par1 ';      pCurr := 1115;      q.Params[0].AsCurrency := pCurr;      q.Params[1].asInteger := impostazioni.DibaArticoloID;      q.ExecSQL;        q.SQL.Text := 'SELECT DIBA_ARTICOLO_BASE_QTA FROM IF_DIBA_TESTATA WHERE DIBA_ARTICOLO_ID = :par0 ';      q.Params[0].asInteger := impostazioni.DibaArticoloID;      q.Open;      if not(q.EOF) then        begin            WriteLn('Result: ' + CurrToStrF(q.Fields[0].asCurrency, ffGeneral, 2));        end;      q.Close;    except on ex : Exception do        begin           Result := False;           ifDB.Transaction.Rollback;           Application.MessageBox(PChar('Errore inaspettato nel tentativo di eseguire la query di aggiornamento al database Firebird:' + LineEnding +             ex.Message), 'Errore inaspettato', MB_OK + MB_ICONERROR);        end;   end;   q.Free;              
The ouput (and value really stored in the database) is: 

--- Quote ---Result: -729,6744

--- End quote ---

The same exact code and query worked in older lazarus or with ZeosDB. The field "DIBA_ARTICOLO_BASE_QTA" is a  decimal( 18, 8 ) in my firebird database.  What I'm doing wrong?


--- Quote from: lmdamiano on October 16, 2021, 02:46:39 pm ---on every 64 bit release
--- End quote ---

Is the result OK if you compile to 32 bit (with new version of Lazarus)?
It could be problem with fbclient.dll.

I'm downloading the latest 32bit release.
I've done more testing. It seems values lower than 922 are stored correctly, Higher than 922 became negative number.

Update: 32bit release works fine. Value are stored correctly.
Can we do something with the fpc64?

Did you check fbclient.dll (bitness, version)?


[0] Message Index

[#] Next page

Go to full version