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


C++ URI::getParam方法代码示例

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


在下文中一共展示了URI::getParam方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: handleURI

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

    wxString type = uri.getParam("type");    // pk, fk, check, unique
    Table* t = extractMetadataItemFromURI<Table>(uri);
    wxWindow* w = getParentWindow(uri);
    if (!t || !w)
        return true;

    // Find first available constraint name:
    DatabasePtr db = t->getDatabase();
    wxString prefix = type + "_" + t->getName_();
    wxString stmt(
        "select rdb$constraint_name from rdb$relation_constraints "
        "where rdb$relation_name = '" + t->getName_() +
        "' and rdb$constraint_name starting with '" + prefix +
        "' order by 1");
    wxString default_value;
    wxArrayString constraintNames(db->loadIdentifiers(stmt));
    for (int i = 0; ; ++i)
    {
        default_value = prefix + wxString::Format("_%d", i);
        if (constraintNames.Index(default_value, false) == wxNOT_FOUND)
            break;
    }

    wxString cname = ::wxGetTextFromUser(_("Enter constraint name"),
        _("Adding new table constraint"), default_value, w);
    if (cname.IsEmpty())    // cancel
        return true;

    wxString sql = "alter table " + t->getQuotedName() +
            "\nadd constraint " + Identifier::userString(cname);

    if (type == "PK")
    {
        wxString columnlist = selectRelationColumns(t, w);
        if (columnlist.IsEmpty())   // cancel
            return true;
        sql += "\nprimary key (" + columnlist + ")";
    }
    else if (type == "FK")
    {
        wxString columnlist = selectRelationColumns(t, w);
        if (columnlist == "")
            return true;
        TablePtr ref = selectTable(t->getDatabase(), w);
        if (!ref)
            return true;
        wxString refcolumnlist = selectRelationColumns(ref.get(), w);
        if (refcolumnlist == "")
            return true;
        sql += "\nforeign key (" + columnlist + ") \nreferences " + ref->getQuotedName()
            + " (" + refcolumnlist + ")";
        wxString action = selectAction(_("update"), w);
        if (action == "CANCEL")
            return true;
        else if (action != "RESTRICT")
            sql += "\non update " + action + " ";

        action = selectAction(_("delete"), w);
        if (action == "CANCEL")
            return true;
        else if (action != "RESTRICT")
            sql += "\non delete " + action + " ";
    }
    else if (type == "CHK")
    {
        wxString source;
        if (!GetMultilineTextFromUser(w, _("Enter check condition"), source))
            return true;
        sql += "\ncheck (" + source + ")";
    }
    else if (type == "UNQ")
    {
        wxString columnlist = selectRelationColumns(t, w);
        if (columnlist.IsEmpty())   // cancel
            return true;
        sql += "\nunique (" + columnlist + ")";
    }
    else
    {
        ::wxMessageBox(_("Unknown constraint type"), _("Error."), wxOK | wxICON_ERROR);
        return true;
    }

    execSql(w, "", db, sql, true);  // true = commit + close at once
    return true;
}
开发者ID:AlfiyaZi,项目名称:flamerobin,代码行数:91,代码来源:addconstrainthandler.cpp


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