FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TDatabase or my error?
Posts: 555
Joined: Wed Jul 31, 2013 01:14 PM
TDatabase or my error?
Posted: Thu Jun 22, 2017 05:01 AM
Hello. Sorry for my English.
Can I open a DBF Shared, and later do a FLock() to make a ZAP()??????????????????????????????????

I open a DBF in this way - I'm using TData from Mr. James Bott
Code (fw): Select all Collapse
CLASS TSala from TXData
   Method New()
ENDCLASS

Method New() CLASS TSala
   ::super:New(,"BASE", ,  )
return self

SysRefresh()

When I want to do a ZAP(), I doit this way... but don't work.
BASE := Tsala():New(,,,.F.)  
IF BASE:Lock()
   MsgInfo("bloqueado") --------------------> The message is shown
   BASE:SetOrder(1)
       BASE:ZAP() -----------------------------> Here a meesage is shown "Error DBFCDX/1023 Exclusive required.
       BASE:UnLock()
Else
       MsgInfo("Error asl bloquear archivo", "Informe")     
       RETURN(.F.)     
Endif

Application
===========
   Path and name: C:\Fuentes\omegainmo\omegainmo.Exe (32 bits)
   Size: 5,685,248 bytes
   Compiler version: Harbour 3.2.0dev (r1703231115)
   FiveWin  version: FWH 17.05
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.2, Build 9200 

   Time from start: 0 hours 0 mins 11 secs 
   Error occurred at: 22/06/2017, 01:52:23
   Error description: Error DBFCDX/1023  Exclusive required

Stack Calls
===========
   Called from:  => __DBZAP( 0 )
   Called from: .\source\classes\DATABASE.PRG => (b)TDATABASE( 179 )
   Called from: .\source\classes\DATABASE.PRG => TSALA:ZAP( 0 )
   Called from: omegaprnt.prg => SALDOAEXCEL( 3851 )
   Called from: omegainmo.PRG => (b)NU_SALDOS( 605 )
   Called from: .\source\classes\MENU.PRG => TMENU:ACTIVATE( 1350 )
   Called from: omegainmo.PRG => NU_SALDOS( 621 )
   Called from: omegainmo.PRG => (b)MAIN( 130 )
   Called from: trbtn1503.prg => TRBTN:CLICK( 715 )
   Called from: trbtn1503.prg => TRBTN:LBUTTONUP( 915 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1721 )
   Called from: trbtn1503.prg => TRBTN:HANDLEEVENT( 1617 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3325 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1036 )
   Called from: omegainmo.PRG => MAIN( 426 )


Thank you very much.
Sorry for my bad English.
Best regards Ruben Dario Fernández
It,s very late here. I'll be sleeping a few hours.
Dario Fernandez

FWH 2501, Harbour, MVS2022 Community, MySql & MariaDB, Dbf/Cdx VSCode.

Maldonado - Uruguay
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: TDatabase or my error?
Posted: Thu Jun 22, 2017 08:15 AM

No, ZAP requires exclusive access to database.

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: TDatabase or my error?
Posted: Thu Jun 22, 2017 03:11 PM

Ruben,

As Enrico stated you have to open it for exclusive use (set lShared to .f., it defaults to .t.).

Method New( cAlias, cFile, cDriver, lShared, lReadOnly ) Class TData

The reason you can't just do an flock() on a shared database is that other users could have it open and even be editing a record when you do the flock. By opening it in exclusive use, you can be sure nobody else it using the database.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 555
Joined: Wed Jul 31, 2013 01:14 PM
Re: TDatabase or my error? SOLVED
Posted: Thu Jun 22, 2017 04:44 PM

Thank you Enrico and James. Solved from now.

Regards
Ruben Dario Fernandez

Dario Fernandez

FWH 2501, Harbour, MVS2022 Community, MySql & MariaDB, Dbf/Cdx VSCode.

Maldonado - Uruguay

Continue the discussion