Function: sqlind-syntax-in-insert
sqlind-syntax-in-insert is a natively compiled function defined in
sql-indent.el.
Signature
(sqlind-syntax-in-insert POS START)
Documentation
Return the syntax at POS which is inside an "insert" statement at START.
Source Code
;; Defined in /nix/store/jxjf2h9nnkdqnn1w1mr0ag8bqng2rlrs-emacs-packages-deps/share/emacs/site-lisp/elpa/sql-indent-1.7/sql-indent.el
(defun sqlind-syntax-in-insert (pos start)
"Return the syntax at POS which is inside an \"insert\" statement at START."
;; The insert clause is really easy since it has the form insert into TABLE
;; (COLUMN_LIST) values (VALUE_LIST) or insert into TABLE select
;; SELECT_CLAUSE
;;
;; note that we will never be called when point is in COLUMN_LIST or
;; VALUE_LIST, as that is a nested-statement-continuation which starts with
;; the open paranthesis.
;;
;; if we are inside the SELECT_CLAUSE, we delegate the syntax to
;; `sqlind-syntax-in-select'
(save-excursion
(catch 'finished
(goto-char pos)
;; all select query components are indented relative to the
;; start of the select statement)
(when (looking-at sqlind-insert-clauses-regexp)
(throw 'finished (cons 'insert-clause start)))
(while (re-search-backward sqlind-insert-clauses-regexp start t)
(let* ((match-pos (match-beginning 0))
(clause (sqlind-match-string 0)))
(setq clause (replace-regexp-in-string "[ \t\r\n\f]" " " clause))
(when (sqlind-same-level-statement (point) start)
(throw 'finished
(if (looking-at "select")
(sqlind-syntax-in-select pos match-pos)
(cons (list 'in-insert-clause clause) match-pos)))))))))