sql-interactive-mode
sql-interactive-mode is a compiled Lisp function in `sql.el
'.
(sql-interactive-mode)
Major mode to use a SQL interpreter interactively.
Do not call this function by yourself. The environment must be
initialized by an entry function specific for the SQL interpreter.
See `sql-help' for a list of available entry functions.
M-x comint-send-input after the end of the process' output sends the
text from the end of process to the end of the current line.
M-x comint-send-input before end of process output copies the current
line minus the prompt to the end of the buffer and sends it.
M-x comint-copy-old-input just copies the current line.
Use M-x sql-accumulate-and-indent to enter multi-line statements.
If you want to make multiple SQL buffers, rename the `*SQL*' buffer
using M-x rename-buffer or M-x rename-uniquely and start a new process.
See `sql-help' for a list of available entry functions. The last buffer
created by such an entry function is the current SQLi buffer. SQL
buffers will send strings to the SQLi buffer current at the time of
their creation. See `sql-mode' for details.
Sample session using two connections:
1. Create first SQLi buffer by calling an entry function.
2. Rename buffer "*SQL*" to "*Connection 1*".
3. Create a SQL buffer "test1.sql".
4. Create second SQLi buffer by calling an entry function.
5. Rename buffer "*SQL*" to "*Connection 2*".
6. Create a SQL buffer "test2.sql".
Now M-x sql-send-region in buffer "test1.sql" will send the region to
buffer "*Connection 1*", M-x sql-send-region in buffer "test2.sql"
will send the region to buffer "*Connection 2*".
If you accidentally suspend your process, use M-x comint-continue-subjob
to continue it. On some operating systems, this will not work because
the signals are not supported.
key binding
--- -------
C-c Prefix Command
C-d comint-delchar-or-maybe-eof
C-j sql-accumulate-and-indent
RET comint-send-input
ESC Prefix Command
; sql-magic-semicolon
O sql-magic-go
o sql-magic-go
<C-down> comint-next-input
<C-up> comint-previous-input
<delete> delete-forward-char
<kp-delete> delete-forward-char
<mouse-2> comint-insert-input
C-c C-l Prefix Command
C-c C-w sql-copy-column
C-c C-a comint-bol-or-process-mark
C-c C-c comint-interrupt-subjob
C-c C-d comint-send-eof
C-c C-e comint-show-maximum-output
C-c C-l comint-dynamic-list-input-ring
(that binding is currently shadowed by another mode)
C-c RET comint-copy-old-input
C-c C-n comint-next-prompt
C-c C-o comint-delete-output
C-c C-p comint-previous-prompt
C-c C-r comint-show-output
C-c C-s comint-write-output
C-c C-u comint-kill-input
C-c C-w backward-kill-word
(that binding is currently shadowed by another mode)
C-c C-x comint-get-next-from-history
C-c C-z comint-stop-subjob
C-c ESC Prefix Command
C-c C-\ comint-quit-subjob
C-c SPC comint-accumulate
C-c . comint-insert-previous-argument
C-M-l comint-show-output
M-n comint-next-input
M-p comint-previous-input
M-r comint-history-isearch-backward-regexp
C-c C-l a sql-list-all
C-c C-l t sql-list-table
C-c M-r comint-previous-matching-input-from-input
C-c M-s comint-next-matching-input-from-input
Customization: Entry to this mode runs the hooks on `comint-mode-hook'
and `sql-interactive-mode-hook' (in that order). Before each input, the
hooks on `comint-input-filter-functions' are run. After each SQL
interpreter output, the hooks on `comint-output-filter-functions' are
run.
Variable `sql-input-ring-file-name' controls the initialization of the
input ring history.
Variables `comint-output-filter-functions', a hook, and
`comint-scroll-to-bottom-on-input' and
`comint-scroll-to-bottom-on-output' control whether input and output
cause the window to scroll to the end of the buffer.
If you want to make SQL buffers limited in length, add the function
`comint-truncate-buffer' to `comint-output-filter-functions'.
Here is an example for your init file. It keeps the SQLi buffer a
certain length.
(add-hook 'sql-interactive-mode-hoo
k
(function (lambda ()
(setq comint-output-filter-functions 'comint-truncate-buffer))))
Here is another example. It will always put point back to the statement
you entered, right above the output it created.
(setq comint-output-filter-functions
(function (lambda (STR) (comint-show-output))))