Uploaded image for project: 'Couchbase C client library libcouchbase'
  1. Couchbase C client library libcouchbase
  2. CCBC-1450

lcb_cmdquery_positional_param aborting when the parameter is not a JSON array

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 3.2.0
    • 3.2.1
    • library
    • None
    • Ubuntu 20.04
    • 1
    • High

    Description

      In 3.2.0 the code for lcb_CMDQUERY_::option_array (called by lcb_cmdquery_positional_param) now makes the following check:

      if (json_value.type() != Json::ValueType::arrayValue) {
       return LCB_ERR_INVALID_ARGUMENT;
      }

      I do not think the parameter has to be an array (the documentation - https://docs.couchbase.com/sdk-api/couchbase-c-client/group__lcb-n1ql-api.html#ga6ff035fe7dee2bc0171d318f5fe4c6c1- does not require it). Furthermore, the example given in 3.2.0 documentation itself does not use an array (see https://docs.couchbase.com/sdk-api/couchbase-c-client/example_2minimal_2query_8c-example.html#a26):

      const char *param = "\"African Swallows\"";
      lcb_cmdquery_create(&cmd);
       
      snprintf(query, sizeof(query), "SELECT * FROM `%s` WHERE $1 in interests LIMIT 1", bucket);
      check(lcb_cmdquery_statement(cmd, query, strlen(query)), "set QUERY statement");
      check(lcb_cmdquery_positional_param(cmd, param, strlen(param)), "set QUERY positional parameter");
      

      Or do I misunderstand something?

      As usual, thanks a lot.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            There are no comments yet on this issue.

            People

              avsej Sergey Avseyev
              vincent.lextrait Vincent Lextrait
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty