FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour database class version 9.02 differences
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
database class version 9.02 differences
Posted: Fri Mar 13, 2009 05:58 PM

For James and Antonio,

Database class

I am using TDATA now with the new database class fom version 9.02.

Testing the length of a buffered field ( N,3.0) now returns 10 but the field is only 3.

If I link in the old database.prg the values are correct.

Regards,
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: database class version 9.02 differences
Posted: Sat Mar 14, 2009 07:54 PM
Otto,

This example is working fine with FWH 9.02:
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   local oDbf

   DbCreate( "test", { { "age", "N", 3, 0 } } )

   USE test

   DATABASE oDbf

   MsgInfo( Len( Str( oDbf:age ) ) )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: database class version 9.02 differences
Posted: Sat Mar 14, 2009 08:34 PM

Hello Antonio,
yes you are right.
But inside my program the values are different.
There must be something in between.
I will try to make a small example.

Best regards,
Otto

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: database class version 9.02 differences
Posted: Sun Mar 15, 2009 09:39 PM
Hello Antonio,

please test with this code.
The problem must be the append-method.
This code reports 10 instead of 3.
Best regards,
Otto


Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

  local oDbf
 

   DbCreate( "test", { { "age", "N", 3, 0 } } )

   USE test

   DATABASE oDbf
oDbf:blank()
   MsgInfo( "database object" + STR( Len( Str( oDbf:age ) ) ))



return nil
 
 function dbpack
 return nil
 function dbzap
 return nil
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Re: database class version 9.02 differences
Posted: Mon Mar 16, 2009 04:53 PM

Otto,

the length of str() without parameters is always 10.

Regards,
Detlef

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: database class version 9.02 differences
Posted: Mon Mar 16, 2009 05:14 PM
Hello Detlef,

thank you.
But the lenght should be 3 like it was with version 8.12, etc.

If you look into the append method in database.prg from the old and the new versions there have been changes.

Code (fw): Select all Collapse
VERSION 8
   METHOD Blank( nRecNo )     INLINE ( ::nArea )->( nRecNo := RecNo(),;
                                                    DBGoBottom(), ;
                                                    DBSkip( 1 ), ;
                                                    ::Load(),;
                                                    DBGoTo( nRecNo ) )

VERSION 9
METHOD Blank() CLASS TDataBase

   if ::lBuffer
      AEval( ::aBuffer, { |u,i| ::aBuffer[ i ] := uValBlank( u ) } )
   endif

return .f.

//----------------------------------------------------------------------------//



Regards,
Otto
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: database class version 9.02 differences
Posted: Mon Mar 16, 2009 07:00 PM
We should modify uValBlank() to keep the original numeric length.

This is the code:
Code (fw): Select all Collapse
      case cType == "N"
       uResult =  uValue - uValue


How to modify it to keep the original length ? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: database class version 9.02 differences
Posted: Mon Mar 16, 2009 07:14 PM

Hello Antonio,

>How to modify it to keep the original length ?

I am sure 9.03 will give the answer.

Thanks in advance
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: database class version 9.02 differences
Posted: Mon Mar 16, 2009 07:17 PM
This simple example changes the value length!
Code (fw): Select all Collapse
function Test( n )

return n - n


and this code, keeps the length:
Code (fw): Select all Collapse
function Test( n )

return n

Is it a Harbour/xHarbour bug ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: database class version 9.02 differences
Posted: Mon Mar 16, 2009 07:53 PM
Otto,

Enrico gave me the solution. We have to modify function uValBlank() this way:
Code (fw): Select all Collapse
      case cType == "N"
           uResult = Val( Str( uValue - uValue, Len( Str( uValue ) ) ) )

Now it seems to works ok. I appreciate your feedback :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: database class version 9.02 differences
Posted: Mon Mar 16, 2009 08:15 PM

Antonio,

thank you. Now I get the right values.
Regards,
Otto

Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Re: database class version 9.02 differences
Posted: Mon Mar 16, 2009 09:49 PM

Antonio, i change this in tdatabase class? thanks

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: database class version 9.02 differences
Posted: Mon Mar 16, 2009 10:19 PM

Norberto,
you have to change C:\Fwh\source\function\valblank.prg and then link in this changed function.
Regards,
Otto

Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Re: database class version 9.02 differences
Posted: Mon Mar 16, 2009 10:36 PM

Otto, very thanks i will make this now.

Continue the discussion