Ejemplo n.º 1
0
lcb_error_t
lcb_n1p_setquery(lcb_N1QLPARAMS *params,
                 const char *qstr, size_t nqstr, int type)
{
    if (type == LCB_N1P_QUERY_STATEMENT) {
        return lcb_n1p_setopt(params, "statement", -1, qstr, nqstr);
    } else if (type == LCB_N1P_QUERY_PREPARED) {
        return lcb_n1p_setopt(params, "prepared", -1, qstr, nqstr);
    } else {
        return LCB_EINVAL;
    }
}
Ejemplo n.º 2
0
static lcb_error_t
finalize_field(lcb_N1QLPARAMS *params, lcb_string *ss,
    const char *field, const char *term)
{
    if (ss->nused == 0) {
        return LCB_SUCCESS;
    }
    if (-1 == lcb_string_append(ss, term, 1)) {
        return LCB_CLIENT_ENOMEM;
    }
    return lcb_n1p_setopt(params, field, -1, ss->base, ss->nused);
}
Ejemplo n.º 3
0
lcb_error_t
lcb_n1p_namedparam(lcb_N1QLPARAMS *params,
                   const char *name, size_t nname, const char *value, size_t nvalue)
{
    return lcb_n1p_setopt(params, name, nname, value, nvalue);
}