next up previous contents
Next: Setting input and reading Up: A working session Previous: Including the DB-ALLe interface   Contents

Starting the work

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:

"read"
pseudoana records cannot be modified.
"write"
pseudoana records can be added and removed.

The second extra parameter control access to observed data and can have these values:

"read"
data cannot be modified in any way.
"add"
data can be added to the database, but existing data cannot be modified. Deletions are disabled. This is used to insert new data in the database while preserving the data that was already present in it.
"write"
data can freely be added, overwritten and deleted.

The third extra parameter controls access to data attributes and can have these values:

"read"
attributes cannot be modified in any way.
"add"
attributes can can be added to the database, but existing attributes cannot be modified. Deletion of attributes is disabled. This is used to insert new attribute in the database while preserving the attributes that were already present in it.
"write"
attributes can freely be added, overwritten and deleted.

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).


next up previous contents
Next: Setting input and reading Up: A working session Previous: Including the DB-ALLe interface   Contents
root 2007-06-20