Function: emacsql--get-op-info

emacsql--get-op-info is a byte-compiled function defined in emacsql-compiler.el.

Signature

(emacsql--get-op-info OP ARGUMENT-COUNT PARENT-PRECEDENCE-VALUE)

Documentation

Lookup SQL operator information for generating an SQL expression.

Returns the following multiple values when an operator can be identified: a format string (see emacsql--expand-format-string) and a precedence value. If PARENT-PRECEDENCE-VALUE is greater or equal to the identified operator's precedence, then the format string returned is wrapped with parentheses.

Source Code

;; Defined in ~/.emacs.d/elpa/emacsql-20261001.1544/emacsql-compiler.el
(defun emacsql--get-op-info (op argument-count parent-precedence-value)
  "Lookup SQL operator information for generating an SQL expression.
Returns the following multiple values when an operator can be
identified: a format string (see `emacsql--expand-format-string')
and a precedence value.  If PARENT-PRECEDENCE-VALUE is greater or
equal to the identified operator's precedence, then the format
string returned is wrapped with parentheses."
  (cl-destructuring-bind (format-string arity precedence-value)
      (emacsql--get-op op argument-count)
    (let ((expanded-format-string
           (emacsql--expand-format-string
            op
            format-string
            arity
            argument-count)))
      (cl-values (cond
                  ((null format-string) nil)
                  ((>= parent-precedence-value
                       precedence-value)
                   (format "(%s)" expanded-format-string))
                  (t expanded-format-string))
                 precedence-value))))