Exemplo n.º 1
0
void sqlExecProg(char *prog, char **progArgs, int userArgc, char *userArgv[])
/* Exec one of the sql programs using user and password from ~/.hg.conf.
 * progArgs is NULL-terminate array of program-specific arguments to add,
 * which maybe NULL. userArgv are arguments passed in from the command line.
 * The program is execvp-ed, this function does not return. */
{
sqlExecProgProfile(getDefaultProfileName(), prog, progArgs, userArgc, userArgv);
}
Exemplo n.º 2
0
/**
 * @brief Retrieves the specified access profile
 * 
 * This method retrieves the named profile.  If no name is provided, the default
 * profile is returned.
 * 
 * There are two ways to specify the default.  The first source of a named
 * default comes from within the configuration file.  A keyword specified in the
 * Database object section named \b DefaultProfile can specify a named profile,
 * the value of the Name keyword in a \b Profile group.  The second source comes
 * from the application programmer.  In the constructor call to this object, the
 * application programmer can provide a named profile as the default, which
 * could ultimately come from the user (interface).
 * 
 * If no default is specified, then only the keywords contained in the Database
 * object section of the configuration file is returned when requesting an
 * unnamed profile.
 * 
 * @param name Optional name of the profile to return
 * 
 * @return const DbProfile The specified profile.  One should test the
 *         validatity of the profile returned as this is the only indication of
 *         success.
 */
const DbProfile DbAccess::getProfile(const std::string &name) const 
                                      throw (iException &) {
  string defName(name);
  if (defName.empty()) {
    defName = getDefaultProfileName();
  }
  else {
    if (!_profiles.exists(defName)) {
       return (DbProfile(defName));
    }
  }

//  We have identified the proper profile
  if (_profiles.exists(defName)) {
    //   Return the composite of this access scheme
    return(DbProfile(*this, _profiles.get(defName),defName));
  }
  else {
    //  Return only the high level database access keys and hope it is enough
    return (DbProfile(*this, DbProfile(),defName));
  }
}