本文整理汇总了C++中DatabasePtr::setUsername方法的典型用法代码示例。如果您正苦于以下问题:C++ DatabasePtr::setUsername方法的具体用法?C++ DatabasePtr::setUsername怎么用?C++ DatabasePtr::setUsername使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabasePtr
的用法示例。
在下文中一共展示了DatabasePtr::setUsername方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseDatabase
//-----------------------------------------------------------------------------
bool Root::parseDatabase(ServerPtr server, QDomNode& xmlnParent)
{
Q_ASSERT(server);
Q_ASSERT(!xmlnParent.isNull());
DatabasePtr database = server->addDatabase();
SubjectLocker locker(database.get());
for (QDomElement xmln = xmlnParent.firstChildElement();
!xmln.isNull();
xmln = xmln.nextSiblingElement())
{
QString value = xmln.text();
if (xmln.tagName() == QString::fromLatin1("name"))
database->setName_(value);
else if (xmln.tagName() == QString::fromLatin1("path"))
database->setPath(value);
else if (xmln.tagName() == QString::fromLatin1("charset"))
database->setConnectionCharset(value);
else if (xmln.tagName() == QString::fromLatin1("username"))
database->setUsername(value);
else if (xmln.tagName() == QString::fromLatin1("password"))
database->setRawPassword(value);
else if (xmln.tagName() == QString::fromLatin1("encrypted") && value == QString::fromLatin1("1"))
database->getAuthenticationMode().setStoreEncryptedPassword();
else if (xmln.tagName() == QString::fromLatin1("authentication"))
database->getAuthenticationMode().setConfigValue(value);
else if (xmln.tagName() == QString::fromLatin1("role"))
database->setRole(value);
else if (xmln.tagName() == QString::fromLatin1("id"))
{
bool isOk = false;
unsigned long id = value.toULong(&isOk);
if (isOk)
database->setId(id);
}
}
// make sure the database has an Id before Root::save() is called,
// otherwise a new Id will be generated then, but the generator value
// will not be stored because it's at the beginning of the file.
database->getId();
return true;
}