FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TDatabase broken backward compatibility
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
TDatabase broken backward compatibility
Posted: Thu Nov 03, 2022 03:04 AM

When I upgrade some of my existing codes from FWH11.08 to FWH19.12, I found the following behaviour changes

  1. The newer TDatabase will not change to the workarea of dbf opened using :open()

  2. The newer TDatabase():save() under certain situation will do an APPEND BLANK automatically.

Apart from linking in the old version of TDatabase is there any flag to get the old behaviour?

I do not wish to have fingers pointed to me after linking in the latest FWH that I have because backward-compatibility was broken and causes either data integrity issues or run-time error occurs

TIA

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TDatabase broken backward compatibility
Posted: Thu Nov 03, 2022 03:57 AM

We do not like any user to face any inconvenience by upgrading FWH.

1st point: This was a deliberate change we made to avoid some common problems. We can explain but at some other time.

For now, we will make some changes in the database.prg to continue the old behavior

I will post the changes in my next post. Either you can make the changes yourself or we do not mind providing the revised program to you if you so wish.

2nd point; This should not happen. Can you explain a little more about this?

I consider that the latest version you have with you is FWH1912. Right?

Regards



G. N. Rao.

Hyderabad, India
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: TDatabase broken backward compatibility
Posted: Thu Nov 03, 2022 04:33 AM
Yes, the latest FWH I have is FWH1912.

In this particular module, I have sub-classed TDatabase and override :append() and :blank() method
Code (fw): Select all Collapse
method append(lBlank) class TData
  local lRet := .f.
  default lBlank := .t.
  if ( ::cAlias )->( add_rec() )
     if lBlank
        ::blank()
     endif
     lRet := .t.
  endif
return lRet
//----------------------------------------------------------------------------
method blank(cField) class TData
  local xRet, x, y, n

  if !empty(cField) // user wants to blank a field only
     n := ::fieldPos(cField)
     x := ::fieldGet(n)
     y := valtype(x)
     do case
     case y == "C"
       xRet := space(len(x))
     case y == "M"
       xRet := ""
     case y == "D"
       xRet := ctod("")
     case y == "N"
       xRet := 0
     end
     ::aBuffer[n] := xRet
  else
     ::super:blank()
     if ::lBuffer
        // latest TDatabase (FWH1912) causes does append on its own at :save() if :nBufKeyNo value is 0
        ::nBufKeyNo    := ( ::cAlias )->( OrdKeyNo() )
        ::nBufRecNo    := ( ::cAlias )->( RECNO() )
     endif
  endif
return nil
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion