Automatic record locking for aliased DCGETs

This forum is for eXpress++ general support.
Post Reply
Message
Author
ivanvazan
Posts: 21
Joined: Tue May 18, 2010 5:57 am

Automatic record locking for aliased DCGETs

#1 Post by ivanvazan »

Hi Roger,
I finally updated my eXpress from version 240 to 254 (I know, I am a bad boy...). There is one quite major issue with the 'Added automatic record-locking when creating a DCGET that is aliased into a database' feature which was added. Problem is, that all my edit screens (and I am talking about hundreds and hundreds of them) are using the following syntax (simplified):

LOCAL aFields := {}

IF ( cAlias )->( LOCKREC() )
aFields := ( cAlias )->( SCATTER() )
...
@ nRow, nCol XDCGET aFields[ ( cAlias )->( FIELDPOS( "FIELDNAME" ) ) ]
...
( cAlias )->( UNLOCKREC() )
ENDIF

Well, as you can see, the DCGET line has the file alias, but not in the form you expect it in your program, e.g. ( cAlias )->FIELDNAME - and this now triggers the error on each field.

Roger, would it be possible to add a GET-SET function to _dcgetbx.prg, so I do not have to remember to change this program each time I get the future eXpress update? Function can default to .T. (perform auto-lock), so no other user will be affected.
Below is my suggested GETSETFUNCTION and 4 spots (2 functions) in the _dcgetbx.prg you have to adjust:

_dcgetbx.prg

GETSETFUNCTION DC_AutoLockEditedRecord DEFAULT .T.


in FUNCTION DC_GetAnchorCB()

around line 6963
CASE DC_AutoLockEditedRecord() .AND. ;
'->' $ cVarName .AND. !Upper(Left(cVarName,3)) == 'M->' .AND. ;
!Upper(Left(cVarName,8)) == 'MEMVAR->' .AND. ;
!Upper(Left(cVarName,7)) == 'FIELD->'
...

in FUNCTION DC_GetValidate()

around line 8267
IF lLocked := DC_AutoLockEditedRecord() .AND. ;
(oXbp:isDerivedFrom('DC_XbpGet') .AND. !Empty(oXbp:dataAlias) .AND. ;
!((oXbp:dataAlias)->(RecNo()) $ (oXbp:dataAlias)->(dbRLockList())))
(oXbp:dataAlias)->(dbRLock())
ENDIF

around line 8371
IF lLocked := DC_AutoLockEditedRecord() .AND. ;
(oXbp:isDerivedFrom('DC_XbpGet') .AND. !Empty(oXbp:dataAlias) .AND. ;
!((oXbp:dataAlias)->(RecNo()) $ (oXbp:dataAlias)->(dbRLockList())))
(oXbp:dataAlias)->(dbRLock())
ENDIF

around line 8381
IF lLocked := DC_AutoLockEditedRecord() .AND. ;
(oXbp:isDerivedFrom('DC_XbpGet') .AND. !Empty(oXbp:dataAlias) .AND. ;
!((oXbp:dataAlias)->(RecNo()) $ (oXbp:dataAlias)->(dbRLockList())))
(oXbp:dataAlias)->(dbRLock())
ENDIF

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Automatic record locking for aliased DCGETs

#2 Post by rdonnay »

You asked for this just at the right time.

I plan to release build 255 when I get back to my office (about Feb 1).

The Get-Set function is something I will add for you.

For now, (build 254) this is what you need to do:

1. Make the following change to the file \exp19\source\dclipx\_DCGETBX.PRG:

Was:

Code: Select all

  CASE '->' $ cVarName .AND. !Upper(Left(cVarName,3)) == 'M->' .AND. ;
                             !Upper(Left(cVarName,8)) == 'MEMVAR->' .AND. ;
                             !Upper(Left(cVarName,7)) == 'FIELD->' 
Is:

Code: Select all

  CASE '->' $ cVarName .AND. !Upper(Left(cVarName,3)) == 'M->' .AND. ;
                             !Upper(Left(cVarName,8)) == 'MEMVAR->' .AND. ;
                             !Upper(Left(cVarName,7)) == 'FIELD->' .AND. .f.
2. Rebuild DCLIPX.DLL by running BUILD19.BAT or BUILD19_SL1.BAT.
The eXpress train is coming - and it has more cars.

ivanvazan
Posts: 21
Joined: Tue May 18, 2010 5:57 am

Re: Automatic record locking for aliased DCGETs

#3 Post by ivanvazan »

Thanks Roger, I appreciate it. I already ‘pre’adjusted the _dcgetbx.prg as per my suggested example above and it works perfectly.

Post Reply