database class version 9.02 differences

database class version 9.02 differences

Postby Otto » Fri Mar 13, 2009 5: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: database class version 9.02 differences

Postby Antonio Linares » Sat Mar 14, 2009 7:54 pm

Otto,

This example is working fine with FWH 9.02:
Code: Select all  Expand view

#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: database class version 9.02 differences

Postby Otto » Sat Mar 14, 2009 8: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: database class version 9.02 differences

Postby Otto » Sun Mar 15, 2009 9: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: Select all  Expand view
#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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: database class version 9.02 differences

Postby Detlef Hoefner » Mon Mar 16, 2009 4:53 pm

Otto,

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

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Re: database class version 9.02 differences

Postby Otto » Mon Mar 16, 2009 5: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: Select all  Expand view
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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: database class version 9.02 differences

Postby Antonio Linares » Mon Mar 16, 2009 7:00 pm

We should modify uValBlank() to keep the original numeric length.

This is the code:
Code: Select all  Expand view

      case cType == "N"
       uResult =  uValue - uValue
 


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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: database class version 9.02 differences

Postby Otto » Mon Mar 16, 2009 7: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: database class version 9.02 differences

Postby Antonio Linares » Mon Mar 16, 2009 7:17 pm

This simple example changes the value length!
Code: Select all  Expand view

function Test( n )

return n - n
 


and this code, keeps the length:
Code: Select all  Expand view

function Test( n )

return n
 

Is it a Harbour/xHarbour bug ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: database class version 9.02 differences

Postby Antonio Linares » Mon Mar 16, 2009 7:53 pm

Otto,

Enrico gave me the solution. We have to modify function uValBlank() this way:
Code: Select all  Expand view

      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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: database class version 9.02 differences

Postby Otto » Mon Mar 16, 2009 8:15 pm

Antonio,

thank you. Now I get the right values.
Regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: database class version 9.02 differences

Postby norberto » Mon Mar 16, 2009 9:49 pm

Antonio, i change this in tdatabase class? thanks
norberto
 
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR

Re: database class version 9.02 differences

Postby Otto » 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: database class version 9.02 differences

Postby norberto » Mon Mar 16, 2009 10:36 pm

Otto, very thanks i will make this now.
norberto
 
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests