本文整理汇总了C++中BlobImpl::SetId方法的典型用法代码示例。如果您正苦于以下问题:C++ BlobImpl::SetId方法的具体用法?C++ BlobImpl::SetId怎么用?C++ BlobImpl::SetId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlobImpl
的用法示例。
在下文中一共展示了BlobImpl::SetId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetValue
//.........这里部分代码省略.........
else if (ivType == ivFloat)
{
// This SQL_INT64 is a NUMERIC(x,y), scale it !
double divisor = consts::dscales[-var->sqlscale];
mFloats[varnum-1] = (float)(*(int64_t*)var->sqldata / divisor);
value = &mFloats[varnum-1];
}
else if (ivType == ivDouble)
{
// This SQL_INT64 is a NUMERIC(x,y), scale it !
double divisor = consts::dscales[-var->sqlscale];
mNumerics[varnum-1] = *(int64_t*)var->sqldata / divisor;
value = &mNumerics[varnum-1];
}
else throw WrongTypeImpl("RowImpl::GetValue", var->sqltype, ivType,
_("Incompatible types."));
break;
case SQL_FLOAT :
if (ivType != ivFloat)
throw WrongTypeImpl("RowImpl::GetValue", var->sqltype, ivType,
_("Incompatible types."));
value = var->sqldata;
break;
case SQL_DOUBLE :
if (ivType != ivDouble)
throw WrongTypeImpl("RowImpl::GetValue", var->sqltype, ivType,
_("Incompatible types."));
if (var->sqlscale != 0)
{
// Round to scale y of NUMERIC(x,y)
double multiplier = consts::dscales[-var->sqlscale];
mNumerics[varnum-1] =
floor(*(double*)var->sqldata * multiplier + 0.5) / multiplier;
value = &mNumerics[varnum-1];
}
else value = var->sqldata;
break;
case SQL_TIMESTAMP :
if (ivType != ivTimestamp)
throw WrongTypeImpl("RowImpl::SetValue", var->sqltype, ivType,
_("Incompatible types."));
decodeTimestamp(*(IBPP::Timestamp*)retvalue, *(ISC_TIMESTAMP*)var->sqldata);
value = retvalue;
break;
case SQL_TYPE_DATE :
if (ivType != ivDate)
throw WrongTypeImpl("RowImpl::SetValue", var->sqltype, ivType,
_("Incompatible types."));
decodeDate(*(IBPP::Date*)retvalue, *(ISC_DATE*)var->sqldata);
value = retvalue;
break;
case SQL_TYPE_TIME :
if (ivType != ivTime)
throw WrongTypeImpl("RowImpl::SetValue", var->sqltype, ivType,
_("Incompatible types."));
decodeTime(*(IBPP::Time*)retvalue, *(ISC_TIME*)var->sqldata);
value = retvalue;
break;
case SQL_BLOB :
if (ivType == ivBlob)
{
BlobImpl* blob = (BlobImpl*)retvalue;
blob->SetId((ISC_QUAD*)var->sqldata);
value = retvalue;
}
else if (ivType == ivString)
{
BlobImpl blob(mDatabase, mTransaction);
blob.SetId((ISC_QUAD*)var->sqldata);
std::string* str = (std::string*)retvalue;
blob.Load(*str);
value = retvalue;
}
else throw WrongTypeImpl("RowImpl::GetValue", var->sqltype, ivType,
_("Incompatible types."));
break;
case SQL_ARRAY :
if (ivType != ivArray)
throw WrongTypeImpl("RowImpl::GetValue", var->sqltype, ivType,
_("Incompatible types."));
{
ArrayImpl* array = (ArrayImpl*)retvalue;
array->SetId((ISC_QUAD*)var->sqldata);
value = retvalue;
}
break;
default : throw LogicExceptionImpl("RowImpl::GetValue",
_("Found an unknown sqltype !"));
}
return value;
}