//----------------------------------------------------------------------------- void Root::disconnectAllDatabases() { for (ServerPtrs::iterator its = serversM.begin(); its != serversM.end(); ++its) { DatabasePtrs databases((*its)->getDatabases()); std::for_each(databases.begin(), databases.end(), boost::mem_fn(&Database::disconnect)); } }
// // Run a single type test // void runtest(char type) { try { debug("SStest", "Start test <%c>", type); switch (type) { case '.': // default integrity(); break; case '-': adhoc(); break; case 'a': acls(); break; case 'A': authAcls(); break; case 'b': blobs(); break; case 'c': codeSigning(); break; case 'd': databases(); break; case 'e': desEncryption(); break; case 'k': keychainAcls(); break; case 'K': keyBlobs(); break; case 's': signWithRSA(); break; case 't': authorizations(); break; case 'T': timeouts(); break; default: error("Invalid test selection (%c)", type); } printf("** Test step complete.\n"); debug("SStest", "End test <%c>", type); } catch (CssmCommonError &err) { error(err, "Unexpected exception"); } catch (...) { error("Unexpected system exception"); } }
void WebDatabaseManagerProxy::didGetDatabasesByOrigin(const Vector<OriginAndDatabases>& originAndDatabasesVector, uint64_t callbackID) { RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID); if (!callback) { // FIXME: Log error or assert. return; } size_t originAndDatabasesCount = originAndDatabasesVector.size(); Vector<RefPtr<APIObject> > result(originAndDatabasesCount); for (size_t i = 0; i < originAndDatabasesCount; ++i) { const OriginAndDatabases& originAndDatabases = originAndDatabasesVector[i]; RefPtr<APIObject> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originAndDatabases.originIdentifier); size_t databasesCount = originAndDatabases.databases.size(); Vector<RefPtr<APIObject> > databases(databasesCount); for (size_t j = 0; j < databasesCount; ++j) { const DatabaseDetails& details = originAndDatabases.databases[i]; HashMap<String, RefPtr<APIObject> > detailsMap; detailsMap.set(databaseDetailsNameKey(), WebString::create(details.name())); detailsMap.set(databaseDetailsDisplayNameKey(), WebString::create(details.displayName())); detailsMap.set(databaseDetailsExpectedUsageKey(), WebUInt64::create(details.expectedUsage())); detailsMap.set(databaseDetailsCurrentUsageKey(), WebUInt64::create(details.currentUsage())); databases.append(ImmutableDictionary::adopt(detailsMap)); } HashMap<String, RefPtr<APIObject> > originAndDatabasesMap; originAndDatabasesMap.set(originKey(), origin); originAndDatabasesMap.set(originQuotaKey(), WebUInt64::create(originAndDatabases.originQuota)); originAndDatabasesMap.set(originUsageKey(), WebUInt64::create(originAndDatabases.originUsage)); originAndDatabasesMap.set(databaseDetailsKey(), ImmutableArray::adopt(databases)); result.append(ImmutableDictionary::adopt(originAndDatabasesMap)); } RefPtr<ImmutableArray> resultArray = ImmutableArray::adopt(result); callback->performCallbackWithReturnValue(resultArray.get()); }
int main(int argc, char* argv[]) { // enable -constant ... if someone really wants it // enable -zeroTime to prevent accidentally trashing the initial fields Foam::timeSelector::addOptions(false, false); Foam::argList::noParallel(); # include "setRootCase.H" # include "createTime.H" label nProcs = 0; // Determine the processor count directly while (isDir(args.path()/(word("processor") + name(nProcs)))) { ++nProcs; } if (!nProcs) { FatalErrorIn(args.executable()) << "No processor* directories found" << exit(FatalError); } // Create the processor databases PtrList<Time> databases(nProcs); forAll (databases, procI) { databases.set ( procI, new Time ( Time::controlDictName, args.rootPath(), args.caseName()/fileName(word("processor") + name(procI)) ) ); }
dlgReassignDropOwned::dlgReassignDropOwned(frmMain *win, pgConn *conn, pgRole *role, wxString dbrestriction) { wxString query; connection=conn; parent=win; wxWindowBase::SetFont(settings->GetSystemFont()); LoadResource(win, wxT("dlgReassignDropOwned")); cbRoles->Clear(); query = wxT("SELECT rolname FROM pg_roles WHERE rolname<>") + conn->qtDbString(role->GetName()) + wxT(" ORDER BY rolname"); pgSetIterator roles(connection, query); while (roles.RowsLeft()) { cbRoles->Append(roles.GetVal(wxT("rolname"))); } cbRoles->SetSelection(0); cbRoles->Enable(cbRoles->GetStrings().Count() > 0); cbDatabases->Clear(); query = wxT("SELECT DISTINCT datname FROM pg_database WHERE datallowconn"); if (!dbrestriction.IsEmpty()) { query += wxT(" AND datname NOT IN (") + dbrestriction + wxT(")"); } query += wxT(" ORDER BY datname"); pgSetIterator databases(connection, query); while (databases.RowsLeft()) { cbDatabases->Append(databases.GetVal(wxT("datname"))); } cbDatabases->SetSelection(0); }
void BrowserDocumentation::defineDatabase(CPDatabase database) { vector<CPDatabase> databases(1, database); defineDatabases(&databases); }
//----------------------------------------------------------------------------- // browses the server nodes, and their database nodes // saves everything to fr_databases.conf file // returns: false if file cannot be opened for writing, true otherwise // bool Root::save() { // create directory if it doesn't exist yet. QString fileFullPath = QFileInfo(getFileName()).absoluteFilePath(); { QDir _file = fileFullPath; if (!_file.exists()) _file.mkdir(_file.path()); } QFile file(fileFullPath); if (!file.open(QFile::WriteOnly | QFile::Text)) { return false; } QXmlStreamWriter xmlWriter(&file); xmlWriter.setAutoFormatting(true); xmlWriter.writeStartDocument(); // #if !wxUSE_UNICODE // doc.SetFileEncoding(getHtmlCharset()); // #endif xmlWriter.writeStartElement(QString::fromLatin1("root")); { // QDomNode rn = new QDomNode(wxXML_ELEMENT_NODE, QString::fromLatin1("root")); // doc.SetRoot(rn); // rsAddChildNode(rn, QString::fromLatin1("nextId"), // QString::Format(QString::fromLatin1("%d"), Database::getUIDGeneratorValue())); rsAddChildNode(xmlWriter, QString::fromLatin1("nextId"), QString::fromLatin1("%1").arg(Database::getUIDGeneratorValue())); for (ServerPtrs::iterator its = serversM.begin(); its != serversM.end(); ++its) { // do not save the dummy server node for databases that were opened // either via command line switch or via drag and drop if ((*its) == unregLocalDatabasesM) continue; // QDomNode xmlWriter = new QDomNode(wxXML_ELEMENT_NODE, QString::fromLatin1("server")); // rn.AddChild(xmlWriter); xmlWriter.writeStartElement(QString::fromLatin1("server")); { rsAddChildNode(xmlWriter, QString::fromLatin1("name"), (*its)->getName_()); rsAddChildNode(xmlWriter, QString::fromLatin1("host"), (*its)->getHostname()); rsAddChildNode(xmlWriter, QString::fromLatin1("port"), (*its)->getPort()); DatabasePtrs databases((*its)->getDatabases()); for (DatabasePtrs::iterator itdb = databases.begin(); itdb != databases.end(); ++itdb) { (*itdb)->resetCredentials(); // clean up eventual extra credentials // QDomNode xmlWriter = new QDomNode(wxXML_ELEMENT_NODE, QString::fromLatin1("database")); // xmlWriter.AddChild(xmlWriter); xmlWriter.writeStartElement(QString::fromLatin1("database")); { rsAddChildNode(xmlWriter, QString::fromLatin1("id"), (*itdb)->getId()); rsAddChildNode(xmlWriter, QString::fromLatin1("name"), (*itdb)->getName_()); rsAddChildNode(xmlWriter, QString::fromLatin1("path"), (*itdb)->getPath()); rsAddChildNode(xmlWriter, QString::fromLatin1("charset"), (*itdb)->getConnectionCharset()); rsAddChildNode(xmlWriter, QString::fromLatin1("username"), (*itdb)->getUsername()); rsAddChildNode(xmlWriter, QString::fromLatin1("password"), (*itdb)->getRawPassword()); rsAddChildNode(xmlWriter, QString::fromLatin1("role"), (*itdb)->getRole()); rsAddChildNode(xmlWriter, QString::fromLatin1("authentication"), (*itdb)->getAuthenticationMode().getConfigValue()); } xmlWriter.writeEndElement(); } } xmlWriter.writeEndElement(); } } xmlWriter.writeEndElement(); xmlWriter.writeEndDocument(); file.close(); if (file.error()) { return false; } // return doc.Save(getFileName()); return true; }