Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-11766

Document general purpose EVALUATE() function

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • Morpheus
    • Morpheus
    • query
    • None
    • 0

    Description

      An new utility function has been added.

      EVALUATE(statement[,params])

      Arguments:

      statement

      String containing the statement to evaluate.

      params

      The statement parameters as either:

      • An object containing named parameters
      • An array containing positional parameters

       

      The statement is evaluated with the same rights as the invoking statement.  The results are an array and can be used anywhere an array is permitted in a statement.  The statement must be read-only (error 5010, "not a readonly request" raised if not).

      CAUTION: The results are materialised in memory so large result sets will have large memory requirements.  Request quota may be used to constrain memory use (the evaluated statement operates within the invoking statement's quota).

      Examples:

       

      SELECT evaluate("SELECT $named_param AS example",{"named_param":"This is the named parameter's value"}) eval_result;
      ...
          "results": [
          {
              "eval_result": [
                  {
                      "example": "This is the named parameter's value"
                  }
              ]
          }
          ],
      ...
      

       

       

      SELECT `Flavor` FROM evaluate("INFER `travel-sample`")[0] inf;
      ...
          "results": [
          {
              "Flavor": "`type` = \"airport\""
          },
          {
              "Flavor": "`stops` = 0, `type` = \"route\""
          },
          {
              "Flavor": "`type` = \"landmark\""
          },
          {
              "Flavor": "`type` = \"hotel\""
          },
          {
              "Flavor": "`type` = \"airline\""
          }
          ],
      ...
      

       

       

      Attachments

        Issue Links

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

          Activity

            People

              simon.dew Simon Dew
              Donald.haggart Donald Haggart
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty