Subject Re: Close Databases
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 23 Jul 2020 09:40:38 +0200
Newsgroups dbase.getting-started

On 2020-07-23 07:05, Tony Hughes wrote:
> Hi Again,
>
> Should I "Close Databases" when I am exiting a form that has had say 4 databases open in the coding ?? - Tony Hughes
>

We need to make sure we're singing from the same hymn sheet.

Technically, a database is a collection of tables.  For SQL servers such
as Firebird or MySQL all the tables are held in one file.  dBASE
considers all the tables, each held in a .dbf (or .db Paradox file) in
one directory folder, to be a database.

Databases can be named either by the BDE or as a User BDE Alias.  dBASE
creates a default database for the selected working directory.

CLOSE DATABASES is a "sledgehammer" command which closes every table and
index in the current session.  Good programming practice is to close any
table that has been opened.  CLOSE DATABASES is useful if a program has
crashed leaving tables open.  It doesn't really belong in a program as a
matter of course.

CLOSE DATABASES is in any event an XDML (the original dBASE commands)
command.  With the new OODML objects it is unnecessary.  To close a
database object set it's active property false.  This happens
automatically when a form closes (or crashes) anyway.

Mervyn.