The GDL Data In/Out Add-On allows you to access a simple kind of database by using GDL commands.
Otherwise this Add-On is similar to the GDL Text In/Out Add-On.
The database is a text file in which the records are stored in separate lines. The database can be queried and modified based on a single key.
The key and the other items are separated by a character (specified in the OPEN command).
The length of the lines does not need to be the same and even the number of columns in the records may be different.
If a database is open for writing then there should be enough space beside the database file for duplicating the whole file.
Opening and closing a database may be time consuming, so consecutive closing and opening of a database should be avoided.
Large databases (with more than some hundred thousand records) should be ordered by the key values.
A database can be opened, queried, modified and closed by this Add-On using the OPEN, INPUT, OUTPUT and CLOSE GDL commands.
Opens the database. If the database file is to be opened for modification and the file does not exist, it creates a new file.
If the database file is to be opened for reading and the file does not exist, an error message is displayed.
paramstring:add-on specific parameter, contains separator characters and file opening mode parameters
The paramstring may contain the following:
after the keyword between single quotation marks (”) you can define a character that you want to use
in your text file (both in case of writing and reading) for the separation of data fields.
A special case is the tabulator character (‘t’).
after the keyword the mode of opening has to follow. There are three modes of opening:
RO (read only)
WA (read, append/modify)
WO (overwrite) Empties the database if exists.
the ‘filename’ parameter is working as a file-identifier, otherwise it is a full-path-name.
The file-identifier is a simple string, which will be matched to an existing file by the Add-On during a standard ‘Open/Save as’ dialog.
This matching is stored by the Add-On and it won’t ask again except when the file is not available any more.
If the open mode is read only, the Add-On will put up an Open dialog to select an existing document.
Otherwise the Add-On put up an alert-dialog to select between the ‘Create’ and ‘Browse’ options:
Create: create a new data-file (Save as Dialog).
Browse: search an existing data-file (Open dialog)
If the LIBRARY keyword is present in the parameter string, the data file has to be in the loaded library.
Opening data file from the loaded library for reading is possible from all scripts, but writing is only enabled in the parameter, user interface and property scripts.
Available options for files outside of the loaded libraries:
- Writing from 2D and 3D scripts are enabled
- Reading data from external files is regarded as non-determinictic actions, see Background Conversion.
Always put a comma (,) between the components of paramstring.
If you use keywords that don’t exist, if the separator characters given are wrong or if there is nothing in the parameter string,
the extension will use the default settings:
"SEPARATOR = 't', MODE = RO"
In the parameter list there has to be at least one value.
The values can be of numeric or string type independently of the parameter type defined for them.
The return value is the number of successfully read values.
If there are more parameters than values, the parameters without corresponding values will be set to zero.
In case of empty columns (i.e. if there is nothing between the separator characters) the parameters will be set to zero.
the column number in the given record (the smallest number,
1 refers to the item after the key value).
In case of record creation or modification, it sets the record belonging to the given key value.
The record will contain the given values in the same sequence as they appear in the command. The values can be of numeric or string type.
There has to be at least one expression.
fieldID:flag: specify 0 (or <= 0) to delete a record, specify 1 (or > 0) to create or modify a record