通过libcouchbase-cxx发出准备好的/参数化的查询

Issuing prepared/parameterized queries through libcouchbase-cxx

本文关键字:参数 查询 准备好 libcouchbase-cxx 通过      更新时间:2023-10-16

我是全新的couchbase,我正在开发一个客户端,需要通过c++客户端库(https://github.com/couchbaselabs/libcouchbase-cxx)发出准备/参数化的n1ql查询。发出静态查询很简单,但是我还没有找到发出准备好的查询的正确过程。有人能做到吗?

下面的文档/示例展示了如何使用准备好的stmt。

http://developer.couchbase.com/documentation/server/4.5/sdk/c/n1ql-queries-with-sdk.htmlhttps://github.com/couchbaselabs/devguide - examples/blob/server 4.5 -/- c/query placeholders.cc

// To enable using prepared (optimized) statements, you can use
// the LCB_CMDN1QL_F_PREPCACHE flag. This is equivalent to setting
// 'adhoc=False' in other SDKs
cmd.cmdflags |= LCB_CMDN1QL_F_PREPCACHE;
rc = lcb_n1p_mkcmd(params, &cmd);
rc = lcb_n1ql_query(instance, &rows, &cmd);
lcb_wait(instance);

普拉萨德