43 tvbpid = GetCurrentProcessId();
57 memcpy (psvblogheader->
coperation, pctranstype, 2);
91 static off_t toffset = 0;
92 static int iprevlen = 0;
95 itranslength +=
sizeof (
struct SLOGHDR) + INTSIZE;
110 iprevlen = itranslength;
119 (ssize_t) itranslength) {
170 int ihandle, iresult = 0;
174 if (!psvbptr || psvbptr->
iisopen == 2) {
197 char *pcbuffer, *pcrow;
200 int ierrorencountered = 0;
208 ilocalhandle[iloop] = iloop;
210 ilocalhandle[iloop] = -1;
212 isavedhandle[iloop] = ilocalhandle[iloop];
225 while (!ifoundbegin) {
232 if (toffset == -(INTSIZE)) {
237 tlength - INTSIZE) != tlength - INTSIZE) {
245 if (toffset < INTSIZE) {
265 if (ilocalhandle[ihandle] != -1 &&
psvbfile[ihandle]->iisopen == 0) {
269 ilocalhandle[ihandle] =
270 isopen (pcbuffer + INTSIZE + INTSIZE, iloop + ISMANULOCK + ISINOUT);
271 if (ilocalhandle[ihandle] == -1) {
276 if (ilocalhandle[ihandle] == -1) {
280 pcrow = pcbuffer + INTSIZE +
QUADSIZE + INTSIZE;
283 if (
isdelrec (ilocalhandle[ihandle], trownumber)) {
288 if (ilocalhandle[ihandle] == -1) {
292 pcrow = pcbuffer + INTSIZE +
QUADSIZE + INTSIZE + INTSIZE;
294 if (
isrewrec (ilocalhandle[ihandle], trownumber, pcrow)) {
299 if (ilocalhandle[ihandle] == -1) {
303 pcrow = pcbuffer + INTSIZE +
QUADSIZE + INTSIZE;
304 ivbenter (ilocalhandle[ihandle], 1, 0);
308 ierrorencountered = EBADFILE;
310 if (
ivbwriterow (ilocalhandle[ihandle], pcrow, trownumber)) {
311 ierrorencountered = EDUPL;
315 ivbexit (ilocalhandle[ihandle]);
318 if (ilocalhandle[ihandle] == -1) {
321 isclose (ilocalhandle[ihandle]);
322 ilocalhandle[ihandle] = -1;
326 if (isavedhandle[iloop] != -1 &&
psvbfile[isavedhandle[iloop]]) {
330 return ierrorencountered;
337 off_t tlength, trownumber;
345 ilocalhandle[iloop] = iloop;
347 ilocalhandle[iloop] = -1;
349 isavedhandle[iloop] = ilocalhandle[iloop];
362 while (!ifoundbegin) {
369 if (toffset == -(INTSIZE)) {
374 tlength - INTSIZE) != tlength - INTSIZE) {
382 if (toffset < INTSIZE) {
402 if (ilocalhandle[ihandle] != -1) {
406 ilocalhandle[ihandle] =
407 isopen (pcbuffer + INTSIZE + INTSIZE, iloop + ISMANULOCK + ISINOUT);
408 if (ilocalhandle[ihandle] == -1) {
413 if (ilocalhandle[ihandle] == -1) {
416 ivbenter (ilocalhandle[ihandle], 1, 0);
423 psvbfile[ilocalhandle[ihandle]]->sdictnode.
425 }
else if (
ivbdatafree (ilocalhandle[ihandle], trownumber)) {
428 ivbexit (ilocalhandle[ihandle]);
431 if (ilocalhandle[ihandle] == -1) {
434 isclose (ilocalhandle[ihandle]);
438 if (isavedhandle[iloop] != -1 &&
psvbfile[isavedhandle[iloop]]) {
467 int iholdstatus =
ivbintrans, iloop, iresult = 0;
485 if (psvbptr && psvbptr->
iisopen == 1) {
547 int iloop, iresult = 0;
560 if (psvbptr && psvbptr->
iisopen == 1) {
586 if (psvbptr && psvbptr->
iisopen == 1) {
595 return (iresult ? -1 : 0);
599 ivbtransbuild (
const char *pcfilename,
const int iminrowlen,
const int imaxrowlen,
600 struct keydesc *
pskeydesc,
const int imode)
603 struct keypart *pskptr;
604 int ilength = 0, ilength2, iloop;
621 inl_stint (iminrowlen, pcbuffer + INTSIZE);
622 inl_stint (imaxrowlen, pcbuffer + (2 * INTSIZE));
623 inl_stint (pskeydesc->k_flags, pcbuffer + (3 * INTSIZE));
624 inl_stint (pskeydesc->k_nparts, pcbuffer + (4 * INTSIZE));
625 pcbuffer += (INTSIZE * 6);
626 for (iloop = 0; iloop < pskeydesc->k_nparts; iloop++) {
627 pskptr = &pskeydesc->k_part[iloop];
628 inl_stint (pskptr->kp_start, pcbuffer + (iloop * 3 * INTSIZE));
630 pcbuffer + INTSIZE + (iloop * 3 * INTSIZE));
632 pcbuffer + (INTSIZE * 2) + (iloop * 3 * INTSIZE));
633 ilength += pskptr->kp_leng;
636 ilength = (INTSIZE * 6) + (INTSIZE * 3 * (pskeydesc->k_nparts));
637 ilength2 = strlen (pcfilename) + 1;
639 memcpy (pcbuffer, pcfilename, (
size_t)ilength2);
651 struct keypart *pskptr;
652 int ilength = 0, iloop;
669 inl_stint (pskeydesc->k_flags, pcbuffer + INTSIZE);
670 inl_stint (pskeydesc->k_nparts, pcbuffer + (2 * INTSIZE));
671 pcbuffer += (INTSIZE * 4);
672 for (iloop = 0; iloop < pskeydesc->k_nparts; iloop++) {
673 pskptr = &pskeydesc->k_part[iloop];
674 inl_stint (pskptr->kp_start, pcbuffer + (iloop * 3 * INTSIZE));
676 pcbuffer + INTSIZE + (iloop * 3 * INTSIZE));
678 pcbuffer + (INTSIZE * 2) + (iloop * 3 * INTSIZE));
679 ilength += pskptr->kp_leng;
682 ilength = (INTSIZE * 4) + (INTSIZE * 3 * (pskeydesc->k_nparts));
704 if (ivblogfilehandle < 0 || psvbptr->
iopenmode & ISNOLOG) {
725 irowlength += (INTSIZE * 2) +
QUADSIZE;
737 struct keypart *pskptr;
738 int ilength = 0, iloop;
755 inl_stint (pskeydesc->k_flags, pcbuffer + INTSIZE);
756 inl_stint (pskeydesc->k_nparts, pcbuffer + (2 * INTSIZE));
757 pcbuffer += (INTSIZE * 4);
758 for (iloop = 0; iloop < pskeydesc->k_nparts; iloop++) {
759 pskptr = &pskeydesc->k_part[iloop];
760 inl_stint (pskptr->kp_start, pcbuffer + (iloop * 3 * INTSIZE));
762 pcbuffer + INTSIZE + (iloop * 3 * INTSIZE));
764 pcbuffer + (INTSIZE * 2) + (iloop * 3 * INTSIZE));
765 ilength += pskptr->kp_leng;
768 ilength = (INTSIZE * 4) + (INTSIZE * 3 * (pskeydesc->k_nparts));
795 ilength = strlen (pcfilename) + 1;
797 memcpy (pcbuffer, pcfilename, (
size_t)ilength);
813 if (ivblogfilehandle < 0 || psvbptr->
iopenmode & ISNOLOG) {
829 ilength = strlen (pcfilename) + 1;
833 memcpy (pcbuffer + INTSIZE + INTSIZE, pcfilename, (
size_t)ilength);
834 ilength += (INTSIZE * 2);
850 if (ivblogfilehandle < 0 || psvbptr->
iopenmode & ISNOLOG) {
864 ilength = strlen (pcfilename) + 1;
868 memcpy (pcbuffer + INTSIZE + INTSIZE, pcfilename, (
size_t)ilength);
869 ilength += (INTSIZE * 2);
878 ivbtransinsert (
const int ihandle,
const off_t trownumber,
int irowlength,
char *pcrow)
884 if (ivblogfilehandle < 0 || psvbptr->
iopenmode & ISNOLOG) {
904 memcpy (pcbuffer + INTSIZE +
QUADSIZE + INTSIZE, pcrow, (
size_t)irowlength);
905 irowlength += (INTSIZE * 2) +
QUADSIZE;
917 int ilength, ilength1, ilength2;
933 ilength1 = strlen (pcoldname) + 1;
934 ilength2 = strlen (pcnewname) + 1;
936 inl_stint (ilength2, pcbuffer + INTSIZE);
937 memcpy (pcbuffer + (INTSIZE * 2), pcoldname, (
size_t)ilength1);
938 memcpy (pcbuffer + (INTSIZE * 2) + ilength1, pcnewname, (
size_t)ilength2);
939 ilength = (INTSIZE * 2) + ilength1 + ilength2;
954 if (ivblogfilehandle < 0 || psvbptr->
iopenmode & ISNOLOG) {
1014 ivbtransupdate (
const int ihandle,
const off_t trownumber,
const int ioldrowlen,
const int inewrowlen,
const char *pcrow)
1043 (
size_t)ioldrowlen);
1044 memcpy (pcbuffer + INTSIZE +
QUADSIZE + INTSIZE + INTSIZE + ioldrowlen, pcrow,
1045 (
size_t)inewrowlen);
1046 ilength = INTSIZE +
QUADSIZE + (INTSIZE * 2) + ioldrowlen + inewrowlen;
ssize_t tvbwrite(const int ihandle, const void *pvbuffer, const size_t tcount)
int ivblock(const int ihandle, const off_t toffset, const off_t tlength, const int imode)
int ivbopen(const char *pcfilename, const int iflags, const mode_t tmode)
static void vinitpiduid(void)
int ivbtransuniqueid(const int ihandle, const off_t tuniqueid)
int ivbforcedataallocate(const int ihandle, const off_t trownumber)
static int inl_ldint(void *pclocation)
int ivbtransbuild(const char *pcfilename, const int iminrowlen, const int imaxrowlen, struct keydesc *pskeydesc, const int imode)
static int iwritebegin(void)
int ivbtransdelete(const int ihandle, off_t trownumber, int irowlength)
int ivbtransinsert(const int ihandle, const off_t trownumber, int irowlength, char *pcrow)
static int idemotelocks(void)
int ivbdatafree(const int ihandle, const off_t trownumber)
static int ivbrollmeforward(off_t toffset)
int isrewrec(const int ihandle, const long long trownumber, char *pcrow)
int isdelrec(const int ihandle, long long trownumber)
static char cvbtransbuffer[65536]
static void inl_stlong(int lvalue, void *pclocation)
int ivbenter(const int ihandle, const unsigned int imodifying, const unsigned int ispecial)
static int iwritetrans(int itranslength, const int irollback)
int ivbtranserase(const char *pcfilename)
static void inl_stint(int ivalue, void *pclocation)
unsigned char iisdictlocked
int isopen(const char *pcfilename, int imode)
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
static int ivbrollmeback(off_t toffset, const int iinrecover)
int ivbdatalock(const int ihandle, const int imode, const off_t trownumber)
int ivbtranssetunique(const int ihandle, const off_t tuniqueid)
int ivbtransclose(const int ihandle, const char *pcfilename)
int ivbwriterow(const int ihandle, char *pcrow, const off_t trownumber)
int ivbtransrename(char *pcoldname, char *pcnewname)
struct DICTINFO * psvbfile[128+1]
int ivbtransopen(const int ihandle, const char *pcfilename)
unsigned char iisdatalocked
int ivbclose(const int ihandle)
int ivbexit(const int ihandle)
int isclose(const int ihandle)
static void inl_stquad(off_t tvalue, void *pclocation)
ssize_t tvbread(const int ihandle, void *pvbuffer, const size_t tcount)
int ivbtranscreateindex(int const ihandle, struct keydesc *pskeydesc)
#define MAX_BUFFER_LENGTH
static void vtranshdr(const char *pctranstype)
struct keydesc * pskeydesc[32]
static off_t inl_ldquad(void *pclocation)
int islogopen(const char *pcfilename)
int ivbtransdeleteindex(const int ihandle, struct keydesc *pskeydesc)
static struct SLOGHDR * psvblogheader
int ivbclose2(const int ihandle)
int ivbtransupdate(const int ihandle, const off_t trownumber, const int ioldrowlen, const int inewrowlen, const char *pcrow)
off_t tvblseek(const int ihandle, off_t toffset, const int iwhence)