C++驱动程序中 Blob 类型的映射
Mapping of Blob type in C++Driver
根据"datastax.github.io/cpp-driver/topics/basics/",Cassandra 的 blob 数据类型与 'const cass_byte_t*' 匹配。 假设数据库包含以 blob 形式保存的结构;我怎么能取它。有人建议我使用 cass_value_get_bytes((。 任何人都可以举例说明如何使用此函数来获取结构吗?
cass_value_get_bytes()
有什么问题?您只需要对读取到结构的数据进行强制转换,如下所示:
const cass_byte_t* outPtr = null;
size_t outSize = 0;
if (cass_value_get_bytes(casValue, &outPtr, &outSize) == CASS_OK) {
if (outSize == sizeof(YourStruct)) {
const YourStruct* yourStruct = reinterpret_cast<const YourStruct*>(outPtr);
}
}
相关文章:
- 值到类型的运行时映射
- 拥有映射的现代方法,该映射可以指向或引用已在堆栈上分配的不同类型的数据
- 如何将高维数据映射到特征类型?
- 如何使映射键具有两种不同的数据类型?
- 值和类型的简洁双向静态 1:1 映射
- 当 map 是一个整数数组并且由 operator[] 创建时,它是否初始化其映射类型
- 编译按映射类型获取元素的映射错误元组
- 模板.参数包扩展 - 重映射类型
- C++函数来返回基于参数的比较器通用映射类型?
- ATL ActiveX DLL 作为映射类型图像和数据加载了两次
- 如何在 C++ 中获取映射类型指针,映射
- 映射类型为的队列容器
- 如何使用boost::mutex作为std::map中的映射类型
- 正向声明映射的映射类型和C++11
- std::map何时调用映射类型的构造函数
- 基于映射类型c++解析和转换csv
- 模板类的映射类型签名(声明)
- c++映射类型的属性
- 使用映射类型会产生GCC错误:预期的未限定id在' for '之前
- 在 EIGEN 中单独声明和初始化映射类型矩阵