As a developer, you’re aware that improving the quality of your developments is often based on unit tests. In order to launch these tests, developers and QA teams need tools to launch 4D databases in different modes (single user / client-server) and distinct environments (Macintosh / Windows).
4D products can already be launched using command line parameters to allow automatic testing or deployment. What if you want to create your own update mechanism or you need to handle a server farm with hundreds of 4D Servers running? Maybe you want to specify which database file to use – or pass parameters on launch …
The command line can be used the same way on both macOS and Windows.
The simplified syntax looks like this: App + structure + data
4D Application --structure <path to structure file> --data <path to data file>
New in 4D V17 R3
With 4D v17 R3, new parameters have been added to give you more flexibility when opening your databases:
- –opening-mode: will specify to open your database in interpreted or compiled mode
- –create-data: will create new data if the current data file is not found or with a specific name if – –data is passed!
- –user-param: will send a string that can be read after the database is launched using the GET DATABASE PARAMETER command (detailed below)
GET / SET DATABASE PARAMETER
It’s now possible to set a database parameter of text type that can be retrieved once the database has been relaunched with the RESTART 4D, OPEN DATA FILE, or OPEN DATABASE command. This will avoid writing and reading temporary files on disk, as well as make your work easier and efficient.
SET DATABASE PARAMETER(User param value;$userParam)
After restarting the database, the $userParam can be read the same way:
$result:=Get database parameter(User param value;$userParam)
Note that the user param can also be set inside the 4DLINK file!
If you want to know more about 4DLINKS, see the documentation here.
<database_shortcut structure_opening_mode="1" structure_file="file:///Users/Mike/Orda.4dbase.4DB" data_file="file:///Users/Mike/Orda.4dbase.4DD" user_param="check"/>
For more details, check out the documentation.