Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Benefits of moving to VFP 8
Message
From
11/04/2003 17:11:27
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgia, United States
 
 
To
11/04/2003 15:30:44
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00776606
Message ID:
00776799
Views:
12
I have not found a pattern with the exception that it always seems to happen on peer to peer networks. I have created ( I think I got most of this code from someone on UT) a trap to check when it happens. The code is fairly simple but it does work:

**********************
function tableCheck
lparameters cTable,cOpened
* compares size of table according to header and physical size
nowdbf=alias()
if PCOUNT()=1
use (cTable) in 0 again alias mytab
select mytab
else
SELECT(cTable)
endif
nRecCount = RECCOUNT()
nLogicalSize = HEADER() + (nRecCount * RECSIZE()) + 1
if PCOUNT()=1
USE IN mytab
endif
cOpen=cTable+'.dbf'
set compatible on
nPhysicalSize=FSIZE(cOpen)
set compatible off
IF VARTYPE(mytab)<>'U' AND USED(mytab)
USE IN mytab
endif
if !empty(nowdbf)
sele (nowdbf)
endif

* the file size on the server may not have been updated when a record
* is added to the table plus I think the problem is real only
* if the logical size is less than the file size.
if nPhysicalSize > nLogicalSize
return -1
else
return 1
endif

Whenever this returns -1 I tell the user to run database maintenance (Stonefields's tablerepair) which corrects the problem.
A problem is a problem only as long as it has a possible solution. Lacking that, it becomes a FACT!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform