本文整理汇总了C++中NValue::getObjectValue方法的典型用法代码示例。如果您正苦于以下问题:C++ NValue::getObjectValue方法的具体用法?C++ NValue::getObjectValue怎么用?C++ NValue::getObjectValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NValue
的用法示例。
在下文中一共展示了NValue::getObjectValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: result
static std::string peekStringCopy(const NValue value) {
assert((value.getValueType() == VALUE_TYPE_VARCHAR) ||
(value.getValueType() == VALUE_TYPE_VARBINARY));
std::string result(reinterpret_cast<const char*>(value.getObjectValue()),
value.getObjectLength());
return result;
}
示例2: 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();
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();
}