Function: sql-redirect

sql-redirect is a byte-compiled function defined in sql.el.gz.

Signature

(sql-redirect SQLBUF COMMAND &optional OUTBUF SAVE-PRIOR)

Documentation

Execute the SQL command and send output to OUTBUF.

SQLBUF must be an active SQL interactive buffer. OUTBUF may be an existing buffer, or the name of a non-existing buffer. If omitted the output is sent to a temporary buffer which will be killed after the command completes. COMMAND should be a string of commands accepted by the SQLi program. COMMAND may also be a list of SQLi command strings.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/sql.el.gz
(defun sql-redirect (sqlbuf command &optional outbuf save-prior)
  "Execute the SQL command and send output to OUTBUF.

SQLBUF must be an active SQL interactive buffer.  OUTBUF may be
an existing buffer, or the name of a non-existing buffer.  If
omitted the output is sent to a temporary buffer which will be
killed after the command completes.  COMMAND should be a string
of commands accepted by the SQLi program.  COMMAND may also be a
list of SQLi command strings."

  (let* ((visible (and outbuf
                       (not (sql-buffer-hidden-p outbuf))))
         (this-save  save-prior)
         (next-save  t))

    (when visible
      (message "Executing SQL command..."))

    (if (consp command)
        (dolist (onecmd command)
          (sql-redirect-one sqlbuf onecmd outbuf this-save)
          (setq this-save next-save))
      (sql-redirect-one sqlbuf command outbuf save-prior))

    (when visible
      (message "Executing SQL command...done"))
    nil))