TDatabase broken backward compatibility

TDatabase broken backward compatibility

Postby hua » Thu Nov 03, 2022 3: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
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: TDatabase broken backward compatibility

Postby nageswaragunupudi » Thu Nov 03, 2022 3: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
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TDatabase broken backward compatibility

Postby hua » Thu Nov 03, 2022 4: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: Select all  Expand view
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
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests