Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Autoincrementing after record is added 1999-03-16 -- Andrew Guidroz II The idea is that you can set up a file not to use the standard file class but to use this
file class instead and the autoinc happens when the record is truly added, not before.
Put both of these source files in your libsrc directory.
The bug is that C5 required two additional equates for 32 bits to work in the CLW file.
Here is the FileOver.INC
!ABCIncludeFile
OMIT('_EndOfInclude_',_FileOverPresent_)
_FileOverPresent_ EQUATE(1)
include('abfile.inc'),ONCE
FileManagerWOPreAutoInc
CLASS(FileManager),TYPE,MODULE('FileOver.CLW'),LINK('FileOver.CLW',_ABC
LinkMode_),DLL(_ABCDLLMode_)
PrimeRecord PROCEDURE(BYTE SuppressClear = 0),BYTE,PROC,VIRTUAL
PrimeAutoInc PROCEDURE,BYTE,PROC,VIRTUAL
UseStandard BYTE ! Use standard technique of priming autoinc
FromPrime BYTE,PRIVATE ! Called from prime, therefore, do not use standard technique
! of priming
END
!_EndOfInclude_
And here is the FileOver.CLW
MEMBER
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
MAP
END
INCLUDE('FileOver.INC'),ONCE
INCLUDE('ABFile.INC'),ONCE
FileManagerWOPreAutoInc.PrimeRecord FUNCTION(BYTE SC)
CODE
SELF.FromPrime = CHOOSE( SELF.UseStandard, 0, 1 )
RETURN PARENT.PrimeRecord()
FileManagerWOPreAutoInc.PrimeAutoInc PROCEDURE
CODE
IF SELF.FromPrime
SELF.FromPrime = 0
RETURN Level:Benign
ELSE
RETURN Parent.PrimeAutoInc() ! This line added so that the record DOES
END
Today is November 21, 2024, 7:38 am This article has been viewed 35197 times.
|
|