TDatabase or my error?

TDatabase or my error?

Postby D.Fernandez » Thu Jun 22, 2017 5: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: Select all  Expand view

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 22.12, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 455
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay

Re: TDatabase or my error?

Postby Enrico Maria Giordano » Thu Jun 22, 2017 8:15 am

No, ZAP requires exclusive access to database.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8243
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: TDatabase or my error?

Postby James Bott » Thu Jun 22, 2017 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TDatabase or my error? SOLVED

Postby D.Fernandez » Thu Jun 22, 2017 4:44 pm

Thank you Enrico and James. Solved from now.

Regards
Ruben Dario Fernandez
Dario Fernandez
FWH 22.12, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 455
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: byron.hopp and 10 guests