Search code examples
foxprodatabase-cursor

foxpro cursor size


This seems like such an easy problem, but I can't seem to find a solution anywhere. My co-worker and I are working on an application that makes use of the Foxpro xml dump facilities. It works great, but we're wishing to split the table into multiple files based on some size constraints.

This seems like it should be the easy part: How do you find the size of a cursor in Foxpro?


Solution

  • If you mean file size, you can find the file a cursor relates to by calling the DBF() function with the cursor as an alias, checking that the return value extension is .dbf, and then use file functions to read the file size. The cursor may be in-memory though (the reported 'filename' will have a .tmp extension, if I remember right) so an alternative would be to use RECCOUNT() (to get the number of rows) combined with AFIELDS() (to get the size of each row) to approximate the file size. (In-memory cursors can sometimes be forced to disk by including a NOFILTER clause in the generating query)