Oracle OCIBindByPos() for out bind variables
Oracle OCIBindByPos() for out bind variables
有没有关于如何使用OCI绑定变量的好文档?我在绑定绑定变量时遇到问题。buf 在存储过程中与"OUT"变量绑定。
问题 1:是否需要为buf
预先分配内存?或者 OCI 可以做到这一点?
问题2:有没有办法知道buf
中存储了多少字节的字符?或者只是将其视为以 null 结尾的 C 字符串?
int pos;
char* buf;
size_t len;
int rc = OCIBindByPos( Stmt, &bind, errhp, pos, buf, len, SQLT_STR,
NULL, NULL, NULL, 0, NULL, OCI_DEFAULT );
问题 1:我需要为 buf 预分配内存吗?或者 OCI 可以做到这一点?是的,你当然需要。您需要使用 OCIHandle
OCIHandleAlloc((dvoid *)OCIEnv, (dvoid **)&OCIStmt, OCI_HTYPE_STMT, len,
(dvoid **)&buf);
问题 2:有没有办法知道 buf 中存储了多少字节的字符?或者只是将其视为以 null 结尾的 C 字符串?
在
OCIBindByPos
你告诉多少字节。
相关文章:
- POCO::PostgreSQL:如何将std::vector支持添加到`Binder::bind`
- IN, OUT, INOUT Parameters
- 即使使用调试编译标志,表达式也是"optimized out"
- C++双重释放或损坏(out)
- 将 out/in out 参数与 if/switch 的 init 语句一起使用
- boost::bind()类似的东西,但用于函数调用
- 使用 std::应用于 std::bind
- 在命令行上将输入显示到数组中时如何删除 ./a.out?
- PCL:当我在setConditionFunction中使用std::bind 时,没有合适的转换函数
- std::bind on statd::array 的运算符 []
- std::bind c++ in if statement
- std::bind 是否实现了 std::ref 和 std::cref 来消除函数调用的歧义?
- C++ 事件管理器的回调,使用 std::function 和 std:bind 以及派生类作为参数
- 为什么我的向量::擦除调用会抛出"vector subscript out of range"?
- 试图克服 std::bind 编译错误
- 解决方案在第 25 行执行错误'out of bounds'
- c++ std::bind within function
- std::bind to void* to std::function
- C++ 向量加减抛出"expression: vector subscript out of range."错误
- Oracle OCIBindByPos() for out bind variables