FACT++  1.0
po::basic_parsed_options< char > Configuration::parse_database ( const std::string &  prgname,
const std::string &  database,
const po::options_description &  desc,
bool  allow_unregistered = false 
)
static

Retrieve data from a database and return them as options.

The purpose of this function is basically to connect to the database, and retrieve all the options entries from the 'Configuration' table.

Parameters
databaseThe URL of the database from which the configuration data is retrieved. It should be given in the form
  • [user[:password]@]server.com[:port]/database
with
  • user: user name (default is the current user)
  • password: necessary if required by the database rights
  • server: the URL of the server (can be 'localhost')
  • port: the port to which to connect (usually obsolete)
  • database: The name of the database containing the table
descA reference to the object with the description of the options which should be retrieved.
allow_unregisteredIf this is true also unregistered, i.e. options unknown to desc, are returned. Otherwise an exception is thrown if such an option was retrieved.
Returns
Return an object of type basic_parsed_options containing all the entries retrieved from the database. Options not found in desc are flagged as unregistered.
Exceptions
Twotypes of exceptions are thrown
  • It thows an unnamed exception if the options could not be retrieved properly from the databse.
  • If an option is not registered within the given descriptions and allow_unregistered is false, an exception of type po::unknown_option is thrown.
Todo:
  • The exceptions handling should be improved.
  • The final database layout is missing in the description
  • Shell we allow options to be given more than once?

Definition at line 451 of file Configuration.cc.

Referenced by Parse(), and ~Configuration().

452 {
453  return po::parsed_options(&desc);
454 }

+ Here is the caller graph for this function: