4D v15

OPEN DATABASE

Home

 
4D v15
OPEN DATABASE

OPEN DATABASE 


 

OPEN DATABASE ( filePath ) 
Parameter Type   Description
filePath  String in Name or full access path of the database file to open (.4db, .4dc, .4dbase, or .4dlink)

Originally introduced in 4D v14 R3

Theme: 4D Environment

The new OPEN DATABASE command closes the current 4D database and opens on-the-fly the database defined by filePath. This command is useful for automatic testing purposes, or to reopen a database automatically after a compilation.

In the filePath parameter, pass the name or the full access path of the database to be opened. You can use files with one of the following extensions:

  • .4db (interpreted structure file),
  • .4dc (compiled structure file),
  • .4dbase (OS X package),
  • .4dlink (shortcut file).

If you pass only the file name, it must be placed at the same level as the structure file of the current database.

If the access path sets a valid database, 4D quits the database in progress and opens the specified database. In single-user mode, the On Exit database method of the closed database and the On Startup database method of the opened database are called successively.

Warning: Since this command causes the application to quit before re-opening with the specified database, it is not recommended to use it in the On Startup database method or in a method called by this database method.

The command is executed in an asynchronous manner: after its call, 4D continues executing the rest of the method. Then, the application behaves as if the Quit command was selected in the File menu: open dialog boxes are cancelled, any open processes have 10 seconds to finish before being terminated, etc.

If the target database file is not found or is invalid, a standard file system error is returned and 4D does nothing.

This command can be executed from a standard database only. If it is called from an engined application (single-user or server), the error -10509 "Can't open database" is returned.

Example  

 OPEN DATABASE("C:\\databases\\Invoices\\Invoices.4db")

 
PROPERTIES 

Product: 4D
Theme: Language

 
HISTORY 

 
ARTICLE USAGE

4D v15 - Upgrade (standard edition) ( 4D v15)