sql-execute

sql-execute is a compiled Lisp function in `sql.el'.

(sql-execute SQLBUF OUTBUF COMMAND ENHANCED ARG)

Execute a command in a SQL interactive buffer and capture the output.

The commands are run in SQLBUF and the output saved in OUTBUF.
COMMAND must be a string, a function or a list of such elements.
Functions are called with SQLBUF, OUTBUF and ARG as parameters;
strings are formatted with ARG and executed.

If the results are empty the OUTBUF is deleted, otherwise the
buffer is popped into a view window.