void CDB_ODBC_ConnParams::x_MapPairToParam(const string& key, const string& value) { // MS SQL Server related attributes ... if (NStr::Equal(key, "SERVER", NStr::eNocase)) { SetServerName(value); } else if (NStr::Equal(key, "UID", NStr::eNocase)) { SetUserName(value); } else if (NStr::Equal(key, "PWD", NStr::eNocase)) { SetPassword(value); } else if (NStr::Equal(key, "DRIVER", NStr::eNocase)) { SetDriverName(value); } else if (NStr::Equal(key, "DATABASE", NStr::eNocase)) { SetDatabaseName(value); } else if (NStr::Equal(key, "ADDRESS", NStr::eNocase)) { string host; string port; NStr::SplitInTwo(value, ",", host, port); NStr::TruncateSpacesInPlace(host); NStr::TruncateSpacesInPlace(port); // SetHost(host); SetPort(static_cast<Uint2>(NStr::StringToInt(port))); } else { SetParam(key, value); } }
void CDBUriConnParams::ParseSlash(const string& params, size_t cur_pos) { string::size_type pos = 0; string param_pairs; pos = params.find_first_of("?", cur_pos); if (pos != string::npos) { string database_name = params.substr(cur_pos, pos - cur_pos); SetDatabaseName(database_name); cur_pos = pos + 1; param_pairs = params.substr(cur_pos); } else { string database_name = params.substr(cur_pos); SetDatabaseName(database_name); } }
MongodbClient::MongodbClient() { #if defined (__DAVAENGINE_WIN32__) mongo_init_sockets(); #endif //#if defined (__DAVAENGINE_WIN32__) clientData = new MongodbClientInternalData(); SetDatabaseName(String("Database")); SetCollectionName(String("Collection")); }
/* ---------------- * DoChdirAndInitDatabaseNameAndPath * * this just chdir's to the proper data/base directory * XXX clean this up more. * * XXX The following code is an incorrect of the semantics * XXX described in the header file. Handling of defaults * XXX should happen here, too. * ---------------- */ void DoChdirAndInitDatabaseNameAndPath(char *name, /* name of database */ char *path) /* full path to database */ { /* ---------------- * check the path * ---------------- */ if (path) SetDatabasePath(path); else elog(FATAL, "DoChdirAndInitDatabaseNameAndPath: path:%s is not valid", path); /* ---------------- * check the name * ---------------- */ if (name) SetDatabaseName(name); else elog(FATAL, "DoChdirAndInitDatabaseNameAndPath: name:%s is not valid", name); /* ---------------- * change to the directory, or die trying. * * XXX unless the path hasn't been set because we're bootstrapping. * HP-UX doesn't like chdir("") so check for that case before * doing anything drastic. * ---------------- */ if (*path && (chdir(path) < 0)) elog(FATAL, "DoChdirAndInitDatabaseNameAndPath: chdir(\"%s\"): %m", path); }