Before any action routine, you need to connect to the database. Connecting to the database will give you a handle that you can use to open sessions.
This code will open a connection with DB-ALLe, then it will start a session:
c Connect to the database and get a handle to work with it
call idba_presentati(dbhandle, "dsn", "username", "password")
call idba_preparati(dbhandle, handle, "read", "read", "read")
You can call idba_preparati many times and get more handles. This allows to perform many operations on the database at the same time.
idba_preparati has three extra parameters that can be used to limit write operations on the database, as a limited protection against programming errors.
The first extra parameter controls access to pseudoana records and can have these values:
The second extra parameter control access to observed data and can have these values:
The third extra parameter controls access to data attributes and can have these values:
Note that some combinations are illegal, such as pseudoana=read and data=add (when adding a new data, it's sometimes necessary to insert new pseudoana records), or data=rewrite and attr=read (when deleting data, their attributes are deleted as well).