Subject Re: Problems with requery() in dbase 12 and dbase 19 (in windows 11)
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 22 Jan 2023 11:03:12 +0200
Newsgroups dbase.getting-started

On 2023/01/19 01:17, Hernan Campos wrote:

> Can someone give me an idea of what it could be, we get the impression that when using it it destabilizes the application in a very severe way, previously we didn't use this function, we just completely regenerated the object, it was a bit slower but it didn't give you problems, then I read an email in this group, where they recommended to do faster searches, we also noticed that a temporary file called _sqlXXX.dbf is created, is there a way to delete it or that it is generated in a folder where it can be deleted safely, since even though the application is closed, the file is not removed by itself, thanks

Back in the days when I was preparing for exams in high school we we
continually reminded to "Read the entire question before answering.".
I'm afraid I didn't do that here. :-(

The _QSQLxxx.dbf files are temporary files that dBASE creates.  There
can be 1000 files before dBASE runs out of numbers.  dBASE should
normally delete these files when the application closes but,
unfortunately, this doesn't always happen.  This is possibly due to an
open reference in Windows to the query when the form closes.  As the
reference within Windows should disappear when the application closes
the abandoned _QSQL files should not cause any other problems except
eventually preventing dBASE from opening a new file.  Ideally one should
make sure dBASE does the housekeeping but the DIY route will do the trick.

If dBASE is not deleting these files you need to do this yourself
because if dBASE runs out of numbers your application will crash.  You
could add code to the onOpen event handler for your form to take care of

The following code assumes the tables and forms are in the same folder.

aFiles = new Array()
nFiles = aFiles.dir("_QSQL*.DBF")
if nFiles >= 1
    f = new file()
    for n = 1 to nFiles
       try //Avoid error if table open
       catch(exception e)
    f = null