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


C++ NValue::getObjectValue_withoutNull方法代码示例

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


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

示例1: inList

/**
 * This NValue can be of any scalar value type.
 * @param rhs  a VALUE_TYPE_ARRAY NValue whose referent must be an NValueList.
 *             The NValue elements of the NValueList should be comparable to and ideally
 *             of exactly the same VALUE_TYPE as "this".
 * The planner and/or deserializer should have taken care of this with checks and
 * explicit cast operators and and/or constant promotions as needed.
 * @return a VALUE_TYPE_BOOLEAN NValue.
 */
bool NValue::inList(const NValue& rhs) const
{
    //TODO: research: does the SQL standard allow a null to match a null list element
    // vs. returning FALSE or NULL?
    const bool lhsIsNull = isNull();
    if (lhsIsNull) {
        return false;
    }

    const ValueType rhsType = rhs.getValueType();
    if (rhsType != VALUE_TYPE_ARRAY) {
        throwDynamicSQLException("rhs of IN expression is of a non-list type %s", rhs.getValueTypeString().c_str());
    }
    const NValueList* listOfNValues = (NValueList*)rhs.getObjectValue_withoutNull();
    const StlFriendlyNValue& value = *static_cast<const StlFriendlyNValue*>(this);
    //TODO: An O(ln(length)) implementation vs. the current O(length) implementation
    // such as binary search would likely require some kind of sorting/re-org of values
    // post-update/pre-lookup, and would likely require some sortable inequality method
    // (operator<()?) to be defined on StlFriendlyNValue.
    return std::find(listOfNValues->begin(), listOfNValues->end(), value) != listOfNValues->end();
}
开发者ID:DarkDare,项目名称:voltdb,代码行数:30,代码来源:NValue.cpp


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