Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ca012682
Commit
ca012682
authored
Apr 02, 2013
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fix huge vec tables bug. This was not yet completely implemented for Unix.
modified: storage/connect/filamvct.cpp
parent
d8056905
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
262 additions
and
277 deletions
+262
-277
storage/connect/filamvct.cpp
storage/connect/filamvct.cpp
+262
-277
No files found.
storage/connect/filamvct.cpp
View file @
ca012682
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
/* WHAT THIS PROGRAM DOES: */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
/* ----------------------- */
/* This program are the VCT file access method classes. */
/* This program are the VCT file access method classes. */
/* Added in version 2: */
/* Added in version 2:
F
*/
/* - Split Vec format. */
/* - Split Vec format. */
/* - Partial delete. */
/* - Partial delete. */
/* - Use of tempfile for update. */
/* - Use of tempfile for update. */
...
@@ -65,6 +65,7 @@
...
@@ -65,6 +65,7 @@
extern
int
num_read
,
num_there
;
// Statistics
extern
int
num_read
,
num_there
;
// Statistics
static
int
num_write
;
static
int
num_write
;
extern
"C"
int
trace
;
#if defined(UNIX)
#if defined(UNIX)
// Add dummy strerror (NGC)
// Add dummy strerror (NGC)
...
@@ -302,10 +303,9 @@ int VCTFAM::Cardinality(PGLOBAL g)
...
@@ -302,10 +303,9 @@ int VCTFAM::Cardinality(PGLOBAL g)
else
else
sprintf
(
g
->
Message
,
MSG
(
NOT_FIXED_LEN
),
To_File
,
len
,
clen
);
sprintf
(
g
->
Message
,
MSG
(
NOT_FIXED_LEN
),
To_File
,
len
,
clen
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
" Computed max_K=%d Filen=%d Clen=%d
\n
"
,
htrc
(
" Computed max_K=%d Filen=%d Clen=%d
\n
"
,
card
,
len
,
clen
);
card
,
len
,
clen
);
#endif
}
else
}
else
card
=
0
;
card
=
0
;
...
@@ -430,16 +430,15 @@ bool VCTFAM::OpenTableFile(PGLOBAL g)
...
@@ -430,16 +430,15 @@ bool VCTFAM::OpenTableFile(PGLOBAL g)
PlugSetPath
(
filename
,
To_File
,
Tdbp
->
GetPath
());
PlugSetPath
(
filename
,
To_File
,
Tdbp
->
GetPath
());
if
(
!
(
Stream
=
PlugOpenFile
(
g
,
filename
,
opmode
)))
{
if
(
!
(
Stream
=
PlugOpenFile
(
g
,
filename
,
opmode
)))
{
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"%s
\n
"
,
g
->
Message
);
htrc
(
"%s
\n
"
,
g
->
Message
);
#endif
return
(
mode
==
MODE_READ
&&
errno
==
ENOENT
)
return
(
mode
==
MODE_READ
&&
errno
==
ENOENT
)
?
PushWarning
(
g
,
Tdbp
)
:
true
;
?
PushWarning
(
g
,
Tdbp
)
:
true
;
}
// endif Stream
}
// endif Stream
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"File %s is open in mode %s
\n
"
,
filename
,
opmode
);
htrc
(
"File %s is open in mode %s
\n
"
,
filename
,
opmode
);
#endif
To_Fb
=
dbuserp
->
Openlist
;
// Keep track of File block
To_Fb
=
dbuserp
->
Openlist
;
// Keep track of File block
...
@@ -601,10 +600,9 @@ int VCTFAM::ReadBuffer(PGLOBAL g)
...
@@ -601,10 +600,9 @@ int VCTFAM::ReadBuffer(PGLOBAL g)
OldBlk
=
CurBlk
;
// Last block actually read
OldBlk
=
CurBlk
;
// Last block actually read
}
// endif oldblk
}
// endif oldblk
#ifdef DEBTRACE
if
(
trace
)
htrc
(
" Read: CurNum=%d CurBlk=%d rc=%d
\n
"
,
htrc
(
" Read: CurNum=%d CurBlk=%d rc=%d
\n
"
,
CurNum
,
CurBlk
,
RC_OK
);
CurNum
,
CurBlk
,
RC_OK
);
#endif
return
rc
;
return
rc
;
}
// end of ReadBuffer
}
// end of ReadBuffer
...
@@ -613,10 +611,9 @@ int VCTFAM::ReadBuffer(PGLOBAL g)
...
@@ -613,10 +611,9 @@ int VCTFAM::ReadBuffer(PGLOBAL g)
/***********************************************************************/
/***********************************************************************/
int
VCTFAM
::
WriteBuffer
(
PGLOBAL
g
)
int
VCTFAM
::
WriteBuffer
(
PGLOBAL
g
)
{
{
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"VCT WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d
\n
"
,
htrc
(
"VCT WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d
\n
"
,
Tdbp
->
GetTdb_No
(),
Tdbp
->
GetMode
(),
CurNum
,
CurBlk
);
Tdbp
->
GetTdb_No
(),
Tdbp
->
GetMode
(),
CurNum
,
CurBlk
);
#endif
if
(
Tdbp
->
GetMode
()
==
MODE_UPDATE
)
{
if
(
Tdbp
->
GetMode
()
==
MODE_UPDATE
)
{
// Mode Update is done in ReadDB, we just initialize it here
// Mode Update is done in ReadDB, we just initialize it here
...
@@ -706,20 +703,20 @@ int VCTFAM::WriteBuffer(PGLOBAL g)
...
@@ -706,20 +703,20 @@ int VCTFAM::WriteBuffer(PGLOBAL g)
int
VCTFAM
::
DeleteRecords
(
PGLOBAL
g
,
int
irc
)
int
VCTFAM
::
DeleteRecords
(
PGLOBAL
g
,
int
irc
)
{
{
bool
eof
=
false
;
bool
eof
=
false
;
#ifdef DEBTRACE
fprintf
(
debug
,
if
(
trace
)
"VCT DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d
\n
"
,
htrc
(
"VCT DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d
\n
"
,
irc
,
UseTemp
,
Fpos
,
Tpos
,
Spos
);
irc
,
UseTemp
,
Fpos
,
Tpos
,
Spos
);
#endif
if
(
irc
!=
RC_OK
)
{
if
(
irc
!=
RC_OK
)
{
/*******************************************************************/
/*******************************************************************/
/* EOF: position Fpos at the end-of-file position. */
/* EOF: position Fpos at the end-of-file position. */
/*******************************************************************/
/*******************************************************************/
Fpos
=
(
Block
-
1
)
*
Nrec
+
Last
;
Fpos
=
(
Block
-
1
)
*
Nrec
+
Last
;
#ifdef DEBTRACE
htrc
(
"Fpos placed at file end=%d
\n
"
,
Fpos
);
if
(
trace
)
#endif
htrc
(
"Fpos placed at file end=%d
\n
"
,
Fpos
);
eof
=
UseTemp
&&
!
MaxBlk
;
eof
=
UseTemp
&&
!
MaxBlk
;
}
else
// Fpos is the Deleted line position
}
else
// Fpos is the Deleted line position
Fpos
=
CurBlk
*
Nrec
+
CurNum
;
Fpos
=
CurBlk
*
Nrec
+
CurNum
;
...
@@ -753,14 +750,13 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -753,14 +750,13 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
/*******************************************************************/
/*******************************************************************/
/* Reposition the file pointer and set Spos. */
/* Reposition the file pointer and set Spos. */
/*******************************************************************/
/*******************************************************************/
#ifdef
DEBTRACE
#ifdef
_DEBUG
assert
(
Spos
==
Fpos
);
assert
(
Spos
==
Fpos
);
#endif
#endif
Spos
++
;
// New start position is on next line
Spos
++
;
// New start position is on next line
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
htrc
(
"after: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
#endif
}
else
{
}
else
{
/*******************************************************************/
/*******************************************************************/
...
@@ -808,9 +804,9 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -808,9 +804,9 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
close
(
h
);
close
(
h
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"done, h=%d irc=%d
\n
"
,
h
,
irc
);
htrc
(
"done, h=%d irc=%d
\n
"
,
h
,
irc
);
#endif
}
else
}
else
// Clean the unused space in the file, this is required when
// Clean the unused space in the file, this is required when
// inserting again with a partial column list.
// inserting again with a partial column list.
...
@@ -850,9 +846,9 @@ bool VCTFAM::OpenTempFile(PGLOBAL g)
...
@@ -850,9 +846,9 @@ bool VCTFAM::OpenTempFile(PGLOBAL g)
opmode
=
"wb"
;
opmode
=
"wb"
;
if
(
!
(
T_Stream
=
PlugOpenFile
(
g
,
tempname
,
opmode
)))
{
if
(
!
(
T_Stream
=
PlugOpenFile
(
g
,
tempname
,
opmode
)))
{
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"%s
\n
"
,
g
->
Message
);
htrc
(
"%s
\n
"
,
g
->
Message
);
#endif
rc
=
true
;
rc
=
true
;
}
else
}
else
To_Fbt
=
PlgGetUser
(
g
)
->
Openlist
;
To_Fbt
=
PlgGetUser
(
g
)
->
Openlist
;
...
@@ -898,9 +894,8 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
...
@@ -898,9 +894,8 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
len
=
fread
(
To_Buf
,
Clens
[
i
],
req
,
Stream
);
len
=
fread
(
To_Buf
,
Clens
[
i
],
req
,
Stream
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after read req=%d len=%d
\n
"
,
req
,
len
);
htrc
(
"after read req=%d len=%d
\n
"
,
req
,
len
);
#endif
if
(
len
!=
req
)
{
if
(
len
!=
req
)
{
sprintf
(
g
->
Message
,
MSG
(
DEL_READ_ERROR
),
(
int
)
req
,
(
int
)
len
);
sprintf
(
g
->
Message
,
MSG
(
DEL_READ_ERROR
),
(
int
)
req
,
(
int
)
len
);
...
@@ -928,9 +923,9 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
...
@@ -928,9 +923,9 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
}
// endif UseTemp
}
// endif UseTemp
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after write pos=%d
\n
"
,
ftell
(
Stream
));
htrc
(
"after write pos=%d
\n
"
,
ftell
(
Stream
));
#endif
}
// endfor i
}
// endfor i
Tpos
+=
(
int
)
req
;
Tpos
+=
(
int
)
req
;
...
@@ -959,9 +954,9 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
...
@@ -959,9 +954,9 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
}
// endif UseTemp
}
// endif UseTemp
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"loop: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
htrc
(
"loop: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
#endif
}
// endfor n
}
// endfor n
return
false
;
return
false
;
...
@@ -1094,10 +1089,10 @@ void VCTFAM::CloseTableFile(PGLOBAL g)
...
@@ -1094,10 +1089,10 @@ void VCTFAM::CloseTableFile(PGLOBAL g)
if
(
!
(
UseTemp
&&
T_Stream
))
if
(
!
(
UseTemp
&&
T_Stream
))
rc
=
PlugCloseFile
(
g
,
To_Fb
);
rc
=
PlugCloseFile
(
g
,
To_Fb
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"VCT CloseTableFile: closing %s wrc=%d rc=%d
\n
"
,
htrc
(
"VCT CloseTableFile: closing %s wrc=%d rc=%d
\n
"
,
To_File
,
wrc
,
rc
);
To_File
,
wrc
,
rc
);
#endif
Stream
=
NULL
;
Stream
=
NULL
;
}
// end of CloseTableFile
}
// end of CloseTableFile
...
@@ -1168,10 +1163,9 @@ bool VCTFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -1168,10 +1163,9 @@ bool VCTFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
else
// Blocked vector format
else
// Blocked vector format
len
=
Nrec
*
(
colp
->
Deplac
+
Lrecl
*
CurBlk
);
len
=
Nrec
*
(
colp
->
Deplac
+
Lrecl
*
CurBlk
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"len=%d Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d maxblk=%d
\n
"
,
htrc
(
"len=%d Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d maxblk=%d
\n
"
,
len
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
CurBlk
,
MaxBlk
);
len
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
CurBlk
,
MaxBlk
);
#endif
if
(
fseek
(
Stream
,
len
,
SEEK_SET
))
{
if
(
fseek
(
Stream
,
len
,
SEEK_SET
))
{
sprintf
(
g
->
Message
,
MSG
(
FSEEK_ERROR
),
strerror
(
errno
));
sprintf
(
g
->
Message
,
MSG
(
FSEEK_ERROR
),
strerror
(
errno
));
...
@@ -1188,15 +1182,15 @@ bool VCTFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -1188,15 +1182,15 @@ bool VCTFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
sprintf
(
g
->
Message
,
MSG
(
READ_ERROR
),
sprintf
(
g
->
Message
,
MSG
(
READ_ERROR
),
To_File
,
strerror
(
errno
));
To_File
,
strerror
(
errno
));
#ifdef DEBTRACE
if
(
trace
)
htrc
(
" Read error: %s
\n
"
,
g
->
Message
);
htrc
(
" Read error: %s
\n
"
,
g
->
Message
);
#endif
return
true
;
return
true
;
}
// endif
}
// endif
#ifdef DEBTRACE
if
(
trace
)
num_read
++
;
num_read
++
;
#endif
return
false
;
return
false
;
}
// end of ReadBlock
}
// end of ReadBlock
...
@@ -1220,10 +1214,9 @@ bool VCTFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -1220,10 +1214,9 @@ bool VCTFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
else
// Old VCT format
else
// Old VCT format
len
=
Nrec
*
(
colp
->
Deplac
+
Lrecl
*
colp
->
ColBlk
);
len
=
Nrec
*
(
colp
->
Deplac
+
Lrecl
*
colp
->
ColBlk
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"modif=%d len=%d Nrec=%d Deplac=%d Lrecl=%d colblk=%d
\n
"
,
htrc
(
"modif=%d len=%d Nrec=%d Deplac=%d Lrecl=%d colblk=%d
\n
"
,
Modif
,
len
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
colp
->
ColBlk
);
Modif
,
len
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
colp
->
ColBlk
);
#endif
if
(
fseek
(
T_Stream
,
len
,
SEEK_SET
))
{
if
(
fseek
(
T_Stream
,
len
,
SEEK_SET
))
{
sprintf
(
g
->
Message
,
MSG
(
FSEEK_ERROR
),
strerror
(
errno
));
sprintf
(
g
->
Message
,
MSG
(
FSEEK_ERROR
),
strerror
(
errno
));
...
@@ -1239,9 +1232,10 @@ bool VCTFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -1239,9 +1232,10 @@ bool VCTFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
(
size_t
)
colp
->
Clen
,
n
,
T_Stream
))
{
(
size_t
)
colp
->
Clen
,
n
,
T_Stream
))
{
sprintf
(
g
->
Message
,
MSG
(
WRITE_STRERROR
),
sprintf
(
g
->
Message
,
MSG
(
WRITE_STRERROR
),
(
UseTemp
)
?
To_Fbt
->
Fname
:
To_File
,
strerror
(
errno
));
(
UseTemp
)
?
To_Fbt
->
Fname
:
To_File
,
strerror
(
errno
));
#ifdef DEBTRACE
htrc
(
"Write error: %s
\n
"
,
strerror
(
errno
));
if
(
trace
)
#endif
htrc
(
"Write error: %s
\n
"
,
strerror
(
errno
));
return
true
;
return
true
;
}
// endif
}
// endif
...
@@ -1310,9 +1304,9 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
...
@@ -1310,9 +1304,9 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
&&
fp
->
Count
&&
fp
->
Mode
==
mode
)
&&
fp
->
Count
&&
fp
->
Mode
==
mode
)
break
;
break
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"Mapping VCM file, fp=%p cnt=%d
\n
"
,
fp
,
fp
->
Count
);
htrc
(
"Mapping VCM file, fp=%p cnt=%d
\n
"
,
fp
,
fp
->
Count
);
#endif
}
else
}
else
fp
=
NULL
;
fp
=
NULL
;
...
@@ -1368,9 +1362,9 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
...
@@ -1368,9 +1362,9 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
sprintf
(
g
->
Message
,
MSG
(
OPEN_MODE_ERROR
),
sprintf
(
g
->
Message
,
MSG
(
OPEN_MODE_ERROR
),
"map"
,
(
int
)
rc
,
filename
);
"map"
,
(
int
)
rc
,
filename
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"%s
\n
"
,
g
->
Message
);
htrc
(
"%s
\n
"
,
g
->
Message
);
#endif
return
(
mode
==
MODE_READ
&&
rc
==
ENOENT
)
return
(
mode
==
MODE_READ
&&
rc
==
ENOENT
)
?
PushWarning
(
g
,
Tdbp
)
:
true
;
?
PushWarning
(
g
,
Tdbp
)
:
true
;
}
// endif hFile
}
// endif hFile
...
@@ -1420,10 +1414,9 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
...
@@ -1420,10 +1414,9 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
To_Fb
=
fp
;
// Useful when closing
To_Fb
=
fp
;
// Useful when closing
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"fp=%p count=%d MapView=%p len=%d Top=%p
\n
"
,
htrc
(
"fp=%p count=%d MapView=%p len=%d Top=%p
\n
"
,
fp
,
fp
->
Count
,
Memory
,
len
);
fp
,
fp
->
Count
,
Memory
,
len
);
#endif
return
AllocateBuffer
(
g
);
return
AllocateBuffer
(
g
);
}
// end of OpenTableFile
}
// end of OpenTableFile
...
@@ -1523,10 +1516,9 @@ bool VCMFAM::InitInsert(PGLOBAL g)
...
@@ -1523,10 +1516,9 @@ bool VCMFAM::InitInsert(PGLOBAL g)
/***********************************************************************/
/***********************************************************************/
int
VCMFAM
::
WriteBuffer
(
PGLOBAL
g
)
int
VCMFAM
::
WriteBuffer
(
PGLOBAL
g
)
{
{
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"VCM WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d
\n
"
,
htrc
(
"VCM WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d
\n
"
,
Tdbp
->
GetTdb_No
(),
Tdbp
->
GetMode
(),
CurNum
,
CurBlk
);
Tdbp
->
GetTdb_No
(),
Tdbp
->
GetMode
(),
CurNum
,
CurBlk
);
#endif
// Mode Update being done in ReadDB we process here Insert mode only.
// Mode Update being done in ReadDB we process here Insert mode only.
if
(
Tdbp
->
GetMode
()
==
MODE_INSERT
)
{
if
(
Tdbp
->
GetMode
()
==
MODE_INSERT
)
{
...
@@ -1568,20 +1560,19 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -1568,20 +1560,19 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
int
i
;
int
i
;
int
m
,
n
;
int
m
,
n
;
#ifdef DEBTRACE
if
(
trace
)
fprintf
(
debug
,
htrc
(
"VCM DeleteDB: irc=%d tobuf=%p Tpos=%p Spos=%p
\n
"
,
"VCM DeleteDB: irc=%d tobuf=%p Tpos=%p Spos=%p
\n
"
,
irc
,
To_Buf
,
Tpos
,
Spos
);
irc
,
To_Buf
,
Tpos
,
Spos
);
#endif
if
(
irc
!=
RC_OK
)
{
if
(
irc
!=
RC_OK
)
{
/*******************************************************************/
/*******************************************************************/
/* EOF: position Fpos at the top of map position. */
/* EOF: position Fpos at the top of map position. */
/*******************************************************************/
/*******************************************************************/
Fpos
=
(
Block
-
1
)
*
Nrec
+
Last
;
Fpos
=
(
Block
-
1
)
*
Nrec
+
Last
;
#ifdef DEBTRACE
htrc
(
"Fpos placed at file top=%p
\n
"
,
Fpos
);
if
(
trace
)
#endif
htrc
(
"Fpos placed at file top=%p
\n
"
,
Fpos
);
}
else
// Fpos is the Deleted line position
}
else
// Fpos is the Deleted line position
Fpos
=
CurBlk
*
Nrec
+
CurNum
;
Fpos
=
CurBlk
*
Nrec
+
CurNum
;
...
@@ -1627,17 +1618,16 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -1627,17 +1618,16 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
Tpos
+=
n
;
Tpos
+=
n
;
}
// endif MaxBlk
}
// endif MaxBlk
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"move %d bytes
\n
"
,
n
);
htrc
(
"move %d bytes
\n
"
,
n
);
#endif
}
// endif n
}
// endif n
if
(
irc
==
RC_OK
)
{
if
(
irc
==
RC_OK
)
{
Spos
=
Fpos
+
1
;
// New start position
Spos
=
Fpos
+
1
;
// New start position
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after: Tpos=%p Spos=%p
\n
"
,
Tpos
,
Spos
);
htrc
(
"after: Tpos=%p Spos=%p
\n
"
,
Tpos
,
Spos
);
#endif
}
else
{
}
else
{
/*******************************************************************/
/*******************************************************************/
...
@@ -1676,9 +1666,8 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -1676,9 +1666,8 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
return
RC_FX
;
return
RC_FX
;
}
// endif
}
// endif
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"done, Tpos=%p newsize=%d drc=%d
\n
"
,
Tpos
,
n
,
drc
);
htrc
(
"done, Tpos=%p newsize=%d drc=%d
\n
"
,
Tpos
,
n
,
drc
);
#endif
if
(
!
SetEndOfFile
(
fp
->
Handle
))
{
if
(
!
SetEndOfFile
(
fp
->
Handle
))
{
sprintf
(
g
->
Message
,
MSG
(
FUNCTION_ERROR
),
sprintf
(
g
->
Message
,
MSG
(
FUNCTION_ERROR
),
...
@@ -1760,17 +1749,16 @@ bool VCMFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -1760,17 +1749,16 @@ bool VCMFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
/*********************************************************************/
/*********************************************************************/
mempos
=
Memcol
[
i
]
+
n
*
CurBlk
;
mempos
=
Memcol
[
i
]
+
n
*
CurBlk
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"mempos=%p i=%d Nrec=%d Clen=%d CurBlk=%d
\n
"
,
htrc
(
"mempos=%p i=%d Nrec=%d Clen=%d CurBlk=%d
\n
"
,
mempos
,
i
,
Nrec
,
colp
->
Clen
,
CurBlk
);
mempos
,
i
,
Nrec
,
colp
->
Clen
,
CurBlk
);
#endif
if
(
colp
->
GetStatus
(
BUF_MAPPED
))
if
(
colp
->
GetStatus
(
BUF_MAPPED
))
colp
->
Blk
->
SetValPointer
(
mempos
);
colp
->
Blk
->
SetValPointer
(
mempos
);
#ifdef DEBTRACE
if
(
trace
)
num_read
++
;
num_read
++
;
#endif
return
false
;
return
false
;
}
// end of ReadBlock
}
// end of ReadBlock
...
@@ -1785,17 +1773,16 @@ bool VCMFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -1785,17 +1773,16 @@ bool VCMFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
#if defined(_DEBUG)
#if defined(_DEBUG)
char
*
mempos
;
char
*
mempos
;
int
i
=
colp
->
Index
-
1
;
int
i
=
colp
->
Index
-
1
;
int
n
=
Nrec
*
colp
->
Clen
;
int
n
=
Nrec
*
colp
->
Clen
;
/*********************************************************************/
/*********************************************************************/
/* Calculate the offset and size of the block to write. */
/* Calculate the offset and size of the block to write. */
/*********************************************************************/
/*********************************************************************/
mempos
=
Memcol
[
i
]
+
n
*
CurBlk
;
mempos
=
Memcol
[
i
]
+
n
*
CurBlk
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"modif=%d mempos=%p i=%d Nrec=%d Clen=%d colblk=%d
\n
"
,
htrc
(
"modif=%d mempos=%p i=%d Nrec=%d Clen=%d colblk=%d
\n
"
,
Modif
,
mempos
,
i
,
Nrec
,
colp
->
Clen
,
colp
->
ColBlk
);
Modif
,
mempos
,
i
,
Nrec
,
colp
->
Clen
,
colp
->
ColBlk
);
#endif
#endif // _DEBUG
#endif // _DEBUG
...
@@ -1954,16 +1941,15 @@ bool VECFAM::OpenColumnFile(PGLOBAL g, char *opmode, int i)
...
@@ -1954,16 +1941,15 @@ bool VECFAM::OpenColumnFile(PGLOBAL g, char *opmode, int i)
sprintf
(
filename
,
Colfn
,
i
+
1
);
sprintf
(
filename
,
Colfn
,
i
+
1
);
if
(
!
(
Streams
[
i
]
=
PlugOpenFile
(
g
,
filename
,
opmode
)))
{
if
(
!
(
Streams
[
i
]
=
PlugOpenFile
(
g
,
filename
,
opmode
)))
{
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"%s
\n
"
,
g
->
Message
);
htrc
(
"%s
\n
"
,
g
->
Message
);
#endif
return
(
Tdbp
->
GetMode
()
==
MODE_READ
&&
errno
==
ENOENT
)
return
(
Tdbp
->
GetMode
()
==
MODE_READ
&&
errno
==
ENOENT
)
?
PushWarning
(
g
,
Tdbp
)
:
true
;
?
PushWarning
(
g
,
Tdbp
)
:
true
;
}
// endif Streams
}
// endif Streams
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"File %s is open in mode %s
\n
"
,
filename
,
opmode
);
htrc
(
"File %s is open in mode %s
\n
"
,
filename
,
opmode
);
#endif
To_Fbs
[
i
]
=
dup
->
Openlist
;
// Keep track of File blocks
To_Fbs
[
i
]
=
dup
->
Openlist
;
// Keep track of File blocks
return
false
;
return
false
;
...
@@ -2110,10 +2096,9 @@ void VECFAM::ResetBuffer(PGLOBAL g)
...
@@ -2110,10 +2096,9 @@ void VECFAM::ResetBuffer(PGLOBAL g)
/***********************************************************************/
/***********************************************************************/
int
VECFAM
::
WriteBuffer
(
PGLOBAL
g
)
int
VECFAM
::
WriteBuffer
(
PGLOBAL
g
)
{
{
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"VCT WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d
\n
"
,
htrc
(
"VCT WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d
\n
"
,
Tdbp
->
GetTdb_No
(),
Tdbp
->
GetMode
(),
CurNum
,
CurBlk
);
Tdbp
->
GetTdb_No
(),
Tdbp
->
GetMode
(),
CurNum
,
CurBlk
);
#endif
if
(
Tdbp
->
GetMode
()
==
MODE_INSERT
)
{
if
(
Tdbp
->
GetMode
()
==
MODE_INSERT
)
{
if
(
Closing
||
++
CurNum
==
Nrec
)
{
if
(
Closing
||
++
CurNum
==
Nrec
)
{
...
@@ -2161,20 +2146,19 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -2161,20 +2146,19 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
/* file, and at the end erase all trailing records. */
/* file, and at the end erase all trailing records. */
/* This depends on the Check setting, false by default. */
/* This depends on the Check setting, false by default. */
/*********************************************************************/
/*********************************************************************/
#ifdef DEBTRACE
if
(
trace
)
fprintf
(
debug
,
htrc
(
"VEC DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d
\n
"
,
"VEC DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d
\n
"
,
irc
,
UseTemp
,
Fpos
,
Tpos
,
Spos
);
irc
,
UseTemp
,
Fpos
,
Tpos
,
Spos
);
#endif
if
(
irc
!=
RC_OK
)
{
if
(
irc
!=
RC_OK
)
{
/*******************************************************************/
/*******************************************************************/
/* EOF: position Fpos at the end-of-file position. */
/* EOF: position Fpos at the end-of-file position. */
/*******************************************************************/
/*******************************************************************/
Fpos
=
Cardinality
(
g
);
Fpos
=
Cardinality
(
g
);
#ifdef DEBTRACE
htrc
(
"Fpos placed at file end=%d
\n
"
,
Fpos
);
if
(
trace
)
#endif
htrc
(
"Fpos placed at file end=%d
\n
"
,
Fpos
);
}
else
// Fpos is the Deleted line position
}
else
// Fpos is the Deleted line position
Fpos
=
CurBlk
*
Nrec
+
CurNum
;
Fpos
=
CurBlk
*
Nrec
+
CurNum
;
...
@@ -2201,14 +2185,13 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -2201,14 +2185,13 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
return
RC_FX
;
return
RC_FX
;
if
(
irc
==
RC_OK
)
{
if
(
irc
==
RC_OK
)
{
#ifdef
DEBTRACE
#ifdef
_DEBUG
assert
(
Spos
==
Fpos
);
assert
(
Spos
==
Fpos
);
#endif
#endif
Spos
++
;
// New start position is on next line
Spos
++
;
// New start position is on next line
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
htrc
(
"after: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
#endif
}
else
{
}
else
{
/*******************************************************************/
/*******************************************************************/
...
@@ -2250,9 +2233,9 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -2250,9 +2233,9 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
close
(
h
);
close
(
h
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"done, h=%d irc=%d
\n
"
,
h
,
irc
);
htrc
(
"done, h=%d irc=%d
\n
"
,
h
,
irc
);
#endif
}
// endfor i
}
// endfor i
}
else
// UseTemp
}
else
// UseTemp
...
@@ -2288,9 +2271,9 @@ bool VECFAM::OpenTempFile(PGLOBAL g)
...
@@ -2288,9 +2271,9 @@ bool VECFAM::OpenTempFile(PGLOBAL g)
sprintf
(
tempname
,
Tempat
,
i
+
1
);
sprintf
(
tempname
,
Tempat
,
i
+
1
);
if
(
!
(
T_Streams
[
i
]
=
PlugOpenFile
(
g
,
tempname
,
"wb"
)))
{
if
(
!
(
T_Streams
[
i
]
=
PlugOpenFile
(
g
,
tempname
,
"wb"
)))
{
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"%s
\n
"
,
g
->
Message
);
htrc
(
"%s
\n
"
,
g
->
Message
);
#endif
return
true
;
return
true
;
}
else
}
else
T_Fbs
[
i
]
=
PlgGetUser
(
g
)
->
Openlist
;
T_Fbs
[
i
]
=
PlgGetUser
(
g
)
->
Openlist
;
...
@@ -2348,9 +2331,8 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *bn)
...
@@ -2348,9 +2331,8 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *bn)
len
=
fread
(
To_Buf
,
Clens
[
i
],
req
,
Streams
[
i
]);
len
=
fread
(
To_Buf
,
Clens
[
i
],
req
,
Streams
[
i
]);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after read req=%d len=%d
\n
"
,
req
,
len
);
htrc
(
"after read req=%d len=%d
\n
"
,
req
,
len
);
#endif
if
(
len
!=
req
)
{
if
(
len
!=
req
)
{
sprintf
(
g
->
Message
,
MSG
(
DEL_READ_ERROR
),
(
int
)
req
,
(
int
)
len
);
sprintf
(
g
->
Message
,
MSG
(
DEL_READ_ERROR
),
(
int
)
req
,
(
int
)
len
);
...
@@ -2368,17 +2350,16 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *bn)
...
@@ -2368,17 +2350,16 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *bn)
return
true
;
return
true
;
}
// endif
}
// endif
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after write pos=%d
\n
"
,
ftell
(
Streams
[
i
]));
htrc
(
"after write pos=%d
\n
"
,
ftell
(
Streams
[
i
]));
#endif
}
// endfor i
}
// endfor i
Tpos
+=
(
int
)
req
;
Tpos
+=
(
int
)
req
;
Spos
+=
(
int
)
req
;
Spos
+=
(
int
)
req
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"loop: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
htrc
(
"loop: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
#endif
b
=
true
;
b
=
true
;
}
// endfor n
}
// endfor n
...
@@ -2496,10 +2477,9 @@ void VECFAM::CloseTableFile(PGLOBAL g)
...
@@ -2496,10 +2477,9 @@ void VECFAM::CloseTableFile(PGLOBAL g)
To_Fbs
[
i
]
=
NULL
;
To_Fbs
[
i
]
=
NULL
;
}
// endif Streams
}
// endif Streams
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"VCT CloseTableFile: closing %s wrc=%d rc=%d
\n
"
,
htrc
(
"VCT CloseTableFile: closing %s wrc=%d rc=%d
\n
"
,
To_File
,
wrc
,
rc
);
To_File
,
wrc
,
rc
);
#endif
}
// end of CloseTableFile
}
// end of CloseTableFile
/***********************************************************************/
/***********************************************************************/
...
@@ -2516,10 +2496,9 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -2516,10 +2496,9 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
len
=
Nrec
*
colp
->
Clen
*
CurBlk
;
len
=
Nrec
*
colp
->
Clen
*
CurBlk
;
i
=
colp
->
Index
-
1
;
i
=
colp
->
Index
-
1
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"len=%d i=%d Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d
\n
"
,
htrc
(
"len=%d i=%d Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d
\n
"
,
len
,
i
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
CurBlk
);
len
,
i
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
CurBlk
);
#endif
if
(
fseek
(
Streams
[
i
],
len
,
SEEK_SET
))
{
if
(
fseek
(
Streams
[
i
],
len
,
SEEK_SET
))
{
sprintf
(
g
->
Message
,
MSG
(
FSEEK_ERROR
),
strerror
(
errno
));
sprintf
(
g
->
Message
,
MSG
(
FSEEK_ERROR
),
strerror
(
errno
));
...
@@ -2543,15 +2522,15 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -2543,15 +2522,15 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
sprintf
(
g
->
Message
,
MSG
(
READ_ERROR
),
sprintf
(
g
->
Message
,
MSG
(
READ_ERROR
),
fn
,
strerror
(
errno
));
fn
,
strerror
(
errno
));
#ifdef DEBTRACE
if
(
trace
)
htrc
(
" Read error: %s
\n
"
,
g
->
Message
);
htrc
(
" Read error: %s
\n
"
,
g
->
Message
);
#endif
return
true
;
return
true
;
}
// endif
}
// endif
#ifdef DEBTRACE
if
(
trace
)
num_read
++
;
num_read
++
;
#endif
return
false
;
return
false
;
}
// end of ReadBlock
}
// end of ReadBlock
...
@@ -2572,10 +2551,9 @@ bool VECFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -2572,10 +2551,9 @@ bool VECFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
len
=
Nrec
*
colp
->
Clen
*
colp
->
ColBlk
;
len
=
Nrec
*
colp
->
Clen
*
colp
->
ColBlk
;
i
=
colp
->
Index
-
1
;
i
=
colp
->
Index
-
1
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"modif=%d len=%d i=%d Nrec=%d Deplac=%d Lrecl=%d colblk=%d
\n
"
,
htrc
(
"modif=%d len=%d i=%d Nrec=%d Deplac=%d Lrecl=%d colblk=%d
\n
"
,
Modif
,
len
,
i
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
colp
->
ColBlk
);
Modif
,
len
,
i
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
colp
->
ColBlk
);
#endif
if
(
Tdbp
->
GetMode
()
==
MODE_UPDATE
&&
!
UseTemp
)
if
(
Tdbp
->
GetMode
()
==
MODE_UPDATE
&&
!
UseTemp
)
if
(
fseek
(
T_Streams
[
i
],
len
,
SEEK_SET
))
{
if
(
fseek
(
T_Streams
[
i
],
len
,
SEEK_SET
))
{
...
@@ -2595,9 +2573,10 @@ bool VECFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -2595,9 +2573,10 @@ bool VECFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
sprintf
(
fn
,
(
UseTemp
)
?
Tempat
:
Colfn
,
colp
->
Index
);
sprintf
(
fn
,
(
UseTemp
)
?
Tempat
:
Colfn
,
colp
->
Index
);
sprintf
(
g
->
Message
,
MSG
(
WRITE_STRERROR
),
fn
,
strerror
(
errno
));
sprintf
(
g
->
Message
,
MSG
(
WRITE_STRERROR
),
fn
,
strerror
(
errno
));
#ifdef DEBTRACE
htrc
(
"Write error: %s
\n
"
,
strerror
(
errno
));
if
(
trace
)
#endif
htrc
(
"Write error: %s
\n
"
,
strerror
(
errno
));
return
true
;
return
true
;
}
else
}
else
Spos
=
Fpos
+
n
;
Spos
=
Fpos
+
n
;
...
@@ -2605,11 +2584,6 @@ bool VECFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -2605,11 +2584,6 @@ bool VECFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
#if defined(UNIX)
#if defined(UNIX)
fflush
(
Streams
[
i
]);
//NGC
fflush
(
Streams
[
i
]);
//NGC
#endif
#endif
#ifdef DEBTRACE
//num_write++;
#endif
return
false
;
return
false
;
}
// end of WriteBlock
}
// end of WriteBlock
...
@@ -2740,9 +2714,9 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
...
@@ -2740,9 +2714,9 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
&&
fp
->
Count
&&
fp
->
Mode
==
mode
)
&&
fp
->
Count
&&
fp
->
Mode
==
mode
)
break
;
break
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"Mapping file, fp=%p
\n
"
,
fp
);
htrc
(
"Mapping file, fp=%p
\n
"
,
fp
);
#endif
}
else
}
else
fp
=
NULL
;
fp
=
NULL
;
...
@@ -2765,9 +2739,9 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
...
@@ -2765,9 +2739,9 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
if
(
!
(
*
g
->
Message
))
if
(
!
(
*
g
->
Message
))
sprintf
(
g
->
Message
,
MSG
(
OPEN_MODE_ERROR
),
sprintf
(
g
->
Message
,
MSG
(
OPEN_MODE_ERROR
),
"map"
,
(
int
)
rc
,
filename
);
"map"
,
(
int
)
rc
,
filename
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"%s
\n
"
,
g
->
Message
);
htrc
(
"%s
\n
"
,
g
->
Message
);
#endif
return
(
mode
==
MODE_READ
&&
rc
==
ENOENT
)
return
(
mode
==
MODE_READ
&&
rc
==
ENOENT
)
?
PushWarning
(
g
,
Tdbp
)
:
true
;
?
PushWarning
(
g
,
Tdbp
)
:
true
;
}
// endif hFile
}
// endif hFile
...
@@ -2817,10 +2791,9 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
...
@@ -2817,10 +2791,9 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
To_Fbs
[
i
]
=
fp
;
// Useful when closing
To_Fbs
[
i
]
=
fp
;
// Useful when closing
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"fp=%p count=%d MapView=%p len=%d
\n
"
,
htrc
(
"fp=%p count=%d MapView=%p len=%d
\n
"
,
fp
,
fp
->
Count
,
Memcol
[
i
],
len
);
fp
,
fp
->
Count
,
Memcol
[
i
],
len
);
#endif
return
false
;
return
false
;
}
// end of MapColumnFile
}
// end of MapColumnFile
...
@@ -2863,20 +2836,19 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -2863,20 +2836,19 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
int
i
;
int
i
;
int
m
,
n
;
int
m
,
n
;
#ifdef DEBTRACE
if
(
trace
)
fprintf
(
debug
,
htrc
(
"VMP DeleteDB: irc=%d tobuf=%p Tpos=%p Spos=%p
\n
"
,
"VMP DeleteDB: irc=%d tobuf=%p Tpos=%p Spos=%p
\n
"
,
irc
,
To_Buf
,
Tpos
,
Spos
);
irc
,
To_Buf
,
Tpos
,
Spos
);
#endif
if
(
irc
!=
RC_OK
)
{
if
(
irc
!=
RC_OK
)
{
/*******************************************************************/
/*******************************************************************/
/* EOF: position Fpos at the top of map position. */
/* EOF: position Fpos at the top of map position. */
/*******************************************************************/
/*******************************************************************/
Fpos
=
(
Block
-
1
)
*
Nrec
+
Last
;
Fpos
=
(
Block
-
1
)
*
Nrec
+
Last
;
#ifdef DEBTRACE
htrc
(
"Fpos placed at file top=%p
\n
"
,
Fpos
);
if
(
trace
)
#endif
htrc
(
"Fpos placed at file top=%p
\n
"
,
Fpos
);
}
else
// Fpos is the Deleted line position
}
else
// Fpos is the Deleted line position
Fpos
=
CurBlk
*
Nrec
+
CurNum
;
Fpos
=
CurBlk
*
Nrec
+
CurNum
;
...
@@ -2897,17 +2869,16 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -2897,17 +2869,16 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
Tpos
+=
n
;
Tpos
+=
n
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"move %d bytes
\n
"
,
n
);
htrc
(
"move %d bytes
\n
"
,
n
);
#endif
}
// endif n
}
// endif n
if
(
irc
==
RC_OK
)
{
if
(
irc
==
RC_OK
)
{
Spos
=
Fpos
+
1
;
// New start position
Spos
=
Fpos
+
1
;
// New start position
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after: Tpos=%p Spos=%p
\n
"
,
Tpos
,
Spos
);
htrc
(
"after: Tpos=%p Spos=%p
\n
"
,
Tpos
,
Spos
);
#endif
}
else
{
}
else
{
/*******************************************************************/
/*******************************************************************/
...
@@ -2937,9 +2908,8 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -2937,9 +2908,8 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
return
RC_FX
;
return
RC_FX
;
}
// endif
}
// endif
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"done, Tpos=%p newsize=%d drc=%d
\n
"
,
Tpos
,
n
,
drc
);
htrc
(
"done, Tpos=%p newsize=%d drc=%d
\n
"
,
Tpos
,
n
,
drc
);
#endif
if
(
!
SetEndOfFile
(
fp
->
Handle
))
{
if
(
!
SetEndOfFile
(
fp
->
Handle
))
{
sprintf
(
g
->
Message
,
MSG
(
FUNCTION_ERROR
),
sprintf
(
g
->
Message
,
MSG
(
FUNCTION_ERROR
),
...
@@ -3045,9 +3015,8 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
...
@@ -3045,9 +3015,8 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
DWORD
nbr
,
drc
,
len
=
(
DWORD
)
req
;
DWORD
nbr
,
drc
,
len
=
(
DWORD
)
req
;
bool
brc
=
ReadFile
(
h
,
inbuf
,
len
,
&
nbr
,
NULL
);
bool
brc
=
ReadFile
(
h
,
inbuf
,
len
,
&
nbr
,
NULL
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after read req=%d brc=%d nbr=%d
\n
"
,
req
,
brc
,
nbr
);
htrc
(
"after read req=%d brc=%d nbr=%d
\n
"
,
req
,
brc
,
nbr
);
#endif
if
(
!
brc
||
nbr
!=
len
)
{
if
(
!
brc
||
nbr
!=
len
)
{
char
buf
[
256
];
// , *fn = (h == Hfile) ? To_File : "Tempfile";
char
buf
[
256
];
// , *fn = (h == Hfile) ? To_File : "Tempfile";
...
@@ -3062,9 +3031,10 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
...
@@ -3062,9 +3031,10 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
}
// endelse brc
}
// endelse brc
sprintf
(
g
->
Message
,
MSG
(
READ_ERROR
),
To_File
,
buf
);
sprintf
(
g
->
Message
,
MSG
(
READ_ERROR
),
To_File
,
buf
);
#ifdef DEBTRACE
htrc
(
"BIGREAD: %s
\n
"
,
g
->
Message
);
if
(
trace
)
#endif
htrc
(
"BIGREAD: %s
\n
"
,
g
->
Message
);
rc
=
true
;
rc
=
true
;
}
// endif brc || nbr
}
// endif brc || nbr
#else // !WIN32
#else // !WIN32
...
@@ -3075,10 +3045,11 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
...
@@ -3075,10 +3045,11 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
const
char
*
fn
=
(
h
==
Hfile
)
?
To_File
:
"Tempfile"
;
const
char
*
fn
=
(
h
==
Hfile
)
?
To_File
:
"Tempfile"
;
sprintf
(
g
->
Message
,
MSG
(
READ_ERROR
),
fn
,
strerror
(
errno
));
sprintf
(
g
->
Message
,
MSG
(
READ_ERROR
),
fn
,
strerror
(
errno
));
#ifdef DEBTRACE
htrc
(
"BIGREAD: nbr=%d len=%d errno=%d %s
\n
"
,
if
(
trace
)
nbr
,
len
,
errno
,
g
->
Message
);
htrc
(
"BIGREAD: nbr=%d len=%d errno=%d %s
\n
"
,
#endif
nbr
,
len
,
errno
,
g
->
Message
);
rc
=
true
;
rc
=
true
;
}
// endif nbr
}
// endif nbr
#endif // !WIN32
#endif // !WIN32
...
@@ -3097,9 +3068,8 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
...
@@ -3097,9 +3068,8 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
DWORD
nbw
,
drc
,
len
=
(
DWORD
)
req
;
DWORD
nbw
,
drc
,
len
=
(
DWORD
)
req
;
bool
brc
=
WriteFile
(
h
,
inbuf
,
len
,
&
nbw
,
NULL
);
bool
brc
=
WriteFile
(
h
,
inbuf
,
len
,
&
nbw
,
NULL
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after write req=%d brc=%d nbw=%d
\n
"
,
req
,
brc
,
nbw
);
htrc
(
"after write req=%d brc=%d nbw=%d
\n
"
,
req
,
brc
,
nbw
);
#endif
if
(
!
brc
||
nbw
!=
len
)
{
if
(
!
brc
||
nbw
!=
len
)
{
char
buf
[
256
],
*
fn
=
(
h
==
Hfile
)
?
To_File
:
"Tempfile"
;
char
buf
[
256
],
*
fn
=
(
h
==
Hfile
)
?
To_File
:
"Tempfile"
;
...
@@ -3115,10 +3085,10 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
...
@@ -3115,10 +3085,10 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
sprintf
(
g
->
Message
,
MSG
(
WRITE_STRERROR
),
fn
,
buf
);
sprintf
(
g
->
Message
,
MSG
(
WRITE_STRERROR
),
fn
,
buf
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"BIGWRITE: nbw=%d len=%d errno=%d %s
\n
"
,
htrc
(
"BIGWRITE: nbw=%d len=%d errno=%d %s
\n
"
,
nbw
,
len
,
drc
,
g
->
Message
);
nbw
,
len
,
drc
,
g
->
Message
);
#endif
rc
=
true
;
rc
=
true
;
}
// endif brc || nbw
}
// endif brc || nbw
#else // !WIN32
#else // !WIN32
...
@@ -3129,10 +3099,11 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
...
@@ -3129,10 +3099,11 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
const
char
*
fn
=
(
h
==
Hfile
)
?
To_File
:
"Tempfile"
;
const
char
*
fn
=
(
h
==
Hfile
)
?
To_File
:
"Tempfile"
;
sprintf
(
g
->
Message
,
MSG
(
WRITE_STRERROR
),
fn
,
strerror
(
errno
));
sprintf
(
g
->
Message
,
MSG
(
WRITE_STRERROR
),
fn
,
strerror
(
errno
));
#ifdef DEBTRACE
htrc
(
"BIGWRITE: nbw=%d len=%d errno=%d %s
\n
"
,
if
(
trace
)
nbw
,
len
,
errno
,
g
->
Message
);
htrc
(
"BIGWRITE: nbw=%d len=%d errno=%d %s
\n
"
,
#endif
nbw
,
len
,
errno
,
g
->
Message
);
rc
=
true
;
rc
=
true
;
}
// endif nbr
}
// endif nbr
#endif // !WIN32
#endif // !WIN32
...
@@ -3180,6 +3151,9 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
...
@@ -3180,6 +3151,9 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
if
(
h
==
INVALID_HANDLE_VALUE
||
!
_filelength
(
h
))
{
if
(
h
==
INVALID_HANDLE_VALUE
||
!
_filelength
(
h
))
{
#endif // !WIN32
#endif // !WIN32
// Consider this is a void table
// Consider this is a void table
if
(
trace
)
htrc
(
"Void table h=%d
\n
"
,
h
);
Last
=
Nrec
;
Last
=
Nrec
;
Block
=
0
;
Block
=
0
;
...
@@ -3200,6 +3174,10 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
...
@@ -3200,6 +3174,10 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
}
else
{
}
else
{
Block
=
(
vh
.
NumRec
>
0
)
?
(
vh
.
NumRec
+
Nrec
-
1
)
/
Nrec
:
0
;
Block
=
(
vh
.
NumRec
>
0
)
?
(
vh
.
NumRec
+
Nrec
-
1
)
/
Nrec
:
0
;
Last
=
(
vh
.
NumRec
+
Nrec
-
1
)
%
Nrec
+
1
;
Last
=
(
vh
.
NumRec
+
Nrec
-
1
)
%
Nrec
+
1
;
if
(
trace
)
htrc
(
"Block=%d Last=%d
\n
"
,
Block
,
Last
);
}
// endif's
}
// endif's
CloseFileHandle
(
h
);
CloseFileHandle
(
h
);
...
@@ -3297,6 +3275,10 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
...
@@ -3297,6 +3275,10 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
of
.
QuadPart
=
(
BIGINT
)
n
+
(
BIGINT
)
MaxBlk
*
(
BIGINT
)
Blksize
-
(
BIGINT
)
1
;
of
.
QuadPart
=
(
BIGINT
)
n
+
(
BIGINT
)
MaxBlk
*
(
BIGINT
)
Blksize
-
(
BIGINT
)
1
;
if
(
trace
)
htrc
(
"MEF: of=%lld n=%d maxblk=%d blksize=%d
\n
"
,
of
.
QuadPart
,
n
,
Maxblk
,
Blksize
);
of
.
LowPart
=
SetFilePointer
(
h
,
of
.
LowPart
,
of
.
LowPart
=
SetFilePointer
(
h
,
of
.
LowPart
,
&
of
.
HighPart
,
FILE_BEGIN
);
&
of
.
HighPart
,
FILE_BEGIN
);
...
@@ -3332,14 +3314,17 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
...
@@ -3332,14 +3314,17 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
int
h
;
int
h
;
BIGINT
pos
;
BIGINT
pos
;
h
=
global_open64
(
g
,
MSGID_OPEN_EMPTY_FILE
,
filename
,
h
=
open64
(
filename
,
O_CREAT
|
O_WRONLY
,
S_IREAD
|
S_IWRITE
);
O_CREAT
|
O_WRONLY
,
S_IREAD
|
S_IWRITE
);
if
(
h
==
-
1
)
if
(
h
==
-
1
)
return
true
;
return
true
;
pos
=
(
BIGINT
)
n
+
(
BIGINT
)
MaxBlk
*
(
BIGINT
)
Blksize
-
(
BIGINT
)
1
;
pos
=
(
BIGINT
)
n
+
(
BIGINT
)
MaxBlk
*
(
BIGINT
)
Blksize
-
(
BIGINT
)
1
;
if
(
trace
)
htrc
(
"MEF: pos=%lld n=%d maxblk=%d blksize=%d
\n
"
,
pos
,
n
,
MaxBlk
,
Blksize
);
if
(
lseek64
(
h
,
pos
,
SEEK_SET
)
<
0
)
{
if
(
lseek64
(
h
,
pos
,
SEEK_SET
)
<
0
)
{
sprintf
(
g
->
Message
,
MSG
(
MAKE_EMPTY_FILE
),
To_File
,
strerror
(
errno
));
sprintf
(
g
->
Message
,
MSG
(
MAKE_EMPTY_FILE
),
To_File
,
strerror
(
errno
));
close
(
h
);
close
(
h
);
...
@@ -3376,10 +3361,9 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
...
@@ -3376,10 +3361,9 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
PlugSetPath
(
filename
,
To_File
,
Tdbp
->
GetPath
());
PlugSetPath
(
filename
,
To_File
,
Tdbp
->
GetPath
());
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"OpenTableFile: filename=%s mode=%d Last=%d
\n
"
,
htrc
(
"OpenTableFile: filename=%s mode=%d Last=%d
\n
"
,
filename
,
mode
,
Last
);
filename
,
mode
,
Last
);
#endif
#if defined(WIN32)
#if defined(WIN32)
DWORD
access
,
creation
,
share
=
0
,
rc
=
0
;
DWORD
access
,
creation
,
share
=
0
,
rc
=
0
;
...
@@ -3454,11 +3438,9 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
...
@@ -3454,11 +3438,9 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
strcat
(
g
->
Message
,
filename
);
strcat
(
g
->
Message
,
filename
);
}
// endif Hfile
}
// endif Hfile
#ifdef DEBTRACE
if
(
trace
)
fprintf
(
debug
,
htrc
(
" rc=%d access=%p share=%p creation=%d handle=%p fn=%s
\n
"
,
" rc=%d access=%p share=%p creation=%d handle=%p fn=%s
\n
"
,
drc
,
access
,
share
,
creation
,
Hfile
,
filename
);
drc
,
access
,
share
,
creation
,
Hfile
,
filename
);
#endif
if
(
mode
==
MODE_INSERT
)
{
if
(
mode
==
MODE_INSERT
)
{
/*******************************************************************/
/*******************************************************************/
...
@@ -3497,7 +3479,19 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
...
@@ -3497,7 +3479,19 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
oflag
=
O_RDONLY
;
oflag
=
O_RDONLY
;
break
;
break
;
case
MODE_INSERT
:
case
MODE_INSERT
:
oflag
=
O_WRONLY
|
O_CREAT
|
O_APPEND
;
if
(
MaxBlk
)
{
if
(
!
Block
)
if
(
MakeEmptyFile
(
g
,
To_File
))
return
true
;
// Required to update empty blocks
oflag
=
O_RDWR
;
}
else
if
(
Last
==
Nrec
)
oflag
=
O_WRONLY
|
O_CREAT
|
O_APPEND
;
else
// Required to update the last block
oflag
=
O_RDWR
|
O_CREAT
|
O_APPEND
;
pmd
=
S_IREAD
|
S_IWRITE
;
pmd
=
S_IREAD
|
S_IWRITE
;
break
;
break
;
case
MODE_DELETE
:
case
MODE_DELETE
:
...
@@ -3532,11 +3526,9 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
...
@@ -3532,11 +3526,9 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
strcat
(
g
->
Message
,
strerror
(
errno
));
strcat
(
g
->
Message
,
strerror
(
errno
));
}
// endif Hfile
}
// endif Hfile
#ifdef DEBTRACE
if
(
trace
)
htrc
(
" lrc=%d oflag=%p mode=%p handle=%d fn=%s
\n
"
,
htrc
(
" rc=%d oflag=%p mode=%p handle=%d fn=%s
\n
"
,
lrc
,
oflag
,
mode
,
Hfile
,
filename
);
rc
,
oflag
,
mode
,
Hfile
,
filename
);
#endif
#endif // UNIX
#endif // UNIX
if
(
!
rc
)
{
if
(
!
rc
)
{
...
@@ -3555,9 +3547,8 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
...
@@ -3555,9 +3547,8 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
To_Fb
->
Mode
=
mode
;
To_Fb
->
Mode
=
mode
;
To_Fb
->
Handle
=
Hfile
;
To_Fb
->
Handle
=
Hfile
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"File %s is open in mode %d
\n
"
,
filename
,
mode
);
htrc
(
"File %s is open in mode %d
\n
"
,
filename
,
mode
);
#endif
if
(
del
)
if
(
del
)
// This will stop the process by
// This will stop the process by
...
@@ -3659,10 +3650,9 @@ bool BGVFAM::AllocateBuffer(PGLOBAL g)
...
@@ -3659,10 +3650,9 @@ bool BGVFAM::AllocateBuffer(PGLOBAL g)
/***********************************************************************/
/***********************************************************************/
int
BGVFAM
::
WriteBuffer
(
PGLOBAL
g
)
int
BGVFAM
::
WriteBuffer
(
PGLOBAL
g
)
{
{
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"BGV WriteDB: R%d Mode=%d CurNum=%d CurBlk=%d
\n
"
,
htrc
(
"BGV WriteDB: R%d Mode=%d CurNum=%d CurBlk=%d
\n
"
,
Tdbp
->
GetTdb_No
(),
Tdbp
->
GetMode
(),
CurNum
,
CurBlk
);
Tdbp
->
GetTdb_No
(),
Tdbp
->
GetMode
(),
CurNum
,
CurBlk
);
#endif
if
(
Tdbp
->
GetMode
()
==
MODE_UPDATE
)
{
if
(
Tdbp
->
GetMode
()
==
MODE_UPDATE
)
{
// Mode Update is done in ReadDB, we just initialize it here
// Mode Update is done in ReadDB, we just initialize it here
...
@@ -3760,20 +3750,19 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -3760,20 +3750,19 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
/* 2 - directly move the not deleted lines inside the original */
/* 2 - directly move the not deleted lines inside the original */
/* file, and at the end erase all trailing records. */
/* file, and at the end erase all trailing records. */
/*********************************************************************/
/*********************************************************************/
#ifdef DEBTRACE
if
(
trace
)
fprintf
(
debug
,
htrc
(
"BGV DeleteDB: irc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d
\n
"
,
"BGV DeleteDB: irc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d
\n
"
,
irc
,
UseTemp
,
Fpos
,
Tpos
,
Spos
);
irc
,
UseTemp
,
Fpos
,
Tpos
,
Spos
);
#endif
if
(
irc
!=
RC_OK
)
{
if
(
irc
!=
RC_OK
)
{
/*******************************************************************/
/*******************************************************************/
/* EOF: position Fpos at the end-of-file position. */
/* EOF: position Fpos at the end-of-file position. */
/*******************************************************************/
/*******************************************************************/
Fpos
=
(
Block
-
1
)
*
Nrec
+
Last
;
Fpos
=
(
Block
-
1
)
*
Nrec
+
Last
;
#ifdef DEBTRACE
htrc
(
"Fpos placed at file end=%d
\n
"
,
Fpos
);
if
(
trace
)
#endif
htrc
(
"Fpos placed at file end=%d
\n
"
,
Fpos
);
eof
=
UseTemp
&&
!
MaxBlk
;
eof
=
UseTemp
&&
!
MaxBlk
;
}
else
// Fpos is the deleted line position
}
else
// Fpos is the deleted line position
Fpos
=
CurBlk
*
Nrec
+
CurNum
;
Fpos
=
CurBlk
*
Nrec
+
CurNum
;
...
@@ -3805,14 +3794,13 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
...
@@ -3805,14 +3794,13 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
return
RC_FX
;
return
RC_FX
;
if
(
irc
==
RC_OK
)
{
if
(
irc
==
RC_OK
)
{
#ifdef
DEBTRACE
#ifdef
_DEBUG
assert
(
Spos
==
Fpos
);
assert
(
Spos
==
Fpos
);
#endif
#endif
Spos
++
;
// New start position is on next line
Spos
++
;
// New start position is on next line
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"after: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
htrc
(
"after: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
#endif
}
else
{
}
else
{
/*******************************************************************/
/*******************************************************************/
...
@@ -3998,9 +3986,9 @@ bool BGVFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
...
@@ -3998,9 +3986,9 @@ bool BGVFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
}
// endif Usetemp...
}
// endif Usetemp...
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"loop: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
htrc
(
"loop: Tpos=%d Spos=%d
\n
"
,
Tpos
,
Spos
);
#endif
}
// endfor n
}
// endfor n
return
false
;
return
false
;
...
@@ -4132,10 +4120,10 @@ void BGVFAM::CloseTableFile(PGLOBAL g)
...
@@ -4132,10 +4120,10 @@ void BGVFAM::CloseTableFile(PGLOBAL g)
if
(
Hfile
!=
INVALID_HANDLE_VALUE
)
if
(
Hfile
!=
INVALID_HANDLE_VALUE
)
rc
=
PlugCloseFile
(
g
,
To_Fb
);
rc
=
PlugCloseFile
(
g
,
To_Fb
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"BGV CloseTableFile: closing %s wrc=%d rc=%d
\n
"
,
htrc
(
"BGV CloseTableFile: closing %s wrc=%d rc=%d
\n
"
,
To_File
,
wrc
,
rc
);
To_File
,
wrc
,
rc
);
#endif
Hfile
=
INVALID_HANDLE_VALUE
;
Hfile
=
INVALID_HANDLE_VALUE
;
}
// end of CloseDB
}
// end of CloseDB
...
@@ -4178,11 +4166,9 @@ bool BGVFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -4178,11 +4166,9 @@ bool BGVFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
pos
=
(
BIGINT
)
Nrec
*
((
BIGINT
)
colp
->
Deplac
pos
=
(
BIGINT
)
Nrec
*
((
BIGINT
)
colp
->
Deplac
+
(
BIGINT
)
Lrecl
*
(
BIGINT
)
CurBlk
);
+
(
BIGINT
)
Lrecl
*
(
BIGINT
)
CurBlk
);
#ifdef DEBTRACE
if
(
trace
)
fprintf
(
debug
,
htrc
(
"RB: offset=%lld Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d MaxBlk=%d
\n
"
,
"RB: offset=%lf Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d MaxBlk=%d
\n
"
,
pos
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
CurBlk
,
MaxBlk
);
(
double
)
pos
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
CurBlk
,
MaxBlk
);
#endif
if
(
BigSeek
(
g
,
Hfile
,
pos
))
if
(
BigSeek
(
g
,
Hfile
,
pos
))
return
true
;
return
true
;
...
@@ -4190,9 +4176,9 @@ bool BGVFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -4190,9 +4176,9 @@ bool BGVFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
if
(
BigRead
(
g
,
Hfile
,
colp
->
Blk
->
GetValPointer
(),
colp
->
Clen
*
Nrec
))
if
(
BigRead
(
g
,
Hfile
,
colp
->
Blk
->
GetValPointer
(),
colp
->
Clen
*
Nrec
))
return
true
;
return
true
;
#ifdef DEBTRACE
if
(
trace
)
num_read
++
;
num_read
++
;
#endif
return
false
;
return
false
;
}
// end of ReadBlock
}
// end of ReadBlock
...
@@ -4217,10 +4203,9 @@ bool BGVFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
...
@@ -4217,10 +4203,9 @@ bool BGVFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
pos
=
(
BIGINT
)
Nrec
*
((
BIGINT
)
colp
->
Deplac
pos
=
(
BIGINT
)
Nrec
*
((
BIGINT
)
colp
->
Deplac
+
(
BIGINT
)
Lrecl
*
(
BIGINT
)
colp
->
ColBlk
);
+
(
BIGINT
)
Lrecl
*
(
BIGINT
)
colp
->
ColBlk
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"WB: offset=%lf Nrec=%d Deplac=%d Lrecl=%d ColBlk=%d
\n
"
,
htrc
(
"WB: offset=%lld Nrec=%d Deplac=%d Lrecl=%d ColBlk=%d
\n
"
,
(
double
)
pos
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
colp
->
ColBlk
);
pos
,
Nrec
,
colp
->
Deplac
,
Lrecl
,
colp
->
ColBlk
);
#endif
if
(
BigSeek
(
g
,
Tfile
,
pos
))
if
(
BigSeek
(
g
,
Tfile
,
pos
))
return
true
;
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment