17 #ifndef LCB_N1QL_API_H
18 #define LCB_N1QL_API_H
20 #include <libcouchbase/api3.h>
38 typedef struct lcb_N1QLREQ* lcb_N1QLHANDLE;
98 #define LCB_N1P_QUERY_STATEMENT 1
101 #define LCB_N1P_QUERY_PREPARED 2
115 #define lcb_n1p_setstmtz(params, qstr) \
116 lcb_n1p_setquery(params, qstr, -1, LCB_N1P_QUERY_STATEMENT)
129 const char *value,
size_t n_value);
131 #define lcb_n1p_namedparamz(params, name, value) \
132 lcb_n1p_namedparam(params, name, -1, value, -1)
155 const char *value,
size_t n_value);
163 #define lcb_n1p_setoptz(params, key, value) \
164 lcb_n1p_setopt(params, key, -1, value, -1)
168 #define LCB_N1P_CONSISTENCY_NONE 0
175 #define LCB_N1P_CONSISTENCY_RYOW 1
178 #define LCB_N1P_CONSISTENCY_REQUEST 2
181 #define LCB_N1P_CONSISTENCY_STATEMENT 3
259 #define LCB_CMDN1QL_F_PREPCACHE 1<<16
262 #define LCB_CMDN1QL_F_JSONQUERY 1<<17
310 #ifndef __LCB_DOXYGEN__
lcb_error_t lcb_n1p_posparam(lcb_N1QLPARAMS *params, const char *value, size_t n_value)
Adds a positional argument for the query.
const char * content_type
Ignored since version 2.5.3.
Definition: n1ql.h:294
Response for a N1QL query.
Definition: n1ql.h:309
const char * row
Current result row.
Definition: n1ql.h:321
lcb_N1QLHANDLE * handle
Request handle.
Definition: n1ql.h:301
lcb_N1QLCALLBACK callback
Callback to be invoked for each row.
Definition: n1ql.h:297
Main header file for Couchbase.
size_t nquery
Length of the query data.
Definition: n1ql.h:288
const lcb_RESPHTTP * htresp
Raw HTTP response, if applicable.
Definition: n1ql.h:325
void lcb_n1p_reset(lcb_N1QLPARAMS *params)
Reset the parameters structure so that it may be reused for a subsequent query.
lcb_N1QLPARAMS * lcb_n1p_new(void)
Create a new N1QL Parameters object.
void lcb_n1ql_cancel(lcb_t instance, lcb_N1QLHANDLE handle)
Cancels an in-progress request.
lcb_error_t lcb_n1p_setconsistency(lcb_N1QLPARAMS *params, int mode)
Sets the consistency mode for the request.
Structure representing a synchronization token.
Definition: couchbase.h:577
Command structure for N1QL queries.
Definition: n1ql.h:271
lcb_error_t lcb_n1p_namedparam(lcb_N1QLPARAMS *params, const char *name, size_t n_name, const char *value, size_t n_value)
Sets a named argument for the query.
Structure for HTTP responses.
Definition: couchbase.h:2439
lcb_error_t lcb_n1p_setquery(lcb_N1QLPARAMS *params, const char *qstr, size_t nqstr, int type)
Sets the actual statement to be executed.
const char * host
Ignored since version 2.5.3.
Definition: n1ql.h:291
struct lcb_st * lcb_t
Library handle representing a connection to a data bucket.
Definition: couchbase.h:41
lcb_error_t lcb_n1p_setopt(lcb_N1QLPARAMS *params, const char *name, size_t n_name, const char *value, size_t n_value)
Set a query option.
lcb_error_t
Error codes returned by the library.
Definition: error.h:506
#define LCB_RESP_BASE
Response specific flags.
Definition: couchbase.h:539
void(* lcb_N1QLCALLBACK)(lcb_t, int, const lcb_RESPN1QL *)
Callback to be invoked for each row.
Definition: n1ql.h:46
struct lcb_N1QLPARAMS_st lcb_N1QLPARAMS
Opaque object representing N1QL parameters.
Definition: n1ql.h:66
const char * lcb_n1p_encode(lcb_N1QLPARAMS *params, lcb_error_t *rc)
Encodes the request and returns it as a string.
lcb_error_t lcb_n1p_setconsistent_handle(lcb_N1QLPARAMS *params, lcb_t instance)
Indicate that the query should synchronize its internal snapshot to reflect any past changes made by ...
size_t nrow
Length of the row.
Definition: n1ql.h:323
lcb_error_t lcb_n1p_setconsistent_token(lcb_N1QLPARAMS *params, const char *keyspace, const lcb_MUTATION_TOKEN *st)
Indicate that the query should synchronize its internal snapshot to reflect the changes indicated by ...
const char * query
Query to be placed in the POST request.
Definition: n1ql.h:285
lcb_U16 rflags
Flags for response structure.
Definition: n1ql.h:313
void lcb_n1p_free(lcb_N1QLPARAMS *params)
Free the parameters structure.
lcb_error_t lcb_n1p_mkcmd(lcb_N1QLPARAMS *params, lcb_CMDN1QL *cmd)
Populates the given low-level lcb_CMDN1QL structure with the relevant fields from the params structur...
lcb_error_t lcb_n1ql_query(lcb_t instance, const void *cookie, const lcb_CMDN1QL *cmd)