Function: sql-send-string
sql-send-string is an interactive and byte-compiled function defined
in sql.el.gz.
Signature
(sql-send-string STR)
Documentation
Send the string STR to the SQL process.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/sql.el.gz
(defun sql-send-string (str)
"Send the string STR to the SQL process."
(interactive "sSQL Text: ")
(let ((comint-input-sender-no-newline nil)
(s (replace-regexp-in-string "[[:space:]\n\r]+\\'" "" str)))
(if (sql-buffer-live-p sql-buffer)
(progn
;; Ignore the hoping around...
(save-excursion
;; Set product context
(with-current-buffer sql-buffer
;; Make sure point is at EOB before sending input to SQL.
(goto-char (point-max))
(when sql-debug-send
(message ">>SQL> %S" s))
(insert "\n")
(comint-set-process-mark)
;; Send the string (trim the trailing whitespace)
(sql-input-sender (get-buffer-process (current-buffer)) s)
;; Send a command terminator if we must
(sql-send-magic-terminator sql-buffer s sql-send-terminator)
(when sql-pop-to-buffer-after-send-region
(message "Sent string to buffer %s" sql-buffer))))
;; Display the sql buffer
(sql-display-buffer sql-buffer))
;; We don't have no stinkin' sql
(user-error "No SQL process started"))))