当前位置: 首页>>代码示例>>C++>>正文


C++ ExplorerDatabaseTreeItem::database方法代码示例

本文整理汇总了C++中ExplorerDatabaseTreeItem::database方法的典型用法代码示例。如果您正苦于以下问题:C++ ExplorerDatabaseTreeItem::database方法的具体用法?C++ ExplorerDatabaseTreeItem::database怎么用?C++ ExplorerDatabaseTreeItem::database使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExplorerDatabaseTreeItem的用法示例。


在下文中一共展示了ExplorerDatabaseTreeItem::database方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ui_addFunction

void ExplorerTreeWidget::ui_addFunction()
{
    ExplorerDatabaseCategoryTreeItem *categoryItem = selectedDatabaseCategoryItem();
    if (!categoryItem)
        return;

    ExplorerDatabaseTreeItem *databaseItem = categoryItem->databaseItem();

    FunctionTextEditor dlg(databaseItem->database()->server()->connectionRecord()->getFullAddress(),
                           databaseItem->database()->name(), MongoFunction());
    dlg.setWindowTitle("Create Function");
    dlg.setCode(
        "function() {\n"
        "    // write your code here\n"
        "}");
    dlg.setCursorPosition(1, 4);

    int result = dlg.exec();

    if (result == QDialog::Accepted) {

        MongoFunction function = dlg.function();
        databaseItem->database()->createFunction(function);

        // refresh list of functions
        databaseItem->expandFunctions();
    }
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:28,代码来源:ExplorerTreeWidget.cpp

示例2: ui_addUser

 void ExplorerDatabaseCategoryTreeItem::ui_addUser()
 {
     ExplorerDatabaseTreeItem *databaseItem = ExplorerDatabaseCategoryTreeItem::databaseItem();
     if(databaseItem){
         CreateUserDialog dlg(QtUtils::toQString(databaseItem->database()->server()->connectionRecord()->getFullAddress()),
             QtUtils::toQString(databaseItem->database()->name()));
         int result = dlg.exec();
         if (result == QDialog::Accepted) {
             MongoUser user = dlg.user();
             databaseItem->database()->createUser(user, false);
             // refresh list of users
             databaseItem->expandUsers();
         }
     }
 }
开发者ID:eugenkr,项目名称:robomongo,代码行数:15,代码来源:ExplorerDatabaseCategoryTreeItem.cpp

示例3: ui_viewFunctions

 void ExplorerDatabaseCategoryTreeItem::ui_viewFunctions()
 {
     ExplorerDatabaseTreeItem *databaseItem = ExplorerDatabaseCategoryTreeItem::databaseItem();
     if (databaseItem) {
         openDatabaseShell(databaseItem->database(), "db.system.js.find()");
     }
 }
开发者ID:paralect,项目名称:robomongo,代码行数:7,代码来源:ExplorerDatabaseCategoryTreeItem.cpp

示例4: ui_viewUsers

 void ExplorerDatabaseCategoryTreeItem::ui_viewUsers()
 {
     ExplorerDatabaseTreeItem *databaseItem = ExplorerDatabaseCategoryTreeItem::databaseItem();
     if (databaseItem) {
         openDatabaseShell(databaseItem->database(), "db.getUsers()");
     }
 }
开发者ID:paralect,项目名称:robomongo,代码行数:7,代码来源:ExplorerDatabaseCategoryTreeItem.cpp

示例5: ui_dbCollectionsStatistics

 void ExplorerDatabaseCategoryTreeItem::ui_dbCollectionsStatistics()
 {
     ExplorerDatabaseTreeItem *databaseItem = ExplorerDatabaseCategoryTreeItem::databaseItem();
     if (databaseItem) {
         openDatabaseShell(databaseItem->database(), "db.printCollectionStats()");
     }
 } 
开发者ID:paralect,项目名称:robomongo,代码行数:7,代码来源:ExplorerDatabaseCategoryTreeItem.cpp

示例6: ui_createCollection

 void ExplorerDatabaseCategoryTreeItem::ui_createCollection()
 {
     ExplorerDatabaseTreeItem *databaseItem = ExplorerDatabaseCategoryTreeItem::databaseItem();
     if (databaseItem){
         CreateDatabaseDialog dlg(QtUtils::toQString(databaseItem->database()->server()->connectionRecord()->getFullAddress()),
             QtUtils::toQString(databaseItem->database()->name()));
         dlg.setWindowTitle("Create Collection");
         dlg.setOkButtonText("&Create");
         dlg.setInputLabelText("Collection Name:");
         int result = dlg.exec();
         if (result == QDialog::Accepted) {
             databaseItem->database()->createCollection(QtUtils::toStdString<std::string>(dlg.databaseName()));
             // refresh list of databases
             databaseItem->expandCollections();
         }
     }
 }
开发者ID:eugenkr,项目名称:robomongo,代码行数:17,代码来源:ExplorerDatabaseCategoryTreeItem.cpp

示例7: ui_addUser

    void ExplorerDatabaseCategoryTreeItem::ui_addUser()
    {
        ExplorerDatabaseTreeItem *databaseItem = ExplorerDatabaseCategoryTreeItem::databaseItem();
        if (!databaseItem)
            return;

        std::unique_ptr<CreateUserDialog> dlg = nullptr;

        float const version = databaseItem->database()->server()->version();
        if (version < MongoUser::minimumSupportedVersion) {
            dlg.reset(new CreateUserDialog(
                QtUtils::toQString(databaseItem->database()->server()->connectionRecord()->getFullAddress()),
                QtUtils::toQString(databaseItem->database()->name()), MongoUser(version), treeWidget()));
        }
        else {
            dlg.reset(new CreateUserDialog(databaseItem->database()->server()->getDatabasesNames(), 
                QtUtils::toQString(databaseItem->database()->server()->connectionRecord()->getFullAddress()),
                QtUtils::toQString(databaseItem->database()->name()), MongoUser(version), treeWidget()));
        }

        if (dlg->exec() != QDialog::Accepted)
            return;

        MongoUser user = dlg->user();
        databaseItem->database()->createUser(user);
    }
开发者ID:paralect,项目名称:robomongo,代码行数:26,代码来源:ExplorerDatabaseCategoryTreeItem.cpp

示例8: openCurrentDatabaseShell

void ExplorerTreeWidget::openCurrentDatabaseShell(const QString &script, bool execute,
                                                  const CursorPosition &cursor)
{
    ExplorerDatabaseTreeItem *collectionItem = selectedDatabaseItem();
    if (!collectionItem)
        return;

    MongoDatabase *database = collectionItem->database();
    openDatabaseShell(database, script, execute, cursor);
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:10,代码来源:ExplorerTreeWidget.cpp

示例9: ui_createCollection

    void ExplorerDatabaseCategoryTreeItem::ui_createCollection()
    {
        ExplorerDatabaseTreeItem *databaseItem = ExplorerDatabaseCategoryTreeItem::databaseItem();
        if (!databaseItem)
            return;

        const float dbVersion = databaseItem->database()->server()->version();
        const std::string& engineName = databaseItem->database()->server()->getStorageEngineType();
        const QString& serverName = QtUtils::toQString(databaseItem->database()->server()->connectionRecord()->getFullAddress());
        const QString& dbName = QtUtils::toQString(databaseItem->database()->name());

        CreateCollectionDialog dlg(serverName, dbVersion, engineName, dbName, QString(), treeWidget());
        int result = dlg.exec();
        if (result != QDialog::Accepted)
            return;
        std::string collectionName = QtUtils::toStdString(dlg.getCollectionName());
        databaseItem->database()->createCollection(collectionName, 
            dlg.getSizeInputValue(), dlg.isCapped(), dlg.getMaxDocNumberInputValue(), dlg.getExtraOptions());
    }
开发者ID:paralect,项目名称:robomongo,代码行数:19,代码来源:ExplorerDatabaseCategoryTreeItem.cpp

示例10: ui_addFunction

    void ExplorerDatabaseCategoryTreeItem::ui_addFunction()
    {
        ExplorerDatabaseTreeItem *databaseItem = ExplorerDatabaseCategoryTreeItem::databaseItem();
        if (!databaseItem)
            return;

        FunctionTextEditor dlg(QtUtils::toQString(databaseItem->database()->server()->connectionRecord()->getFullAddress()), QtUtils::toQString(databaseItem->database()->name()), MongoFunction());
        dlg.setWindowTitle("Create Function");
        dlg.setCode(
            "function() {\n"
            "    // write your code here\n"
            "}");
        dlg.setCursorPosition(1, 4);
        int result = dlg.exec();
        if (result != QDialog::Accepted)
            return;

        MongoFunction function = dlg.function();
        databaseItem->database()->createFunction(function);
    }
开发者ID:luketn,项目名称:robomongo,代码行数:20,代码来源:ExplorerDatabaseCategoryTreeItem.cpp

示例11: ui_addUser

void ExplorerTreeWidget::ui_addUser()
{
    ExplorerDatabaseCategoryTreeItem *categoryItem = selectedDatabaseCategoryItem();
    if (!categoryItem)
        return;

    ExplorerDatabaseTreeItem *databaseItem = categoryItem->databaseItem();

    CreateUserDialog dlg(databaseItem->database()->server()->connectionRecord()->getFullAddress(),
                         databaseItem->database()->name());
    int result = dlg.exec();

    if (result == QDialog::Accepted) {

        MongoUser user = dlg.user();
        databaseItem->database()->createUser(user, false);

        // refresh list of users
        databaseItem->expandUsers();
    }
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:21,代码来源:ExplorerTreeWidget.cpp

示例12: ui_addUser

    void ExplorerDatabaseCategoryTreeItem::ui_addUser()
    {
        ExplorerDatabaseTreeItem *databaseItem = ExplorerDatabaseCategoryTreeItem::databaseItem();
        if (!databaseItem)
            return;

        float version = databaseItem->database()->server()->version();
        CreateUserDialog *dlg = NULL;

        if (version < MongoUser::minimumSupportedVersion) {
            dlg = new CreateUserDialog(QtUtils::toQString(databaseItem->database()->server()->connectionRecord()->getFullAddress()),
                QtUtils::toQString(databaseItem->database()->name()), MongoUser(version));
        }
        else {
            dlg = new CreateUserDialog(databaseItem->database()->server()->getDatabasesNames(), QtUtils::toQString(databaseItem->database()->server()->connectionRecord()->getFullAddress()),
            QtUtils::toQString(databaseItem->database()->name()), MongoUser(version));
        }

        int result = dlg->exec();
        if (result != QDialog::Accepted)
            return;

        MongoUser user = dlg->user();
        databaseItem->database()->createUser(user, false);
        // refresh list of users
        databaseItem->expandUsers();
    }
开发者ID:Bych,项目名称:robomongo,代码行数:27,代码来源:ExplorerDatabaseCategoryTreeItem.cpp

示例13: ui_createCollection

void ExplorerTreeWidget::ui_createCollection()
{
    ExplorerDatabaseCategoryTreeItem *categoryItem = selectedDatabaseCategoryItem();
    if (!categoryItem)
        return;

    ExplorerDatabaseTreeItem *databaseItem = categoryItem->databaseItem();
    if (!databaseItem)
        return;

    CreateDatabaseDialog dlg(databaseItem->database()->server()->connectionRecord()->getFullAddress(),
                             databaseItem->database()->name());
    dlg.setWindowTitle("Create Collection");
    dlg.setOkButtonText("&Create");
    dlg.setInputLabelText("Collection Name:");
    int result = dlg.exec();

    if (result == QDialog::Accepted) {
        databaseItem->database()->createCollection(dlg.databaseName());

        // refresh list of databases
        databaseItem->expandCollections();
    }
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:24,代码来源:ExplorerTreeWidget.cpp

示例14: ui_dbDrop

void ExplorerTreeWidget::ui_dbDrop()
{
    ExplorerDatabaseTreeItem *dbItem = selectedDatabaseItem();
    if (!dbItem)
        return;

    MongoDatabase *database = dbItem->database();
    MongoServer *server = database->server();

    // Ask user
    int answer = QMessageBox::question(this,
            "Drop Database",
            QString("Drop <b>%1</b> database?").arg(database->name()),
            QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton);

    if (answer != QMessageBox::Yes)
        return;

    server->dropDatabase(database->name());
    server->loadDatabases(); // refresh list of databases

    //openCurrentDatabaseShell("db.dropDatabase()", false);
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:23,代码来源:ExplorerTreeWidget.cpp


注:本文中的ExplorerDatabaseTreeItem::database方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。