Converting DB V4.1F-V4.3C applications
The conversion of an existing c-tree V4.3 application program involves two main aspects: file conversion and program conversion. The files from c-tree V4.3 are not compatible with the FairCom DB file format. Programs may be compatible, but many will require some modification.
Application Conversion Details
data & index files
Data files are converted using the utility program
ctcv43
provided with FairCom DB. Index files associated with these data files should then be rebuilt using the FairCom DB function,RebuildIFile()
.Stand-alone index files are converted with the programs
ctin43
andctindx
provided with FairCom DB.ctin43
must be linked with your V4.3 library. It produces a flat key file for each index.ctindx
is linked with your FairCom DB library. It creates a FairCom DB index from the flat key file produced byctin43
.ISAM information
ISAM Parameter files and Incremental ISAM Structures are compatible. The
tfilno
field has been added to theIFIL
structure. Theaidxnam
,altseq
, andpvbyte
fields have been added to theIIDX
structure. See Incremental ISAM Structures in the FairCom DB Programmer's Reference Guide for more information on these structures.With parameter files, make sure the RTREE setting in
ctoptn.h
is correct.Header info
FairCom DB applications cannot directly access the index file headers via the(
ct_key
+filno
)->member
reference. Instead, use theGetCtFileInfo()
andGetSymbolicNames()
functions, part of the FairCom DB library, to get the information.For example, the data record length is accessible with the following expression in c-tree V4.3: (
ct_key
+filno
)->reclen
. In FairCom DB the record length is returned by the function callGetCtFileInfo(filno,RECLEN)
.GetCtFileInfo()
returns a long integer since it is also used to return header values such as the file size. All references of the form“extern CTFILE *ctnum;”
must be removed. If you are using such a statement, then you must rely on theGetCtFileInfo()
andGetSymbolicNames()
functions instead.Length params
All length-related parameters have become 4-byte values. We now provide function prototypes which should catch (and/or correct) this change. For example, in
REDVREC
(datno
,recptr
,bufsiz
),bufsiz
is now a 4-byte quantity.Function returns and parameter changes
The following functions have undergone parameter changes between c-tree V4 and c-tree Plus V6:
Function Name
Function Return
Function Parameters
v4
EQLKEY
POINTER
COUNT keyno, TEXT *target
v10
EQLKEY
LONG
COUNT keyno, pVOID target
v4
GTEKEY
POINTER
COUNT keyno, TEXT *target, TEXT *idxval
v10
GTEKEY
LONG
COUNT keyno, pVOID target, pVOID idxval
v4
GTKEY
POINTER
COUNT keyno, TEXT *target, TEXT *idxval
v10
GTKEY
LONG
COUNT keyno, pVOID target, pVOID idxval
v4
NXTKEY
POINTER
COUNT keyno, TEXT *idxval
v10
NXTKEY
LONG
COUNT keyno, pVOID idxval
v4
REDREC
COUNT
COUNT datno, POINTER recbyt, TEXT *recptr
v10
REDREC
COUNT
COUNT datno, LONG recbyt, pVOID recptr
v4
frmkey
COUNT
COUNT keyno, TEXT *recptr, TEXT * txt, POINTER pntr
v10
frmkey
COUNT
COUNT keyno, pTEXT recptr, pTEXT txt, ctRECPT pntr, VRLEN datlen
v4
LOKREC
COUNT
COUNT datno, COUNT lokmod, POINTER recbyt
v10
LOKREC
COUNT
COUNT datno, COUNT lokmod, ctRECPT recbyt
frmkey
If you use the
BuildKey()
function, short namefrmkey
, it now takes an additional parameter specifying the length, as a 4-byte quantity, of the record buffer from which the key is extracted. See the function prototype forBuildKey()
inCTDECL.H
.current ISAM record
cur_recno[ ]
andcur_image[ ]
no longer exist. Also, it is no longer necessary to use two buffers for record updates, although using two buffers will NOT cause any problem for FairCom DB. FairCom DB maintains the necessary information internally for each user.To determine the current ISAM record position, use
GETCURP(datno)
instead ofcur_recno[datno]
. To reset the current ISAM record after a successful rewrite, useUPDCURI(datno,SWTCURI)
instead of manipulatingcur_recno
andcur_image
. See"ResetRecord"
or"CurrentFileOffset"
in the FairCom DB Programmer's Reference Guide for additional capabilities.To set the current ISAM record to a specified byte position (and/or record image) use
SETCURI(datno,recbyt,recptr,bufsiz)
, whererecbyt
is required and specifies the record position. If non-null,recptr
points to a record buffer containing an image of the data record. If non-zero,bufsiz
(a 4-byte value), specifies the length of the record buffer. Ifrecptr
is non-null andbufsiz
is passed as0L
, thenbufsiz
is assumed to be the record length defined for the file at the time the file was created. For variable length files, this corresponds to the fixed length portion of the file.Key segment info
If you have accessed key segment information (such as a segment length or segment mode), you can now retrieve it nia a call to:
ctgetseginfo(keyno,segment_no,mode)
where
segment_no
is a zero-based segment number, and mode is one of the following:ctSEGPOS
- segment offsetctSEGMOD
- segment modectSEGLEN
- segment length
#includes
Be sure to change the FairCom DB include files to the following:
#include "ctreep.h"
Note that
ctaerr.h
includes the definitions foruerr_cod
,isam_err
, andisam_fil
. It is not necessary to includectifil.h
(as specified in the manual) since it will be included automatically.old key types
Key types 1, 2, and 3 have been phased out. they supported integer and floating point keys. You can use appropriate key segments to support all of these types. Change the key type to 0, unless you desire key compression, and modify your ISAM key segment modes. If you application only uses the low level functions, you can transform the keys as required using the
TransformSegment()
function described in the FairCom DB Function Reference Guide.Lock table size
c-tree V4.X utilized an internal lock table that supported 32 concurrent locks by default,
#define MAX_LOCKS 32
. To alleviate this artificial lock limit, FairCom DB dynamically allocates a lock list instead of a more static lock table. The number of locks available to FairCom DB is now constrained by available system memory.TRANSACTION
The
TRANSACTION()
function supported in c-tree V4.3, for purposes of keeping a server from shutting down in the middle of an application procedure, now simply returns without error. It causes no action to be taken.FairCom DB supports extensive transaction processing in the Server mode via the
Begin()
,Abort()
,Commit()
,SetSavePoint()
, andRestoreSavePoint()
functions.TFRMKEY
FairCom DB supports the automatic calling of
TransformKey()
, short nameTFRMKEY()
, to transform target key values used in ISAM level search routines. If you use the traditional FairCom DB functions to initialize FairCom DB,InitCTree()
,InitISAM()
,OpenISAM()
, orCreateISAM()
, then this automatic feature is disabled and your existing application will be unaffected. If you use the extended forms of these functions (InitCTreeXtd()
,InitISAMXtd()
,OpenISAMXtd()
, orCreateISAMXtd()
), then you must set theuserprof
parameter toUSERPRF_NTKEY
to disable the automatic calls toTransformKey()
. Otherwise, your existing calls will be followed by the automatic calls, which will cause problems.FPUTONLY
There is no longer a
FPUTONLY
disk I/O protocol. FairCom DB now lets you select on a file-by-file basis whether or not to force updates directly to disk. OR thectWRITETHRU
constant (64) into the file mode to get the same affect as theFPUTONLY
I/O protocol.DOSFLUSH
DOSFLUSH
support is being phased-out. As distributed,DOSFLUSH
will only become effective in theFPUTFGET
, Standalone Multi-user, configuration. If necessary, addDOSFLUSH
to yourCTOPTN.H
configuration file.CTOPT2.H
contains preprocessor commands that turnDOSFLUSH
off ifNOTFORCE
is selected.)Transaction processing provides a much more effective means to ensure the consistency and completeness of the data.r-tree® / d-tree™
Applications using Version 1.1 of the r-tree Report Generator or Version 3.1 of the d-tree Development ToolBox require updated versions of these development tools.