1264 lines
39 KiB
C
1264 lines
39 KiB
C
|
#ifndef h_DBFILE
|
||
|
#define h_DBFILE
|
||
|
/******************************************************************************
|
||
|
*
|
||
|
* Definition of UniVerse Database file descriptor
|
||
|
*
|
||
|
* Module %M% Version %I% Date %H%
|
||
|
*
|
||
|
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
|
||
|
* This is unpublished proprietary source code of Ardent Software Inc.
|
||
|
* The copyright notice above does not evidence any actual or intented
|
||
|
* publication of such source code.
|
||
|
*
|
||
|
*******************************************************************************
|
||
|
*
|
||
|
* Maintenence log - insert most recent change descriptions at top
|
||
|
*
|
||
|
* Date.... GTAR# WHO Description.........................................
|
||
|
* 07/29/99 25479 WSM Add SHzero_blink to SHdata structure.
|
||
|
* 05/17/99 22647 LPC Fix elements in old style DBitem
|
||
|
* 05/05/99 24483 RGA Change Dfile->size to UVINT.
|
||
|
* 05/03/99 24742 GMH Change cast
|
||
|
* 04/22/99 24480 GMH Change header NEW32/NEW64
|
||
|
* 04/13/99 24729 LPC Fix T30 macros.
|
||
|
* 04/09/99 24480 GMH Shuffle items in new32 and new64 headers
|
||
|
* 03/27/99 24729 LPC Add macros to access/set T30 values in fdesc
|
||
|
* 03/23/99 24480 GMH Change header NEW32/NEW64 to insure 8byte boundaries
|
||
|
* 03/20/99 24729 GMH Change casting of info30->filesp
|
||
|
* 03/18/99 24480 RGA Change structure for proper alignment.
|
||
|
* 03/18/99 24480 RGA Change definition of DBread_pads.
|
||
|
* 03/01/99 24480 GMH Correct uvhdrnew32 structure
|
||
|
* 01/31/99 24414 LPC Add Ihead to file descriptor.
|
||
|
* 01/25/99 24374 RGA Infrastructure for large file lseek.
|
||
|
* 11/11/98 23948 GMH add hashdata element to Dfile
|
||
|
* 10/14/98 23801 SAP Change copyrights.
|
||
|
* 10/05/98 22647 GMH Fix error
|
||
|
* 09/30/98 23672 RGA Change DBITEM to DBITEMNEW for DBFILE,SHdata.
|
||
|
* 09/28/98 22647 RGA Fix get_data to use * uchar.
|
||
|
* 09/27/98 22647 RGA Fix get_data to use ** uchar.
|
||
|
* 09/23/98 23672 GMH Move GET_FLINKptr, etc to DBinit as functions
|
||
|
* 09/24/98 23672 JBG Add GET_OVXDATA, SET_OVXDATA
|
||
|
* 09/22/98 22647 RGA Add 64-bit function prototypes.
|
||
|
* 09/21/98 23672 GMH Add declarations
|
||
|
* 09/21/98 22647 RGA Add SET_PFLINK,GET_PFLINK,etc... (64-bit)
|
||
|
* 09/18/98 22647 GMH Move GET_T30INFO, SET_T30INFO into DBinit as functions
|
||
|
* 09/18/98 23672 SAP Add SET_OVCOUNTxxx and GET_OVCOUNTxxx macros.
|
||
|
* 09/17/98 23673 GMH Add support for new file header
|
||
|
* 09/16/98 22647 RGA Add SET_DATA, GET_DATA (64-bit)
|
||
|
* 09/15/98 22647 RGA Move SET_FLAG,GET_FLAG into DBinit as func.(64-bit)
|
||
|
* 09/11/98 22647 RGA Add SET_FLAGWxxx,and GET_FLAGWxxx macros.
|
||
|
* 09/11/98 22647 GMH Change define names
|
||
|
* 09/10/98 22647 GMH Correct compilation errors
|
||
|
* 09/09/98 22647 GMH Correct ovlink reference
|
||
|
* 09/08/98 22647 GMH Change header items
|
||
|
* 09/07/98 22647 GMH Fix compilation error
|
||
|
* 09/04/98 22647 LPC Fix compilation errors
|
||
|
* 09/03/98 22647 LPC Fix order of structures for DBitemnew
|
||
|
* 09/01/98 22647 GMH Add addr_support to Dfile
|
||
|
* 07/02/98 16692 GMH Rename transflg to deleted, clean up, add scanallgroup
|
||
|
* 03/12/98 22658 JBG Add two fields to SHdata
|
||
|
* 03/05/98 22658 JBG Optimistic SCAN bit definitions in DBFILE
|
||
|
* 02/23/98 21285 CSM Add lockpromoted to DBFILE
|
||
|
* 02/17/98 21285 JBG Add dmllock, lockru, lockacquired to DBFILE
|
||
|
* 02/10/98 22395 JBG Add cnode, fields to DBFILE
|
||
|
* 12/19/97 22373 CSM Add grpscansync bit to EXflags for select-update
|
||
|
* 08/28/97 21285 JBG Added nowait & updatelock to EXflags
|
||
|
* 06/27/97 20606 LAG Added failover to EXflags and OF_UDR_FAILOVER
|
||
|
* 05/29/97 20606 LAG Added EXflags to Dfile structure for replication
|
||
|
* 05/11/97 20380 DTM Added sortmap/sortcksum
|
||
|
* 05/02/97 20453 CSM Add ptrigblk field to Dfile for triggers
|
||
|
* 05/01/97 19940 GMH Remove WLATCH define
|
||
|
* 04/14/97 20255 JBG Add defines OF_SICA_STRIPPED and OPEN_NOSICA
|
||
|
* 04/03/97 20380 DTM Added sortmap/sortcksum
|
||
|
* 01/24/97 19863 JBG Add name to jrnode
|
||
|
* 01/22/97 19863 JBG Add to SQLPERM, define jrnode
|
||
|
* 06/10/96 18597 GMM Added os_deleted flag to Dfile structure
|
||
|
* 06/13/96 18582 CSM Add field for summary of cascades and triggers
|
||
|
* 04/25/96 18321 MGM Add sqlidx struct and include it in sqlperm
|
||
|
* 03/27/96 16692 GMH Added clrtime to Dfile structure.
|
||
|
* 01/02/96 17832 HSB added sqlidxmap structure to Dfile.
|
||
|
* 07/25/95 16956 CSM replace delsel field of select list with flags field
|
||
|
* 07/05/95 16816 CSM add field to file desc for data of last key scanned
|
||
|
* 06/22/95 15958 PVW Add case_HASHED macro
|
||
|
* 06/01/95 16588 PVW Replace DBupdlock/DBslock with DBReadLock
|
||
|
* 04/10/95 16244 GMM Changed ino_t to uv_ino_t
|
||
|
* 05/05/95 15958 PVW Nested transactions
|
||
|
* 03/29/95 16178 RM Added some more EXTERNs
|
||
|
* 12/05/94 15741 EAP Added NLS key & data strings to SHdata
|
||
|
* 11/08/94 15741 EAP Added NLS map info to Dfile structure
|
||
|
* 08/26/94 14785 RM Added last_insert to Dfile structure for DBscan/select
|
||
|
* 08/23/94 14242 SPR Added the macro MFSNOPRINT which represents the
|
||
|
* fact that there is nothing left in the buffer to
|
||
|
* print.
|
||
|
* 08/19/94 14688 RM Added may_close flag to Dfile
|
||
|
* 08/03/94 14371 RM Added latch to Dfile
|
||
|
* 07/22/94 14447 TMC change uvnet NETsemop interface
|
||
|
* 07/22/94 14385 CSM New flag to handle open of inconsistent files
|
||
|
* 06/17/94 13825 MGM Modify sqlperm and Dfile for RI support.
|
||
|
* 06/14/94 14006 RM Optimize SHkptr maintenance
|
||
|
* 06/14/94 14133 CSM Add chkpoint, tlnum, inconsistent flag to file hdr
|
||
|
* 05/26/94 14006 RM Optimize SHkeylst maintenance
|
||
|
* 04/26/94 13806 MGM Add tabuniq_cnt and tabuniq to sqlperm
|
||
|
* 04/20/94 13760 ENF Add database cursor pointer to DBFILE
|
||
|
* 04/13/94 12559 JBG Added sqlperm flags SQL_IN_PERM, SQL_UP_PERM.
|
||
|
* 04/07/94 12831 JBG Added correctly flag definations for DBopen dflg.
|
||
|
* 04/06/94 12831 JBG Added flag viewperm for VIEW_PERMITTED
|
||
|
* 01/26/94 12297 JSW Add items the SELFILE struct for selectinfo.
|
||
|
* 03/15/94 12303 ALC Added flag to type 30 flags for PI/open over sized
|
||
|
* records, they have slightly different structure
|
||
|
* 03/01154 12297 JSW Add DBfinfo() and vocname field.
|
||
|
* 03/01/94 13167 JWT Integrate Pyramid O_SYNC change
|
||
|
* 02/16/94 12535 JBG DML, now remove SHscan_inserts.
|
||
|
* 02/15/94 12535 JBG DML, define SHscan_inserts in SHdata, flags in DBFILE.
|
||
|
* 02/10/94 12535 JBG DML, define WLATCH constant.
|
||
|
* 02/04/94 12535 JBG DML, add field to DBFILE (latchaddr, used by DBwread()
|
||
|
* 09/20/93 12291 PVW Added SHsavovf30 to SHdata structure
|
||
|
* 09/15/93 8810 JWT New DBscanhash code for reliable dynamic select
|
||
|
* 09/15/93 10922 FAI Changed inode to type ino_t in struct Dfile.
|
||
|
* 08/17/93 12048 LPC Add open flag to PFLIST.
|
||
|
* 08/10/93 11994 LPC Add partitioning algorithm source to file descriptor
|
||
|
* 08/06/93 11979 LPC Add Partfile VOC name to PFblock
|
||
|
* 08/06/93 11978 LPC Add partblock offset to database file descriptor
|
||
|
* 08/02/93 11978 SHK Port to DEC AXP
|
||
|
* 07/31/93 11923 LPC Add Distributed File structures
|
||
|
* 02/05/93 10520 RM Changes to item padding
|
||
|
* 12/14/92 10716 LPC Add part number and partitioning algorithm to DBFILE
|
||
|
* 10/01/92 10315 WLC Add Sopen file stat to Dstats structure.
|
||
|
* 08/26/92 10113 RM changed include uvsica.h to sicaperm.h
|
||
|
* 07/29/92 10102 JKW Add integrity constraints
|
||
|
* 07/29/92 6818 GMH Add baktime, bakcnt, and bakflgs.
|
||
|
* 07/22/92 9926 LPC Add open Parts file flag to Distributed file block
|
||
|
* 07/14/92 9702 RM add size field to Dfile structure
|
||
|
* 07/13/92 9852 JKW add sica checking
|
||
|
* 06/20/92 9738 LPC Add missing semi-colon from end of new structure.
|
||
|
* 06/19/92 9737 LPC Add part number to Distributed file block
|
||
|
* 06/16/92 7170 GMH Add scanactive to file structure
|
||
|
* 06/12/92 9686 LPC Add Distributed File structure to database descriptor
|
||
|
* 04/10/92 9381 LPC Add file revision level to database file descriptor
|
||
|
* 03/26/92 8348 LPC Add mkdbstamp to database file descriptor
|
||
|
* 03/23/92 8802 JKW Add readl functionality
|
||
|
* 03/22/92 9296 DPB Added support for SQL SICA's
|
||
|
* 11/08/91 7388 TMC Adding code to make sure Select files get "closed"
|
||
|
* 10/23/91 8690 RM Added newstyle item padding
|
||
|
* 10/22/91 8663 JWT added low-level hooks for DELETE-ELSE syntax
|
||
|
* 07/28/90 7324 JWT fixed malloc documentation
|
||
|
* 04/17/90 7025 KIS Add tlfilenum (int) for Trans Log file magic#
|
||
|
* 09/28/89 6342 JWT Lessen file descriptor overhead
|
||
|
* 06/20/89 6077 GPS Changed character variable name open to openc
|
||
|
* 02/24/89 5803 PHH Improve the CORE verb
|
||
|
* 07/25/88 - - Maintenence log purged at 5.2.1, see release 5.1.10.
|
||
|
*
|
||
|
*****************************************************************************/
|
||
|
|
||
|
#define DBWULR 1200
|
||
|
|
||
|
#include "PROGRAM.h"
|
||
|
#include "sicaperm.h"
|
||
|
#include "qcursor.h"
|
||
|
#include "NLS.h"
|
||
|
|
||
|
/* bitmap of field UDRflags in file header */
|
||
|
#define OF_UDR_PUBLISHED 0x1
|
||
|
#define OF_UDR_SUBSCRIBE 0x2
|
||
|
#define OF_UDR_FAILOVER 0x4
|
||
|
|
||
|
struct EXflags
|
||
|
{ BITMAP sparebits:((8*sizeof(BITMAP))-24),
|
||
|
scanallgroup:1, /* have DBscanhash scan entire group for uvbackup */
|
||
|
sgrpscansync:1, /* saved original grpscansync bit <<< 22658 vvv */
|
||
|
rescangroup:1, /* rescan current group - used with SCANgrpsync) */
|
||
|
dostronglatch:1,/* complete strong latch before return results */
|
||
|
doweaklatch:1, /* optimistic complete weak latch before show results */
|
||
|
upgradect:4, /* try upgrading latch every (2**upgradect)-1 requests */
|
||
|
listcontrol:1, /* current 'leftmost' SCAN file using 'weak latch' */
|
||
|
nowaithappen:1, /* NOWAIT error on this file <<< 22658 ^^^ */
|
||
|
rlpromoted:1, /* DBrsemp promoted existing RL lock <<< 21285 */
|
||
|
rdlkacquired:1, /* DBrsemp acquired record lock (not pre-existing) */
|
||
|
lockru:1, /* if dmllock set; 0== LOCK_RL, 1== LOCK_RU <<< 21285 */
|
||
|
dmllock:1, /* DML will do record locking in this file <<< 21285 */
|
||
|
cache:1, /* should reads be cached <<< 22395 */
|
||
|
cacheVOC:1, /* cache only if field 2 starts with K or V <<< 22395 */
|
||
|
grpscansync:1, /* if set then pause scan on group boundary */
|
||
|
nowait:1, /* use NOWAIT on LOCK requests <<< 21285 */
|
||
|
updatelock:1, /* have Sql SELECT use LOCK_RU <<< 21285 */
|
||
|
trblkintx:1, /* set if ptrigblk is in a TX */
|
||
|
published:1, /* set if file is marked as published */
|
||
|
subscribe:1, /* set if file is marked as subscribed */
|
||
|
failover:1; /* set if file is marked as failover */
|
||
|
};
|
||
|
|
||
|
typedef struct EXflags EXFLAGS;
|
||
|
|
||
|
/* flag bits used in mode parameter of DBscanhash */
|
||
|
#define NOSKEY 0x080 /* don't maintain skeytmp */
|
||
|
|
||
|
|
||
|
/*******************************************************************************
|
||
|
**
|
||
|
** DBitem definition area
|
||
|
** NOTE: DBitem and it's elements describe the old style (pre-9.5.1.1C)
|
||
|
** record header and exist for backward compatibility.
|
||
|
** All new code should use DBitemnew and it's elements.
|
||
|
*******************************************************************************/
|
||
|
struct DBover
|
||
|
{ DBDADDR32 ovlink;
|
||
|
DBDADDR32 ovcount;
|
||
|
uchar data[1];
|
||
|
};
|
||
|
|
||
|
union DBdata
|
||
|
{ uchar data[1];
|
||
|
struct DBover ovx;
|
||
|
};
|
||
|
/* The follow definitions describe the contents of the last two byte
|
||
|
of the item header in a data base file. The mapping is:
|
||
|
|
||
|
bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
||
|
| | | | | | | | | | | | | | | |
|
||
|
unused ------+ | | | | | | | | | | | | | | |
|
||
|
free item -------+ | | | | | | | | | | | | | |
|
||
|
sica block ----------+ | | | | | | | | | | | | |
|
||
|
partfile block ----------+ | | | | | | | | | | | |
|
||
|
| | | | | | | | | | | |
|
||
|
newstyle padding ------------+ | | | | | | | | | | |
|
||
|
padding in block flag -----------+ | | | | | | | | | |
|
||
|
overflow data buffer ----------------+ | | | | | | | | |
|
||
|
overflow buffer pointer present ---------+ | | | | | | | |
|
||
|
| | | | | | | |
|
||
|
unused --------------------------------------+ | | | | | | |
|
||
|
deleted rec in group flag -----------------------+ | | | | | |
|
||
|
PI/open oversize record -----------------------------+ | | | | |
|
||
|
reserved for RESIZE -------------------------------------+ | | | |
|
||
|
| | | |
|
||
|
first block in SGB t30 file ---------------------------------+ | | |
|
||
|
last block in PGB t30 file --------------------------------------+ | |
|
||
|
incremental backup bit 1 --------------------------------------------+ |
|
||
|
incremental backup bit 2 ------------------------------------------------+
|
||
|
*/
|
||
|
struct DBflagbits
|
||
|
{ BITMAP sparebt1:((8*sizeof(BITMAP))-15),
|
||
|
freeflag:1, /* set if item is a free block */
|
||
|
sicablok:1, /* set if item is a sica block */
|
||
|
partblok:1, /* set if item is a partfile block */
|
||
|
usenewpd:1, /* set if used newstyle item padding */
|
||
|
padinrec:1, /* set if item contains terminal pads */
|
||
|
ovflwbuf:1, /* set if block is an overflow buffer */
|
||
|
ovflwchn:1, /* set if block first of oversized item */
|
||
|
sparebt4:1,
|
||
|
grdelrec:1, /* set if this is transparent readu item*/
|
||
|
piovsrec:1, /* record is PI/open format oversized */
|
||
|
grpresiz:1, /* set by concur resize when grp is done*/
|
||
|
t30first:1, /* first block in SGB of dynamic file */
|
||
|
t30lastb:1, /* last block in PGB of dynamic file */
|
||
|
bckupflg:2; /* set if item updated since last backup*/
|
||
|
};
|
||
|
|
||
|
union DBflags
|
||
|
{ struct DBflagbits b;
|
||
|
DBFLAGW flagword;
|
||
|
};
|
||
|
|
||
|
/* old style DBitem */
|
||
|
struct DBitem
|
||
|
{ DBDADDR32 flink; /* forward link to next item in group */
|
||
|
DBDADDR32 blink; /* backward link to previous item in group */
|
||
|
union DBflags f;
|
||
|
union DBdata u;
|
||
|
};
|
||
|
|
||
|
/* new style DBitem for supporting both 32- and 64- bit addressing */
|
||
|
struct DBover32
|
||
|
{ DBDADDR32 ovlink;
|
||
|
DBDADDR32 ovcount;
|
||
|
uchar data[1];
|
||
|
};
|
||
|
struct DBover64
|
||
|
{ DBDADDR ovlink;
|
||
|
DBDADDR32 ovcount;
|
||
|
uchar data[1];
|
||
|
};
|
||
|
|
||
|
union DBdata32
|
||
|
{ uchar data[1];
|
||
|
struct DBover32 ovx;
|
||
|
};
|
||
|
union DBdata64
|
||
|
{ uchar data[1];
|
||
|
struct DBover64 ovx;
|
||
|
};
|
||
|
/*
|
||
|
** Changes made here to this size
|
||
|
** of structure need to be reflected by
|
||
|
** Ihead32 of disk.h
|
||
|
*/
|
||
|
struct DB32
|
||
|
{ DBDADDR32 flink; /* forward link to next item */
|
||
|
DBDADDR32 blink; /* backward link to previous item */
|
||
|
union DBflags f;
|
||
|
union DBdata32 u;
|
||
|
};
|
||
|
/*
|
||
|
** Changes made here to this size
|
||
|
** of structure need to be reflected by
|
||
|
** Ihead64 of disk.h
|
||
|
*/
|
||
|
struct DB64
|
||
|
{ DBDADDR flink; /* forward link to next item */
|
||
|
DBDADDR blink; /* backward link to previous item */
|
||
|
union DBflags f;
|
||
|
char pads[4]; /* needed for proper 8-byte alignment */
|
||
|
union DBdata64 u;
|
||
|
};
|
||
|
|
||
|
union DBitemnew
|
||
|
{ struct DB32 b32;
|
||
|
struct DB64 b64;
|
||
|
};
|
||
|
|
||
|
#define DBITEMNEW union DBitemnew
|
||
|
#define DBITEMNEW32 struct DB32
|
||
|
#define DBITEMNEW64 struct DB64
|
||
|
#define DBITEM struct DBitem
|
||
|
#define IDXENT struct idxent
|
||
|
#define IDXMAP struct idxmap
|
||
|
#define REFENT struct refent
|
||
|
|
||
|
struct idxmap
|
||
|
{ int colcnt;
|
||
|
int colmap;
|
||
|
};
|
||
|
|
||
|
#define DB_FLINK 1
|
||
|
#define DB_BLINK 2
|
||
|
#define DB_OVLINK 3
|
||
|
#define DB_OVCOUNT 4
|
||
|
|
||
|
/* Macros for extracting flink, blink and ovlink from DBitemnew structure */
|
||
|
#define GET_FLINKptr(fdesc, rblok, value) \
|
||
|
get_dbitemval(fdesc, rblok, DB_FLINK, value)
|
||
|
|
||
|
#define GET_FLINKdot(fdesc, rblok, value) \
|
||
|
get_dbitemval(fdesc, &rblok, DB_FLINK, value)
|
||
|
|
||
|
#define GET_BLINKptr(fdesc, rblok, value) \
|
||
|
get_dbitemval(fdesc, rblok, DB_BLINK, value)
|
||
|
|
||
|
#define GET_BLINKdot(fdesc, rblok, value) \
|
||
|
get_dbitemval(fdesc, &rblok, DB_BLINK, value)
|
||
|
|
||
|
#define GET_OVLINKptr(fdesc, rblok, value) \
|
||
|
get_dbitemval(fdesc, rblok, DB_OVLINK, value)
|
||
|
|
||
|
#define GET_OVLINKdot(fdesc, rblok, value) \
|
||
|
get_dbitemval(fdesc, &rblok, DB_OVLINK, value)
|
||
|
|
||
|
#define GET_OVCOUNTptr(fdesc, rblok, value) \
|
||
|
get_dbitemval(fdesc, rblok, DB_OVCOUNT, value)
|
||
|
|
||
|
#define GET_OVCOUNTdot(fdesc, rblok, value) \
|
||
|
get_dbitemval(fdesc, &rblok, DB_OVCOUNT, value)
|
||
|
|
||
|
/* Macros for updating flink, blink and ovlink in DBitemnew structure */
|
||
|
#define SET_FLINKptr(fdesc, rblok, value) \
|
||
|
set_dbitemval(fdesc, rblok, DB_FLINK, value)
|
||
|
|
||
|
#define SET_FLINKdot(fdesc, rblok, value) \
|
||
|
set_dbitemval(fdesc, &rblok, DB_FLINK, value)
|
||
|
|
||
|
#define SET_BLINKptr(fdesc, rblok, value) \
|
||
|
set_dbitemval(fdesc, rblok, DB_BLINK, value)
|
||
|
|
||
|
#define SET_BLINKdot(fdesc, rblok, value) \
|
||
|
set_dbitemval(fdesc, &rblok, DB_BLINK, value)
|
||
|
|
||
|
#define SET_OVLINKptr(fdesc, rblok, value) \
|
||
|
set_dbitemval(fdesc, rblok, DB_OVLINK, value)
|
||
|
|
||
|
#define SET_OVLINKdot(fdesc, rblok, value) \
|
||
|
set_dbitemval(fdesc, &rblok, DB_OVLINK, value)
|
||
|
|
||
|
#define SET_OVCOUNTptr(fdesc, rblok, value) \
|
||
|
set_dbitemval(fdesc, rblok, DB_OVCOUNT, value)
|
||
|
|
||
|
#define SET_OVCOUNTdot(fdesc, rblok, value) \
|
||
|
set_dbitemval(fdesc, &rblok, DB_OVCOUNT, value)
|
||
|
|
||
|
#define FL_FREEFLAG 1
|
||
|
#define FL_SICABLOK 2
|
||
|
#define FL_PARTBLOK 3
|
||
|
#define FL_USENEWPD 4
|
||
|
#define FL_PADINREC 5
|
||
|
#define FL_OVFLWBUF 6
|
||
|
#define FL_OVFLWCHN 7
|
||
|
#define FL_SPAREBT4 8
|
||
|
#define FL_GRDELREC 9
|
||
|
#define FL_PIOVSREC 10
|
||
|
#define FL_GRPRESIZ 11
|
||
|
#define FL_T30FIRST 12
|
||
|
#define FL_T30LASTB 13
|
||
|
#define FL_BCKUPFLG 14
|
||
|
|
||
|
#define SET_FLAGWptr(fdesc, dataptr, value) \
|
||
|
if (fdesc->addr_support != NEW64)\
|
||
|
dataptr->b32.f.flagword = value;\
|
||
|
else\
|
||
|
dataptr->b64.f.flagword = value;
|
||
|
|
||
|
#define SET_FLAGWdot(fdesc, data, value) \
|
||
|
if (fdesc->addr_support != NEW64)\
|
||
|
data.b32.f.flagword = value;\
|
||
|
else\
|
||
|
data.b64.f.flagword = value;
|
||
|
|
||
|
#define GET_FLAGWptr(fdesc, dataptr, value) \
|
||
|
if (fdesc->addr_support != NEW64)\
|
||
|
value = dataptr->b32.f.flagword;\
|
||
|
else\
|
||
|
value = dataptr->b64.f.flagword;
|
||
|
|
||
|
#define GET_FLAGWdot(fdesc, data, value) \
|
||
|
if (fdesc->addr_support != NEW64)\
|
||
|
value = data.b32.f.flagword;\
|
||
|
else\
|
||
|
value = data.b64.f.flagword;
|
||
|
|
||
|
EXTERN int get_flag(
|
||
|
DBFILE *fdesc,
|
||
|
DBITEMNEW *dataptr,
|
||
|
int item,
|
||
|
int *value);
|
||
|
|
||
|
EXTERN int set_flag(DBFILE *fdesc,
|
||
|
DBITEMNEW *dataptr,
|
||
|
int item,
|
||
|
int value);
|
||
|
|
||
|
EXTERN uchar *get_data(
|
||
|
DBFILE *fdesc,
|
||
|
DBITEMNEW *dataptr,
|
||
|
uchar **value);
|
||
|
|
||
|
EXTERN int set_data(
|
||
|
DBFILE *fdesc,
|
||
|
DBITEMNEW *dataptr,
|
||
|
uchar *value,
|
||
|
DBDADDR len);
|
||
|
|
||
|
EXTERN uchar *get_ovxdata(
|
||
|
DBFILE *fdesc,
|
||
|
DBITEMNEW *dataptr,
|
||
|
uchar **value);
|
||
|
|
||
|
EXTERN int set_ovxdata(
|
||
|
DBFILE *fdesc,
|
||
|
DBITEMNEW *dataptr,
|
||
|
uchar *value,
|
||
|
DBDADDR len);
|
||
|
|
||
|
EXTERN DBDADDR get_dbitemval(
|
||
|
DBFILE *fdesc,
|
||
|
DBITEMNEW *dataptr,
|
||
|
int item,
|
||
|
DBDADDR *value);
|
||
|
|
||
|
EXTERN int set_dbitemval(
|
||
|
DBFILE *fdesc,
|
||
|
DBITEMNEW *dataptr,
|
||
|
int item,
|
||
|
DBDADDR value);
|
||
|
|
||
|
/* get_flag function defined in DBinit */
|
||
|
#define GET_FLAG(fdesc, dataptr, item, value) \
|
||
|
get_flag(fdesc,dataptr,item,value)
|
||
|
|
||
|
/* set_flag function defined in DBinit */
|
||
|
#define SET_FLAG(fdesc, dataptr, item, value) \
|
||
|
set_flag(fdesc,dataptr,item,value)
|
||
|
|
||
|
/* get_data function defined in DBinit */
|
||
|
#define GET_DATA(fdesc, dataptr, value) \
|
||
|
get_data(fdesc,dataptr,value)
|
||
|
|
||
|
/* set_data function defined in DBinit */
|
||
|
#define SET_DATA(fdesc, dataptr, value, len) \
|
||
|
set_data(fdesc,dataptr,value,len)
|
||
|
|
||
|
/* get_ovxdata function defined in DBinit */
|
||
|
#define GET_OVXDATA(fdesc, dataptr, value) \
|
||
|
get_ovxdata(fdesc,dataptr,value)
|
||
|
|
||
|
/* set_ovxdata function defined in DBinit */
|
||
|
#define SET_OVXDATA(fdesc, dataptr, value, len) \
|
||
|
set_ovxdata(fdesc,dataptr,value,len)
|
||
|
|
||
|
/*******************************************************************************
|
||
|
**
|
||
|
** T30info definition area
|
||
|
**
|
||
|
*******************************************************************************/
|
||
|
struct T30infonew64
|
||
|
{ DBDADDR curmod,
|
||
|
basemod,
|
||
|
largerec,
|
||
|
nextsplit,
|
||
|
filesp;
|
||
|
DBDADDR32 Htype,
|
||
|
splitload,
|
||
|
mergeload,
|
||
|
select_count;
|
||
|
};
|
||
|
|
||
|
struct T30infonew32
|
||
|
{ char padspace1[4];
|
||
|
DBDADDR32 curmod;
|
||
|
char padspace2[4];
|
||
|
DBDADDR32 basemod;
|
||
|
char padspace3[4];
|
||
|
DBDADDR32 largerec;
|
||
|
char padspace4[4];
|
||
|
DBDADDR32 nextsplit;
|
||
|
char padspace5[4];
|
||
|
DBDADDR32 filesp;
|
||
|
DBDADDR32 Htype,
|
||
|
splitload,
|
||
|
mergeload,
|
||
|
select_count;
|
||
|
};
|
||
|
|
||
|
struct T30infoold32
|
||
|
{ DBDADDR32 Htype,
|
||
|
splitload,
|
||
|
mergeload,
|
||
|
curmod,
|
||
|
basemod,
|
||
|
largerec,
|
||
|
filesp,
|
||
|
select_count,
|
||
|
nextsplit;
|
||
|
};
|
||
|
|
||
|
union T30infonew
|
||
|
{
|
||
|
struct T30infoold32 old32;
|
||
|
struct T30infonew32 new32;
|
||
|
struct T30infonew64 new64;
|
||
|
};
|
||
|
|
||
|
#define T30INFONEW union T30infonew
|
||
|
#define T30INFOOLD32 struct T30infoold32
|
||
|
#define T30INFONEW32 struct T30infonew32
|
||
|
#define T30INFONEW64 struct T30infonew64
|
||
|
|
||
|
/* This is the current T30info structure */
|
||
|
struct T30info
|
||
|
{ int Htype,
|
||
|
splitload,
|
||
|
mergeload,
|
||
|
curmod,
|
||
|
basemod,
|
||
|
largerec,
|
||
|
filesp,
|
||
|
select_count,
|
||
|
nextsplit;
|
||
|
};
|
||
|
/* Defines for set_t30info & get_t30info functions */
|
||
|
#define T30_HTYPE 1
|
||
|
#define T30_SPLIT 2
|
||
|
#define T30_MERGE 3
|
||
|
#define T30_CURMOD 4
|
||
|
#define T30_BASMOD 5
|
||
|
#define T30_LRGREC 6
|
||
|
#define T30_FILESP 7
|
||
|
#define T30_SELCNT 8
|
||
|
#define T30_NSPLIT 9
|
||
|
|
||
|
EXTERN DBDADDR get_t30info(
|
||
|
DBFILE *fdesc,
|
||
|
T30INFONEW *dataptr,
|
||
|
int item,
|
||
|
DBDADDR *value);
|
||
|
|
||
|
EXTERN DBDADDR set_t30info(
|
||
|
DBFILE *fdesc,
|
||
|
T30INFONEW *dataptr,
|
||
|
int item,
|
||
|
DBDADDR value);
|
||
|
|
||
|
/* get_t30info function defined in DBinit */
|
||
|
#define GET_T30HTYPE( fdesc, value ) \
|
||
|
get_t30info( fdesc, fdesc->info30new, T30_HTYPE, value )
|
||
|
|
||
|
#define GET_T30SPLIT( fdesc, value ) \
|
||
|
get_t30info( fdesc, fdesc->info30new, T30_SPLIT, value )
|
||
|
|
||
|
#define GET_T30MERGE( fdesc, value ) \
|
||
|
get_t30info( fdesc, fdesc->info30new, T30_MERGE, value )
|
||
|
|
||
|
#define GET_T30CURMOD( fdesc, value ) \
|
||
|
get_t30info( fdesc, fdesc->info30new, T30_CURMOD, value )
|
||
|
|
||
|
#define GET_T30BASMOD( fdesc, value ) \
|
||
|
get_t30info( fdesc, fdesc->info30new, T30_BASMOD, value )
|
||
|
|
||
|
#define GET_T30LRGREC( fdesc, value ) \
|
||
|
get_t30info( fdesc, fdesc->info30new, T30_LRGREC, value )
|
||
|
|
||
|
#define GET_T30FILESP( fdesc, value ) \
|
||
|
get_t30info( fdesc, fdesc->info30new, T30_FILESP, value )
|
||
|
|
||
|
#define GET_T30SELCNT( fdesc, value ) \
|
||
|
get_t30info( fdesc, fdesc->info30new, T30_SELCNT, value )
|
||
|
|
||
|
#define GET_T30NSPLIT( fdesc, value ) \
|
||
|
get_t30info( fdesc, fdesc->info30new, T30_NSPLIT, value )
|
||
|
|
||
|
#define GET_T30HTYPEdot( fdesc, value ) \
|
||
|
get_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_HTYPE, value )
|
||
|
|
||
|
#define GET_T30SPLITdot( fdesc, value ) \
|
||
|
get_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_SPLIT, value )
|
||
|
|
||
|
#define GET_T30MERGEdot( fdesc, value ) \
|
||
|
get_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_MERGE, value )
|
||
|
|
||
|
#define GET_T30CURMODdot( fdesc, value ) \
|
||
|
get_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_CURMOD, value )
|
||
|
|
||
|
#define GET_T30BASMODdot( fdesc, value ) \
|
||
|
get_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_BASMOD, value )
|
||
|
|
||
|
#define GET_T30LRGRECdot( fdesc, value ) \
|
||
|
get_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_LRGREC, value )
|
||
|
|
||
|
#define GET_T30FILESPdot( fdesc, value ) \
|
||
|
get_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_FILESP, value )
|
||
|
|
||
|
#define GET_T30SELCNTdot( fdesc, value ) \
|
||
|
get_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_SELCNT, value )
|
||
|
|
||
|
#define GET_T30NSPLITdot( fdesc, value ) \
|
||
|
get_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_NSPLIT, value )
|
||
|
|
||
|
/* set_t30info function defined in DBinit */
|
||
|
#define SET_T30HTYPE( fdesc, value ) \
|
||
|
set_t30info( fdesc, fdesc->info30new, T30_HTYPE, value )
|
||
|
|
||
|
#define SET_T30SPLIT( fdesc, value ) \
|
||
|
set_t30info( fdesc, fdesc->info30new, T30_SPLIT, value )
|
||
|
|
||
|
#define SET_T30MERGE( fdesc, value ) \
|
||
|
set_t30info( fdesc, fdesc->info30new, T30_MERGE, value )
|
||
|
|
||
|
#define SET_T30CURMOD( fdesc, value ) \
|
||
|
set_t30info( fdesc, fdesc->info30new, T30_CURMOD, value )
|
||
|
|
||
|
#define SET_T30BASMOD( fdesc, value ) \
|
||
|
set_t30info( fdesc, fdesc->info30new, T30_BASMOD, value )
|
||
|
|
||
|
#define SET_T30LRGREC( fdesc, value ) \
|
||
|
set_t30info( fdesc, fdesc->info30new, T30_LRGREC, value )
|
||
|
|
||
|
#define SET_T30FILESP( fdesc, value ) \
|
||
|
set_t30info( fdesc, fdesc->info30new, T30_FILESP, value )
|
||
|
|
||
|
#define SET_T30SELCNT( fdesc, value ) \
|
||
|
set_t30info( fdesc, fdesc->info30new, T30_SELCNT, value )
|
||
|
|
||
|
#define SET_T30NSPLIT( fdesc, value ) \
|
||
|
set_t30info( fdesc, fdesc->info30new, T30_NSPLIT, value )
|
||
|
|
||
|
#define SET_T30HTYPEdot( fdesc, value ) \
|
||
|
set_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_HTYPE, value )
|
||
|
|
||
|
#define SET_T30SPLITdot( fdesc, value ) \
|
||
|
set_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_SPLIT, value )
|
||
|
|
||
|
#define SET_T30MERGEdot( fdesc, value ) \
|
||
|
set_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_MERGE, value )
|
||
|
|
||
|
#define SET_T30CURMODdot( fdesc, value ) \
|
||
|
set_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_CURMOD, value )
|
||
|
|
||
|
#define SET_T30BASMODdot( fdesc, value ) \
|
||
|
set_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_BASMOD, value )
|
||
|
|
||
|
#define SET_T30LRGRECdot( fdesc, value ) \
|
||
|
set_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_LRGREC, value )
|
||
|
|
||
|
#define SET_T30FILESPdot( fdesc, value ) \
|
||
|
set_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_FILESP, value )
|
||
|
|
||
|
#define SET_T30SELCNTdot( fdesc, value ) \
|
||
|
set_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_SELCNT, value )
|
||
|
|
||
|
#define SET_T30NSPLITdot( fdesc, value ) \
|
||
|
set_t30info( &fdesc, (T30INFONEW *)fdesc.info30new, T30_NSPLIT, value )
|
||
|
/*******************************************************************************
|
||
|
**
|
||
|
** Partblock definition area
|
||
|
**
|
||
|
*******************************************************************************/
|
||
|
struct PFblock
|
||
|
{
|
||
|
int part_number;
|
||
|
char *vocname;
|
||
|
DBFILE *PFdesc;
|
||
|
};
|
||
|
|
||
|
struct T27info
|
||
|
{
|
||
|
int partfiles;
|
||
|
int parts_open;
|
||
|
PROGRAM *part_alg;
|
||
|
struct PFblock (*DFblock)[];
|
||
|
};
|
||
|
|
||
|
struct PFitem
|
||
|
{
|
||
|
DBDADDR32 flink;
|
||
|
int partnum;
|
||
|
int flagword;
|
||
|
};
|
||
|
|
||
|
struct PFitemnew64
|
||
|
{
|
||
|
DBDADDR flink;
|
||
|
int partnum;
|
||
|
int flagword;
|
||
|
};
|
||
|
|
||
|
typedef union PFitemnew
|
||
|
{
|
||
|
struct PFitem old;
|
||
|
struct PFitemnew64 new;
|
||
|
} PFITEMNEW;
|
||
|
|
||
|
#define SET_PFLINKptr(fdesc, itemptr, value) \
|
||
|
if (fdesc->addr_support != NEW64)\
|
||
|
itemptr->old.flink = value;\
|
||
|
else\
|
||
|
itemptr->new.flink = value;
|
||
|
|
||
|
#define SET_PFLINK(fdesc, itemptr, value) \
|
||
|
if (fdesc->addr_support != NEW64)\
|
||
|
itemptr.old.flink = value;\
|
||
|
else\
|
||
|
itemptr.new.flink = value;
|
||
|
|
||
|
#define SET_PFPARTNUM(fdesc, itemptr, value) \
|
||
|
if (fdesc->addr_support != NEW64)\
|
||
|
itemptr.old.partnum = value;\
|
||
|
else\
|
||
|
itemptr.new.partnum = value;
|
||
|
|
||
|
#define SET_PFLAG(fdesc, itemptr, value) \
|
||
|
if (fdesc->addr_support != NEW64)\
|
||
|
itemptr.old.flagword = value;\
|
||
|
else\
|
||
|
itemptr.new.flagword = value;
|
||
|
|
||
|
/* get_pflink function defined in DBinit */
|
||
|
#define GET_PFLINK(fdesc, dataptr, value) \
|
||
|
get_pflink(fdesc,dataptr,value)
|
||
|
|
||
|
/* get_pfpartnum function defined in DBinit */
|
||
|
#define GET_PFPARTNUM(fdesc, dataptr, value) \
|
||
|
get_pfpartnum(fdesc,dataptr,value)
|
||
|
|
||
|
struct PFlist
|
||
|
{
|
||
|
int part_count;
|
||
|
int active;
|
||
|
int opened;
|
||
|
int part_number;
|
||
|
uchar *vocname;
|
||
|
uchar *pathname;
|
||
|
struct PFlist *nextlist;
|
||
|
struct PFlist *prevlist;
|
||
|
};
|
||
|
|
||
|
#define PFITEM struct PFitem
|
||
|
#define PFLIST struct PFlist
|
||
|
#define PFDESC(x) (*fdesc->info27.DFblock)[x].PFdesc
|
||
|
|
||
|
/*******************************************************************************
|
||
|
**
|
||
|
** query definition area
|
||
|
**
|
||
|
*******************************************************************************/
|
||
|
#define case_HASHED case 2: case 3: case 4: case 5: case 6:\
|
||
|
case 7: case 8: case 9: case 10: case 11:\
|
||
|
case 12: case 13: case 14: case 15: case 16:\
|
||
|
case 17: case 18
|
||
|
|
||
|
#define MAX_KEY_LENGTH 255
|
||
|
|
||
|
struct sqlidx
|
||
|
{
|
||
|
IDXENT *sqlkey;
|
||
|
struct sqlidx *chain;
|
||
|
};
|
||
|
|
||
|
/* vvv 22395 vvv; define caching structure */
|
||
|
struct cnode
|
||
|
{
|
||
|
STRING atid;
|
||
|
STRING atrecord;
|
||
|
struct cnode *chain;
|
||
|
}; /* <<< 22395 ^^^ */
|
||
|
|
||
|
/* vvv JBG 19863 vvv */
|
||
|
struct jrnode
|
||
|
{
|
||
|
unsigned short *jrucols;
|
||
|
STRING name;
|
||
|
struct jrnode *chain;
|
||
|
}; /* <<< 19863 ^^^ */
|
||
|
|
||
|
struct sqlperm {
|
||
|
UVSICAREGION *sica;
|
||
|
int size;
|
||
|
UVSICA *uvsica;
|
||
|
int dba;
|
||
|
int perms;
|
||
|
int uid;
|
||
|
int no_integrity;
|
||
|
int col_cnt;
|
||
|
int *col_cons;
|
||
|
int key_cnt;
|
||
|
int *key_cons;
|
||
|
int check_cnt;
|
||
|
UVSICACHECK *check;
|
||
|
PROGRAM **code;
|
||
|
int tabuniq_cnt;
|
||
|
UVSICAUNIQUEC *tabuniq;
|
||
|
int refer_cnt;
|
||
|
UVSICAREFER *refer;
|
||
|
struct sqlidx *mpidx;
|
||
|
struct jrnode *jru_cons; /* <<< JBG 19863 <<< */
|
||
|
};
|
||
|
|
||
|
typedef struct sqlperm SQLPERM;
|
||
|
|
||
|
#define SQL_WR_PERM 0x1
|
||
|
#define SQL_RD_PERM 0x2
|
||
|
#define SQL_DL_PERM 0x4
|
||
|
#define SQL_IN_PERM 0x8
|
||
|
#define SQL_UP_PERM 0x10
|
||
|
#define SQL_PU_PERM 0x20
|
||
|
|
||
|
#define CON_SETFLAG 0x1
|
||
|
#define CON_NOTNULL 0x2
|
||
|
#define CON_NOTEMPTY 0x4
|
||
|
#define CON_TABLEUNIQUE 0x8
|
||
|
#define CON_SETUNIQUE 0x10
|
||
|
#define CON_CHECKBIT 0x20
|
||
|
#define CON_CONMASK 0x3f /* <<< JBG 19863 <<< */
|
||
|
#define CON_numericcol 0x100 /* <<< JBG 19863 <<< */
|
||
|
|
||
|
/* DBopen file flags */
|
||
|
#define OF_INCONSISTENT 0x1 /* bitmap of field TLflags in file header */
|
||
|
#define OF_SICA_STRIPPED 0x2 /* <<< 20255 <<< */
|
||
|
|
||
|
/***** Definition of flag bits used in fourth parameter to DBopen
|
||
|
0x1 rotating file pool
|
||
|
0x2 DBlackey
|
||
|
0x4 View_aware
|
||
|
0x8 special DBlackey to get sql perms
|
||
|
0x10 open inconsistent files
|
||
|
0x20 open files stripped of SICA by fnuxi -import
|
||
|
0x40 open files but not any associated indexes
|
||
|
*/
|
||
|
#define VIEW_AWARE 0x4
|
||
|
#define OPEN_INCONS 0x10
|
||
|
#define OPEN_NOSICA 0x20 /* <<< 20255 <<< */
|
||
|
#define OPEN_NOINDX 0x40 /* gtar 16692 */
|
||
|
|
||
|
/*******************************************************************************
|
||
|
**
|
||
|
** DBFILE definition area
|
||
|
**
|
||
|
** The first part of this structure MUST match the multi_file structure
|
||
|
** defined in MFILE.h !!!!!!!!
|
||
|
*******************************************************************************/
|
||
|
struct Dfile
|
||
|
{ char openc, /* Must match multi-file struct */
|
||
|
mode; /* Must match multi-file struct */
|
||
|
int fp,filenum; /* Must match multi-file struct */
|
||
|
FILE *fptr; /* Must match multi-file struct */
|
||
|
char *fname; /* Must match multi-file struct */
|
||
|
short AC,netflg,netid,netfdesc;/* Must match multi-file struct */
|
||
|
long tell; /* Must match multi-file struct */
|
||
|
int mkdbstamp; /* Must match multi-file struct */
|
||
|
int sync_on; /* Must match multi-file struct */
|
||
|
int EBWSsave; /* Must match multi-file struct */
|
||
|
int lginter; /* Must match multi-file struct */
|
||
|
/* */
|
||
|
/* From here on is specific to Dfile struct */
|
||
|
/* */
|
||
|
MFILE *over30;
|
||
|
int Part_number;
|
||
|
int PB_offset;
|
||
|
PROGRAM *Part_alg;
|
||
|
uchar *Part_alg_source;
|
||
|
struct T30info *info30;
|
||
|
T30INFONEW *info30new;
|
||
|
struct T27info info27;
|
||
|
int Filerev;
|
||
|
DBDADDR M;
|
||
|
int N,
|
||
|
Hk,
|
||
|
Ihead,
|
||
|
Bsize;
|
||
|
DBDADDR C,
|
||
|
curptr,
|
||
|
rbase;
|
||
|
DBITEMNEW *bufptr;
|
||
|
short active,
|
||
|
refs,
|
||
|
flock, /* active file lock ? */
|
||
|
may_close; /* may close in a transaction */
|
||
|
uv_ino_t inode;
|
||
|
uUVLONG dev;
|
||
|
struct Dfile *RSZdesc;
|
||
|
IDXENT *idxhead;
|
||
|
int idxoff;
|
||
|
IDXMAP sqlidxmap;
|
||
|
int scanactive;
|
||
|
int tlfilenum;
|
||
|
struct Dstats *Sstat;
|
||
|
SQLPERM *sqlperms;
|
||
|
UVINT size; /* the size returned by stat() */
|
||
|
int clrtime; /* time of last clearfile */
|
||
|
int baktime; /* time of last UVbackup/UVrestore */
|
||
|
DBDADDR bakcnt; /* count from last UVbackup/UVrestore */
|
||
|
int bakflgs; /* set by UVbackup/used by UVrestore */
|
||
|
DBDADDR latchaddr; /* DML. address latched by DBwread */
|
||
|
short has_updates; /* TX has updates */
|
||
|
char *vocname;
|
||
|
struct dbcursor *sqlcp; /* Pointer to a cursor if a VIEW */
|
||
|
REFENT *refhead;
|
||
|
int latch;
|
||
|
void *txscanc; /* Pointer to a TXSCANC */
|
||
|
char *mapname; /* NLSmapname from file header */
|
||
|
int checksum; /* NLSmapcsum from file header */
|
||
|
char *sortmap; /* NLS sorting local from file header */
|
||
|
int sortcksum; /* NLS sorting locale checksum from file header */
|
||
|
CMAP *ipmap; /* NLS Mapping table for READ */
|
||
|
CMAP *opmap; /* NLS Mapping table for WRITE */
|
||
|
void *pflist; /* Pointer to a TXPFLIST */
|
||
|
void *ptrigblk; /* ptr to TXTRLIST, enabled triggers */
|
||
|
STRING scandata; /* data of last key scanned */
|
||
|
int trigcasc; /* summary of triggers/cascades */
|
||
|
int os_deleted; /* Whether the file is deleted at the OS level */
|
||
|
EXFLAGS flags; /* extended flag bits */
|
||
|
int uniqueId; /* UDR unique file identifier */
|
||
|
struct cnode *cachelst; /* chain of cached records <<< 22395 */
|
||
|
short cachelmt; /* upper limit of number of records in cache <<< 22395 */
|
||
|
short cachesize; /* number of records in cache <<< 22395 */
|
||
|
int addr_support; /* type of bit support; see include/filehdr.h */
|
||
|
DBDADDR hashdata; /* return value of last hashxx() function */
|
||
|
};
|
||
|
|
||
|
typedef struct Dstats
|
||
|
{ DBDADDR32 Sread,
|
||
|
Sreadu,
|
||
|
Swrite,
|
||
|
Swriteu,
|
||
|
Sosrd,
|
||
|
Soswr,
|
||
|
Sofrd,
|
||
|
Scomp,
|
||
|
Swlckd,
|
||
|
Suwait,
|
||
|
Sruhit,
|
||
|
Sclear,
|
||
|
Sdelete,
|
||
|
Sselect;
|
||
|
time_t Ststamp;
|
||
|
DBDADDR32 Sreads,
|
||
|
Srshit,
|
||
|
Sopen; /* Number of opens done on file */
|
||
|
} DSTATS, *PDSTATS;
|
||
|
|
||
|
struct idxent
|
||
|
{ DBFILE idxdesc;
|
||
|
struct idxent *chain;
|
||
|
PROGRAM *idxicode;
|
||
|
char *data;
|
||
|
short datalen;
|
||
|
char keylen,type,multi,built,nulls,enabled;
|
||
|
char filename[10];
|
||
|
char keyname[256];
|
||
|
char *nlssortmap;
|
||
|
int nlssortcsum;
|
||
|
};
|
||
|
|
||
|
struct refent
|
||
|
{ DBFILE referdesc;
|
||
|
struct refent *chain;
|
||
|
char schematable[256];
|
||
|
int referenced;
|
||
|
};
|
||
|
|
||
|
struct dbflist { DBFILE *filedesc;
|
||
|
struct dbflist *next,
|
||
|
*prev;
|
||
|
};
|
||
|
|
||
|
struct selflist { SELFILE *filedesc;
|
||
|
struct selflist *next,
|
||
|
*prev;
|
||
|
};
|
||
|
|
||
|
/*******************************************************************************
|
||
|
**
|
||
|
** File scanning definition area
|
||
|
**
|
||
|
*******************************************************************************/
|
||
|
struct SHdata
|
||
|
{ DBFILE *SHfdesc;
|
||
|
DBDADDR SHrptr,
|
||
|
SHblink,
|
||
|
SHkey,
|
||
|
SHsavcurptr;
|
||
|
DBITEMNEW *SHiptr;
|
||
|
char *SHbuf,
|
||
|
*SHovbuf;
|
||
|
uchar *SHkptr;
|
||
|
DBDADDR SHgroup,
|
||
|
SHlast_group,
|
||
|
SHcur_group,
|
||
|
SHbase_mod,
|
||
|
SHcur_base,
|
||
|
SHnext_base;
|
||
|
int SHkeychk,
|
||
|
SHselect_pending,
|
||
|
SHsavovf30,
|
||
|
SHkeysize,
|
||
|
SHkeyincr,
|
||
|
SHkptrsize;
|
||
|
STRING SHkeylst;
|
||
|
STRING SH_NLSkey;
|
||
|
STRING SH_NLSdata;
|
||
|
DBDADDR prevSHgroup,
|
||
|
prevSHcur_group; /* <<< 22658 */
|
||
|
int SHzero_blink;
|
||
|
};
|
||
|
|
||
|
#define UVSEL_INACTIVE 0
|
||
|
#define UVSEL_WRITE 1
|
||
|
#define UVSEL_ACTIVE 2
|
||
|
#define UVSEL_READ 3
|
||
|
EXTERN int SELBUF_MAX;
|
||
|
|
||
|
/* Define bit usage for flags field of Dselect structure */
|
||
|
#define UVSEL_RMODE 0x0001 /* must be same as _READ */
|
||
|
#define UVSEL_DELSEL 0x0002
|
||
|
|
||
|
/* Define flag bits for MFSflags */
|
||
|
#define MFSEOF 1 << 0 /* EOF seen on last disk read */
|
||
|
#define MFSDONE 1 << 1 /* All data has been read */
|
||
|
#define MFSMEM 1 << 2 /* Select list is in memory */
|
||
|
#define MFSINIT 1 << 3 /* Select list has been inited */
|
||
|
#define MFSNOPRINT 1 << 4 /* Nothing left to print */
|
||
|
|
||
|
struct Dselect
|
||
|
{
|
||
|
int status;
|
||
|
int nxtgrp; /* next group to process */
|
||
|
int partfile; /* partfile of Distributed file */
|
||
|
char *name; /* temporary select list file name */
|
||
|
MFILE *fp; /* temporary select list file */
|
||
|
DBFILE *srcfile; /* file being SELECTed from BASIC */
|
||
|
STRING sel_buff; /* in-memory buffer area */
|
||
|
uchar *readptr; /* in-memory pointer for reading next id */
|
||
|
int flags; /* if bit 0 set, don't unlink temp sel list */
|
||
|
/* if bit 1 set, open sel file in rdwr mode */
|
||
|
int retain; /* 1 means do not close SELfile in readnext */
|
||
|
short nfiles,nfields; /* # files, fields for optimized lists */
|
||
|
STRING MFShdr; /* multi file select list header */
|
||
|
STRING MFSbuffer; /* binary data block */
|
||
|
uchar *MFSbptr; /* pointer into MFS buffer */
|
||
|
uint MFSflags; /* flags for MFS buffering */
|
||
|
struct SHdata SaveSHd; /* used for group at a time mode */
|
||
|
int items; /* selected items if active */
|
||
|
};
|
||
|
|
||
|
/*******************************************************************************
|
||
|
**
|
||
|
** File header structure definition area
|
||
|
**
|
||
|
** total size of this struct is 1024
|
||
|
** This structure is used by the filehdr_get_all function for all files
|
||
|
** with revision stamps less then or equal to 0xacef010b (9.4.x)
|
||
|
*******************************************************************************/
|
||
|
struct UVhdrold32
|
||
|
{ DBDADDR32 revision,
|
||
|
modulus,
|
||
|
separation,
|
||
|
filetype,
|
||
|
freechain,
|
||
|
idxoff;
|
||
|
char resizepath[64],
|
||
|
unused1[4];
|
||
|
T30INFOOLD32 info30;
|
||
|
DSTATS Sstat;
|
||
|
DBDADDR32 nlssortcsum;
|
||
|
char nlssortmap[32],
|
||
|
unused2[40];
|
||
|
DBDADDR32 tlfilnum,
|
||
|
ptlfilnum,
|
||
|
tlflags,
|
||
|
chkpoint;
|
||
|
char txwarmlsn[8];
|
||
|
DBDADDR32 nlsmapcsum;
|
||
|
char nlsmapname[32],
|
||
|
unused3[28];
|
||
|
DBDADDR32 clrfiltime,
|
||
|
baktime,
|
||
|
bakcnt,
|
||
|
bakflgs,
|
||
|
uvreadonly;
|
||
|
char indexpath[128];
|
||
|
DBDADDR32 sicadata,
|
||
|
mkdbstamp,
|
||
|
partblock;
|
||
|
char uvschema[20];
|
||
|
DBDADDR32 colcnt,
|
||
|
colmap,
|
||
|
udrflags,
|
||
|
udrunique;
|
||
|
char unused4[464];
|
||
|
};
|
||
|
|
||
|
/* total size of this struct is 1024
|
||
|
** This structure is used for all files with revision 0xacef010c and higher
|
||
|
*/
|
||
|
struct UVhdrnew32
|
||
|
{ DBDADDR32 revision,
|
||
|
filetype;
|
||
|
char padspace1[4];
|
||
|
DBDADDR32 modulus;
|
||
|
DBDADDR32 separation,
|
||
|
idxoff;
|
||
|
char padspace2[4];
|
||
|
DBDADDR32 freechain;
|
||
|
T30INFONEW32 info30;
|
||
|
char padspace7[4];
|
||
|
DBDADDR32 sicadata;
|
||
|
char padspace8[4];
|
||
|
DBDADDR32 partblock;
|
||
|
char unused1[24];
|
||
|
DSTATS Sstat;
|
||
|
DBDADDR32 nlssortcsum;
|
||
|
char nlssortmap[32],
|
||
|
unused2[40];
|
||
|
DBDADDR32 tlfilnum,
|
||
|
ptlfilnum,
|
||
|
tlflags,
|
||
|
chkpoint;
|
||
|
char txwarmlsn[8];
|
||
|
DBDADDR32 nlsmapcsum;
|
||
|
char nlsmapname[32],
|
||
|
unused3[28];
|
||
|
DBDADDR32 clrfiltime,
|
||
|
baktime,
|
||
|
bakflgs;
|
||
|
char unused4[4];
|
||
|
DBDADDR32 bakcnt;
|
||
|
char unused5[132];
|
||
|
DBDADDR32 mkdbstamp,
|
||
|
uvreadonly;
|
||
|
char unused6[20];
|
||
|
DBDADDR32 colcnt,
|
||
|
colmap,
|
||
|
udrflags,
|
||
|
udrunique;
|
||
|
char unused7[16];
|
||
|
char indexpath[256];
|
||
|
char uvschema[64];
|
||
|
char resizepath[128];
|
||
|
};
|
||
|
|
||
|
/* total size of this struct is 1024
|
||
|
** This structure is used for all files with revision 0xacef020c and higher
|
||
|
*/
|
||
|
struct UVhdrnew64
|
||
|
{ DBDADDR32 revision,
|
||
|
filetype;
|
||
|
DBDADDR modulus;
|
||
|
DBDADDR32 separation,
|
||
|
idxoff;
|
||
|
DBDADDR freechain;
|
||
|
T30INFONEW64 info30;
|
||
|
DBDADDR sicadata,
|
||
|
partblock;
|
||
|
char unused1[24];
|
||
|
DSTATS Sstat;
|
||
|
DBDADDR32 nlssortcsum;
|
||
|
char nlssortmap[32],
|
||
|
unused2[40];
|
||
|
DBDADDR32 tlfilnum,
|
||
|
ptlfilnum,
|
||
|
tlflags,
|
||
|
chkpoint;
|
||
|
char txwarmlsn[8];
|
||
|
DBDADDR32 nlsmapcsum;
|
||
|
char nlsmapname[32],
|
||
|
unused3[28];
|
||
|
DBDADDR32 clrfiltime,
|
||
|
baktime,
|
||
|
bakflgs;
|
||
|
DBDADDR bakcnt;
|
||
|
char unused4[132];
|
||
|
DBDADDR32 mkdbstamp,
|
||
|
uvreadonly;
|
||
|
char unused5[20];
|
||
|
DBDADDR32 colcnt,
|
||
|
colmap,
|
||
|
udrflags,
|
||
|
udrunique;
|
||
|
char unused6[16];
|
||
|
char indexpath[256];
|
||
|
char uvschema[64];
|
||
|
char resizepath[128];
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
** This structure is used by the 'filehdr_get_all' and 'filehdr_set_all' functions
|
||
|
*/
|
||
|
typedef union UVhfileheader
|
||
|
{
|
||
|
struct UVhdrold32 old32;
|
||
|
struct UVhdrnew32 new32;
|
||
|
struct UVhdrnew64 new64;
|
||
|
} UVFILEHDR;
|
||
|
|
||
|
EXTERN void SELclose(), SELinit(), SELcpy();
|
||
|
EXTERN char *SELname();
|
||
|
EXTERN int SELmake(),SELadd(),SELactivate();
|
||
|
EXTERN int SELwrite(),SELmove(),SELtmp();
|
||
|
|
||
|
EXTERN DBDADDR (*phash[])();
|
||
|
EXTERN DBDADDR DBgetover();
|
||
|
EXTERN char *DBkeyfile(),*DBscandir();
|
||
|
EXTERN DBscan(),DBscant25(),DBscanhash();
|
||
|
EXTERN int DBclrfl(),DBdelete(),DBopen(),DBopenvoc(),DBrelease();
|
||
|
EXTERN int DBrblok(),DBreopen(),DBselect(),DBsplit30(),DBmerge30();
|
||
|
EXTERN int DBtestlock(),DBwblok(),DBwrite(),DBwsemu(),DBread_pads();
|
||
|
EXTERN DBDADDR DBhash(),T30hash();
|
||
|
EXTERN void DBclose(),DBcompact(),DBfree(),DBinit(),DBrelover();
|
||
|
EXTERN void DBfreebuf(),DBwsemv(),DBfsemv();
|
||
|
EXTERN unsign DBwsemp(),DBfsemp(),DBrsemp(),DBrsemv();
|
||
|
EXTERN STRING DBprobe(),DBReadLock();
|
||
|
EXTERN STRING trans(),readnext();
|
||
|
EXTERN int DBsopen(),DBswrite(),DBsweof();
|
||
|
EXTERN STRING DBsread();
|
||
|
EXTERN DBITEMNEW *DBgetbuf();
|
||
|
EXTERN DBITEMNEW *DBfind(),*DBalloc();
|
||
|
EXTERN STRING DBread(), DBwread(), DBfinfo();
|
||
|
|
||
|
#endif /* end of DBFILE.h */
|