Forum > Databases
TFMTBCDField - wrong range check
(1/1)
emilt:
With new Lazarus 2.2.0, an error started to appear on trying to update a TFMTBCDField:
--- Quote ---error: 1.00 is not between 0.00 and 0.00
--- End quote ---
This only happens when I set the field's ProviderFlags to include pfRefreshOnUpdate. It also happens when I try to insert with pfRefreshOnInsert.
Don't know if it is relevant, this is a Firebird 3 DECIMAL(15, 6) field, and I'm using FPC's IBConnection.
Maybe someone could point me at least where to look? TFMTBCDField looks OK to me. The range error should not appear if at least one of MinValue and MaxValue are 0.
emilt:
OK, found it!
https://gitlab.com/freepascal.org/fpc/source/-/commit/573917706fb5a5cffd76239e90ef62fdee041f68
The patch works for me. It's in FPC's RTL, so this must be rebuilt. I used
--- Code: Text [+][-]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";}};} ---fppkg install from the fpc\3.2.2\source\packages\rtl-objpas directory.
brick08:
This happens because when converting zero from a string and an integer, you get a different Precision.
Try it:
--- 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 bcd, sbcd, ibcd: tBCD;begin ibcd:=IntegerToBCD(0); sbcd:=StrToBCD('0'); if sbcd = ibcd then ShowMessage('Equals') else ShowMessage('Not Equals'); if sbcd = 0 then ShowMessage('sbcd = 0') else ShowMessage('sbcd <> 0'); if ibcd = 0 then ShowMessage('ibcd = 0') else ShowMessage('ibcd <> 0');
this patch helps me too, problem done
Navigation
[0] Message Index