Problem with numeric fields and FWH 25.01

User avatar
cnavarro
Posts: 6658
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Has thanked: 9 times
Been thanked: 12 times

Re: Problem with numeric fields and FWH 25.01

Post by cnavarro »

Dear Vilian
I've reviewed the latest changes made to classes that may affect this issue, and I haven't seen any significant changes that could alter the behavior compared to previous versions.
Can you provide me with a .sql file that can create the table (including the structure you use) and with some example rows?
Thanks
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
Silvio.Falconi
Posts: 7253
Joined: Thu Oct 18, 2012 7:17 pm
Has thanked: 2 times
Been thanked: 29 times

Re: Problem with numeric fields and FWH 25.01

Post by Silvio.Falconi »

vilian wrote: Fri Mar 28, 2025 7:17 pm Dear Cristobal,

The type of the fields is:

QTE DECIMAL(11,3)
VALOR DECIMAL(12,4)
I saw many topic on web with problems on MariaDb and Decimals


one man give me this link perhaps can help you
https://docs.oracle.com/javase/8/docs/a ... ormat.html
https://mariadb.com/kb/en/decimal/
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
cnavarro
Posts: 6658
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Has thanked: 9 times
Been thanked: 12 times

Re: Problem with numeric fields and FWH 25.01

Post by cnavarro »

vilian wrote: Wed Mar 19, 2025 11:12 am Hi Guys,
IF I run the code bellow with my previous version of FWH. I can see the value 3.3732. But if i run this same code with the new version of FWH, the value showed is 3.37. Do you know why ?

Code: Select all | Expand

function Main()
LOCAL oRs,oCn,oError,oQry,cQryMat

   SET DATE BRIT
   SET CENTURY ON
   
   CursorWait()

   oCn := Maria_Connect( aStr[1] )

   oRs := oCn:Query("SELECT nfiscal,cmat,qte,qtedig FROM consumo WHERE nfiscal LIKE '000005829%'")
   cQryMat := ""
   DO WHILE .NOT. oRs:Eof()
      cQryMat += "'"+oRs:cmat+"',"
      ? oRs:qte,oRs:qtedig,oRs:cmat
      oRs:Skip()
   ENDDO
   oRs:GoTop()
   
RETURN NIL
Dear Silvio
We'll have to try to find out why it worked correctly with the previous version ( 23.11 ), but not with the current one, right?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
vilian
Posts: 1019
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

Yes.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
vilian
Posts: 1019
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

Any Progress?
I really wanted update my FWH version to try webview2, but with this problem, I can't do it :(
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
cnavarro
Posts: 6658
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Has thanked: 9 times
Been thanked: 12 times

Re: Problem with numeric fields and FWH 25.01

Post by cnavarro »

Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
vilian
Posts: 1019
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

I sent it again to your email. please, let me know if you need something else.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
Enrico Maria Giordano
Posts: 8784
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 9 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by Enrico Maria Giordano »

We need a little sample to reproduce the problem. The sample must be compilable and runnable without any not available external dependencies (database included).
vilian
Posts: 1019
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

Hi Enrico,
I sent it by email to Cristobal.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
Antonio Linares
Site Admin
Posts: 42836
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 169 times
Been thanked: 123 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by Antonio Linares »

Dear Vilian,

Thanks to Hakan Öztürk as has found the difference in the code :D

It seems as Mr. Rao changed a call to hb_valStrnToNum() into a call to hb_strnToNum()

According to Mr. Rao's notes:

Code: Select all | Expand

#ifdef REMOVED
/*
               hb_arraySetND( aRow, i + 1, ( mrow[ i ] == NULL ? 0.0 : hb_strVal( mrow[ i ], aLen[ i ] ) ) );
               break;  // loss of accuracy in case of bigint large numbers
*/

/*
               // nor working in case of double datatpe with large numbers
               if( ! hb_valStrnToNum( mrow[ i ], aLen[ i ], &lValue, &dValue, &iDec, &iWidth ) )
               {
                  hb_arraySetNL( aRow, i + 1, ( long ) lValue );
               }
               else
               {
                  hb_itemPutNDLen( itemTmp, dValue, iWidth, iDec );
                  hb_arraySetForward( aRow, i + 1, itemTmp );
               }

               break;
*/
#endif
The modified code uses this now:

Code: Select all | Expand

            case 'N':

               if ( ( nAt = ( int ) hb_strAtI( "e", 1, mrow[ i ], aLen[ i ] ) ) > 0 )
               {
                  dValue = hb_strVal( mrow[ i ], aLen[ i ] );
                  x = ( int ) hb_strVal( mrow[ i ] + nAt, aLen[ i ] - nAt );
                  dValue *= pow( ( double ) 10.0, ( double ) x );
                  hb_arraySetND( aRow, i + 1, dValue );
               }
               else
               {
                  if ( hb_strnToNum( mrow[ i ], aLen[ i ], &lValue, &dValue ) )
                  {
                     hb_arraySetND( aRow, i + 1, dValue );
                  }
                  else
                  {
                     hb_arraySetNLL( aRow, i + 1, lValue );
                  }
               }
               break;
We can revert this change and send you a modified lib for your testing. Please let me know if you want it for 32 or 64 bits ? Borland or MSVC ? many thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
vilian
Posts: 1019
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

Dear Antonio,

I'm using Borland/32bits.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
ertan
Posts: 36
Joined: Wed Jul 26, 2023 12:08 pm
Location: Istanbul, Turkiye
Been thanked: 2 times

Re: Problem with numeric fields and FWH 25.01

Post by ertan »

Hi Vilian,

Can you solved your lost connection problems?

Best Regards,

Ertan Hakan ÖZTÜRK
ertan_ozturk@yahoo.com
vilian
Posts: 1019
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

Yes ;)
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
vilian
Posts: 1019
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

Antonio Linares wrote: Sun Apr 20, 2025 3:13 pm Dear Vilian,

Thanks to Hakan Öztürk as has found the difference in the code :D

It seems as Mr. Rao changed a call to hb_valStrnToNum() into a call to hb_strnToNum()

According to Mr. Rao's notes:

Code: Select all | Expand

#ifdef REMOVED
/*
               hb_arraySetND( aRow, i + 1, ( mrow[ i ] == NULL ? 0.0 : hb_strVal( mrow[ i ], aLen[ i ] ) ) );
               break;  // loss of accuracy in case of bigint large numbers
*/

/*
               // nor working in case of double datatpe with large numbers
               if( ! hb_valStrnToNum( mrow[ i ], aLen[ i ], &lValue, &dValue, &iDec, &iWidth ) )
               {
                  hb_arraySetNL( aRow, i + 1, ( long ) lValue );
               }
               else
               {
                  hb_itemPutNDLen( itemTmp, dValue, iWidth, iDec );
                  hb_arraySetForward( aRow, i + 1, itemTmp );
               }

               break;
*/
#endif
The modified code uses this now:

Code: Select all | Expand

            case 'N':

               if ( ( nAt = ( int ) hb_strAtI( "e", 1, mrow[ i ], aLen[ i ] ) ) > 0 )
               {
                  dValue = hb_strVal( mrow[ i ], aLen[ i ] );
                  x = ( int ) hb_strVal( mrow[ i ] + nAt, aLen[ i ] - nAt );
                  dValue *= pow( ( double ) 10.0, ( double ) x );
                  hb_arraySetND( aRow, i + 1, dValue );
               }
               else
               {
                  if ( hb_strnToNum( mrow[ i ], aLen[ i ], &lValue, &dValue ) )
                  {
                     hb_arraySetND( aRow, i + 1, dValue );
                  }
                  else
                  {
                     hb_arraySetNLL( aRow, i + 1, lValue );
                  }
               }
               break;
We can revert this change and send you a modified lib for your testing. Please let me know if you want it for 32 or 64 bits ? Borland or MSVC ? many thanks!
Good Morning Antonio,
When will it be available to me ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Post Reply