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


C++ DatabasePtr类代码示例

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


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

示例1: handleURI

bool PropertiesHandler::handleURI(URI& uri)
{
    if (uri.action != "properties")
        return false;

    MetadataItemPropertiesPanel* parent = dynamic_cast<
                                          MetadataItemPropertiesPanel*>(getParentWindow(uri));
    if (!parent)
        return true;
    DatabasePtr db = parent->getObservedObject()->getDatabase();
    if (!db)
        return true;
    NodeType n = getTypeByName(uri.getParam("object_type"));
    MetadataItem* object = db->findByNameAndType(n,
                           uri.getParam("object_name"));
    if (!object)
    {
        ::wxMessageBox(
            _("Cannot find destination object\nThis should never happen."),
            _("Error"), wxICON_ERROR);
        return true;
    }

    if (uri.getParam("target") == "new_tab")
    {
        MetadataItemPropertiesFrame::openNewPropertyPageInTab(object,
                parent->getParentFrame());
    }
    else if (uri.getParam("target") == "new")
        MetadataItemPropertiesFrame::openNewPropertyPageInFrame(object);
    else
        MetadataItemPropertiesFrame::showPropertyPage(object);
    return true;
}
开发者ID:cyborgve,项目名称:FlameRobin,代码行数:34,代码来源:MetadataItemPropertiesFrame.cpp

示例2: getQueryProcessingStage

QueryProcessingStage::Enum StorageMerge::getQueryProcessingStage(const Context & context) const
{
    auto stage_in_source_tables = QueryProcessingStage::FetchColumns;

    DatabasePtr database = context.getDatabase(source_database);
    DatabaseIteratorPtr iterator = database->getIterator(context);

    size_t selected_table_size = 0;

    while (iterator->isValid())
    {
        if (table_name_regexp.match(iterator->name()))
        {
            auto & table = iterator->table();
            if (table.get() != this)
            {
                ++selected_table_size;
                stage_in_source_tables = std::max(stage_in_source_tables, table->getQueryProcessingStage(context));
            }

        }

        iterator->next();
    }

    return selected_table_size == 1 ? stage_in_source_tables : std::min(stage_in_source_tables, QueryProcessingStage::WithMergeableState);
}
开发者ID:chipitsine,项目名称:ClickHouse,代码行数:27,代码来源:StorageMerge.cpp

示例3: getDatabase

void Exceptions::load(ProgressIndicator* progressIndicator)
{
    DatabasePtr db = getDatabase();
    MetadataLoader* loader = db->getMetadataLoader();
    MetadataLoaderTransaction tr(loader);
    wxMBConv* converter = db->getCharsetConverter();

    IBPP::Statement& st1 = loader->getStatement(
        Exception::getLoadStatement(true));

    CollectionType exceptions;
    st1->Execute();
    checkProgressIndicatorCanceled(progressIndicator);
    while (st1->Fetch())
    {
        if (!st1->IsNull(1))
        {
            std::string s;
            st1->Get(1, s);
            wxString name(std2wxIdentifier(s, converter));

            ExceptionPtr exception = findByName(name);
            if (!exception)
            {
                exception.reset(new Exception(db, name));
                initializeLockCount(exception, getLockCount());
            }
            exceptions.push_back(exception);
            exception->loadProperties(st1, converter);
        }
        checkProgressIndicatorCanceled(progressIndicator);
    }

    setItems(exceptions);
}
开发者ID:DragonZX,项目名称:flamerobin,代码行数:35,代码来源:exception.cpp

示例4: getDatabase

//! reads checks info from database
void Table::loadCheckConstraints()
{
    if (checkConstraintsLoadedM)
        return;
    checkConstraintsM.clear();

    DatabasePtr db = getDatabase();
    wxMBConv* conv = db->getCharsetConverter();
    MetadataLoader* loader = db->getMetadataLoader();
    // first start a transaction for metadata loading, then lock the table
    // when objects go out of scope and are destroyed, table will be unlocked
    // before the transaction is committed - any update() calls on observers
    // can possibly use the same transaction
    MetadataLoaderTransaction tr(loader);
    SubjectLocker lock(this);

    IBPP::Statement& st1 = loader->getStatement(
        "select r.rdb$constraint_name, t.rdb$trigger_source, d.rdb$field_name "
        " from rdb$relation_constraints r "
        " join rdb$check_constraints c on r.rdb$constraint_name=c.rdb$constraint_name and r.rdb$constraint_type = 'CHECK'"
        " join rdb$triggers t on c.rdb$trigger_name=t.rdb$trigger_name and t.rdb$trigger_type = 1 "
        " left join rdb$dependencies d on t.rdb$trigger_name = d.rdb$dependent_name "
        "      and d.rdb$depended_on_name = r.rdb$relation_name "
        "      and d.rdb$depended_on_type = 0 "
        " where r.rdb$relation_name=? "
        " order by 1 "
    );

    st1->Set(1, wx2std(getName_(), conv));
    st1->Execute();
    CheckConstraint *cc = 0;
    while (st1->Fetch())
    {
        std::string s;
        st1->Get(1, s);
        wxString cname(std2wxIdentifier(s, conv));
        if (!cc || cname != cc->getName_()) // new constraint
        {
            wxString source;
            readBlob(st1, 2, source, conv);

            CheckConstraint c;
            c.setParent(this);
            c.setName_(cname);
            c.sourceM = source;
            checkConstraintsM.push_back(c);
            cc = &checkConstraintsM.back();
        }

        if (!st1->IsNull(3))
        {
            st1->Get(3, s);
            wxString fname(std2wxIdentifier(s, conv));
            cc->columnsM.push_back(fname);
        }
    }
    checkConstraintsLoadedM = true;
}
开发者ID:DragonZX,项目名称:flamerobin,代码行数:59,代码来源:table.cpp

示例5: config

//! determine the path, load and display html page
void MetadataItemPropertiesPanel::loadPage()
{
    wxString fileName = config().getHtmlTemplatesPath();
    switch (pageTypeM)
    {
    case ptSummary:
        fileName += objectM->getTypeName() + ".html";
        break;
    case ptConstraints:
        fileName += objectM->getTypeName() + "constraints.html";
        break;
    case ptTriggers:
        fileName += objectM->getTypeName() + "triggers.html";
        break;
    case ptPrivileges:
        fileName += objectM->getTypeName() + "privileges.html";
        break;
    case ptTableIndices:
        fileName += "TABLEindices.html";
        break;
    case ptDependencies:
        fileName += "dependencies.html";
        break;
    case ptDDL:
        fileName += "DDL.html";
        break;
    }

    wxBusyCursor bc;

    // start a transaction for metadata loading and lock the object
    DatabasePtr db = objectM->getDatabase();
    MetadataLoaderTransaction tr((db) ? db->getMetadataLoader() : 0);
    SubjectLocker lock(objectM);

    ProgressDialog pd(this, _("Processing template..."));
    pd.doShow();

    wxString htmlpage;
    HtmlTemplateProcessor tp(objectM, this);
    tp.processTemplateFile(htmlpage, fileName, 0, &pd);

    pd.SetTitle(_("Rendering page..."));

    wxWindowUpdateLocker freeze(html_window);
    int x = 0, y = 0;
    html_window->GetViewStart(&x, &y);         // save scroll position
    html_window->setPageSource(htmlpage);
    html_window->Scroll(x, y);                 // restore scroll position

    // set title
    if (MetadataItemPropertiesFrame* pf = getParentFrame())
    {
        pf->setTabTitle(this, objectM->getName_() + ": "
                        + html_window->GetOpenedPageTitle());
    }
}
开发者ID:cyborgve,项目名称:FlameRobin,代码行数:58,代码来源:MetadataItemPropertiesFrame.cpp

示例6: OnContextChanged

void ScheduleBroadcastCmd::OnContextChanged()
{
    if ( m_spContext != NULL )
    {
        DatabasePtr spDatabase = m_spContext->GetDatabase();

        // Get broadcast by ID
        m_spBroadcast = spDatabase->GetBroadcast( m_u32BroadcastID );
    }
    else
    {
        m_spBroadcast = BroadcastPtr();
    }
}
开发者ID:coeing,项目名称:cframework,代码行数:14,代码来源:ScheduleBroadcastCmd.cpp

示例7: tryGetDatabase

DatabaseAndTable InterpreterDropQuery::tryGetDatabaseAndTable(String & database_name, String & table_name, bool if_exists)
{
    DatabasePtr database = tryGetDatabase(database_name, if_exists);

    if (database)
    {
        StoragePtr table = database->tryGetTable(context, table_name);
        if (!table && !if_exists)
            throw Exception("Table " + backQuoteIfNeed(database_name) + "." + backQuoteIfNeed(table_name) + " doesn't exist.",
                            ErrorCodes::UNKNOWN_TABLE);

        return {std::move(database), std::move(table)};
    }
    return {};
}
开发者ID:greck2908,项目名称:ClickHouse,代码行数:15,代码来源:InterpreterDropQuery.cpp

示例8: AdminRouter

IceGrid::RegistryReplicaAdminRouter::RegistryReplicaAdminRouter(const string& name,
                                                                const DatabasePtr& database) :
    AdminRouter(database->getTraceLevels()),
    _name(name),
    _database(database)
{
}
开发者ID:yuanbaopapa,项目名称:ice,代码行数:7,代码来源:RegistryAdminRouter.cpp

示例9:

	/* static */
	InstanceKeyPtrSetPtr D3DatabasePermissionBase::GetAll(DatabasePtr pDB)
	{
		DatabasePtr		pDatabase = pDB;


		if (!pDatabase)
			return NULL;

		if (pDatabase->GetMetaDatabase() != MetaDatabase::GetMetaDatabase("D3MDDB"))
			pDatabase = pDatabase->GetDatabaseWorkspace()->GetDatabase(MetaDatabase::GetMetaDatabase("D3MDDB"));

		if (!pDatabase)
			return NULL;

		return pDatabase->GetMetaDatabase()->GetMetaEntity(D3MDDB_D3DatabasePermission)->GetPrimaryMetaKey()->GetInstanceKeySet(pDatabase);
	}
开发者ID:petehug,项目名称:D3,代码行数:17,代码来源:D3DatabasePermissionBase.cpp

示例10: databaseName

RestoreFrame::RestoreFrame(wxWindow* parent, DatabasePtr db)
    : BackupRestoreBaseFrame(parent, db)
{
    setIdString(this, getFrameId(db));

    wxString databaseName(db->getName_());
    wxString serverName(db->getServer()->getName_());
    SetTitle(wxString::Format(_("Restore Database \"%s:%s\""),
        serverName.c_str(), databaseName.c_str()));

    createControls();
    layoutControls();
    updateControls();

    text_ctrl_filename->SetFocus();
}
开发者ID:AlfiyaZi,项目名称:flamerobin,代码行数:16,代码来源:RestoreFrame.cpp

示例11: getThreadRunning

void RestoreFrame::updateControls()
{
    bool running = getThreadRunning();
    button_browse->Enable(!running);
    text_ctrl_filename->Enable(!running);
    checkbox_replace->Enable(!running);
    checkbox_deactivate->Enable(!running);
    checkbox_noshadow->Enable(!running);
    checkbox_validity->Enable(!running);
    checkbox_commit->Enable(!running);
    checkbox_space->Enable(!running);
    choice_pagesize->Enable(!running);
    DatabasePtr db = getDatabase();
    button_start->Enable(!running && !text_ctrl_filename->GetValue().empty()
        && db && !db->isConnected());
}
开发者ID:AlfiyaZi,项目名称:flamerobin,代码行数:16,代码来源:RestoreFrame.cpp

示例12: FileCache

InternalRegistryI::InternalRegistryI(const RegistryIPtr& registry,
                                     const DatabasePtr& database, 
                                     const ReapThreadPtr& reaper,
                                     const WellKnownObjectsManagerPtr& wellKnownObjects,
                                     ReplicaSessionManager& session) : 
    _registry(registry),
    _database(database),
    _reaper(reaper),
    _wellKnownObjects(wellKnownObjects),
    _fileCache(new FileCache(database->getCommunicator())),
    _session(session)
{
    Ice::PropertiesPtr properties = database->getCommunicator()->getProperties();
    _nodeSessionTimeout = properties->getPropertyAsIntWithDefault("IceGrid.Registry.NodeSessionTimeout", 30);
    _replicaSessionTimeout = properties->getPropertyAsIntWithDefault("IceGrid.Registry.ReplicaSessionTimeout", 30);
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:16,代码来源:InternalRegistryI.cpp

示例13: getFrameId

/*static*/
wxString RestoreFrame::getFrameId(DatabasePtr db)
{
    if (db)
        return wxString("RestoreFrame/" + db->getItemPath());
    else
        return wxEmptyString;
}
开发者ID:AlfiyaZi,项目名称:flamerobin,代码行数:8,代码来源:RestoreFrame.cpp

示例14: getFrameId

wxString EventWatcherFrame::getFrameId(DatabasePtr db)
{
    if (db)
        return wxString("EventWatcherFrame/" + db->getItemPath());
    else
        return wxEmptyString;
}
开发者ID:AlfiyaZi,项目名称:flamerobin,代码行数:7,代码来源:EventWatcherFrame.cpp

示例15: tablesRelate

// find all tables from "tables" which have foreign keys with "table"
// and return them in "list"
bool Table::tablesRelate(const std::vector<wxString>& tables, Table* table,
                          std::vector<ForeignKey>& list)
{
    // see if "table" references some of the "tables"
    std::vector<ForeignKey> *fks = table->getForeignKeys();
    for (std::vector<ForeignKey>::iterator it = fks->begin(); it != fks->end(); ++it)
    {
        ForeignKey& fk = (*it);
        for (std::vector<wxString>::const_iterator i2 = tables.begin(); i2 != tables.end(); ++i2)
            if ((*i2) == fk.referencedTableM)
                list.push_back(fk);
    }

    // see if some of the "tables" reference the "table"
    std::vector<Dependency> deplist;
    table->getDependencies(deplist, false);
    for (std::vector<Dependency>::iterator it = deplist.begin(); it != deplist.end(); ++it)
    {
        if ((*it).getType() == ntTable)
        {
            for (std::vector<wxString>::const_iterator i2 = tables.begin(); i2 != tables.end(); ++i2)
            {
                if ((*i2) == (*it).getName_())
                {
                    // find foreign keys for that table
                    DatabasePtr db = table->getDatabase();
                    Table* other_table = dynamic_cast<Table*>(db->findByNameAndType(ntTable, (*i2)));
                    if (!other_table)
                        break;

                    std::vector<ForeignKey>* fks = other_table->getForeignKeys();
                    for (std::vector<ForeignKey>::iterator it = fks->begin(); it != fks->end(); ++it)
                    {
                        ForeignKey& fk = (*it);
                        if (table->getName_() == fk.referencedTableM)
                        {
                            list.push_back(fk);
                            break;  // no need for more
                        }
                    }
                }
            }
        }
    }

    return !list.empty();
}
开发者ID:DragonZX,项目名称:flamerobin,代码行数:49,代码来源:table.cpp


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