Configuration Management

You can define more than one configuration for connection to the database. You can do this static via the configuration file or dynamic via the addConfiguration function. It is possible to tell DAL which configuration to use when connecting to the database. If you don't specify a configuration to use DAL will use the first configuration that occurs in the list.

Adding a configuration dynamicly

boolean addConfiguration( string $configName , string $userName , string $password , string $connectString );

The last parameter ($connectString) is optional. $configName contains the name of the configuration you want to add. This name needs to be unique, if the name isn't unique it will be rejected. $userName is the username required for connecting to the database, $password the password that belongs to the username. $connectString contains extra parameters for the connection.

The adding of a configuration can be rejected by DAL. This can be due the name not being unique. In this case you get a nice error message telling that the name is not unique and the addconfiguration function returns false. Another thing that can occur is that the configuration is locked. When setting up DAL it is possible to lock the configuration (see also the config file).

Selecting a configuration

Selecting a specified configuration can be done with the function selectConfiguration .

boolean selectConfiguration( string $name );

The parameter $name contains the name of the configuration you want to select. This name is the name under which the configuration is stored in the configurations array. When you specify an invalid name DAL will return false at the function call. You get an error message which tells you what;s the problem.