File: sql.el.html

Please send bug reports and bug fixes to the mailing list at bug-gnu-emacs@gnu.org. See also the general help list at https://lists.gnu.org/mailman/listinfo/help-gnu-emacs I monitor this list actively. If you send an e-mail to Alex Schroeder it usually makes it to me when Alex has a chance to forward them along (Thanks, Alex).

This file provides a sql-mode and a sql-interactive-mode. The original goals were two simple modes providing syntactic highlighting. The interactive mode had to provide a command-line history; the other mode had to provide "send region/buffer to SQL interpreter" functions. "simple" in this context means easy to use, easy to maintain and little or no bells and whistles. This has changed somewhat as experience with the mode has accumulated.

Support for different flavors of SQL and command interpreters was available in early versions of sql.el. This support has been extended and formalized in later versions. Part of the impetus for the improved support of SQL flavors was borne out of the current maintainers consulting experience. In the past twenty years, I have used Oracle, Sybase, Informix, MySQL, Postgres, and SQLServer. On some assignments, I have used two or more of these concurrently.

If anybody feels like extending this sql mode, take a look at the above mentioned modes and write a sqlx-mode on top of this one. If this proves to be difficult, please suggest changes that will facilitate your plans. Facilities have been provided to add products and product-specific configuration.

sql-interactive-mode is used to interact with a SQL interpreter process in a SQLi buffer (usually called *SQL*). The SQLi buffer is created by calling a SQL interpreter-specific entry function or sql-product-interactive. Do *not* call sql-interactive-mode by itself.

The list of currently supported interpreters and the corresponding entry function used to create the SQLi buffers is shown with sql-help (M-x sql-help).

Since sql-interactive-mode is built on top of the general command-interpreter-in-a-buffer mode (comint mode), it shares a common base functionality, and a common set of bindings, with all modes derived from comint mode. This makes these modes easier to use.

sql-mode can be used to keep editing SQL statements. The SQL statements can be sent to the SQL process in the SQLi buffer.

For documentation on the functionality provided by comint mode, and the hooks available for customizing it, see the file comint.el.

Hint for newbies: take a look at dabbrev-expand, abbrev-mode(var)/abbrev-mode(fun), and imenu-add-menubar-index.

Defined variables (112)

sql-alternate-buffer-nameBuffer-local string used to possibly rename the SQLi buffer.
sql-ansi-statement-startersRegexp of keywords that start SQL commands.
sql-bufferCurrent SQLi buffer.
sql-completion-columnA list of column names used for completion.
sql-completion-objectA list of database objects used for completion.
sql-connectionConnection name if interactive session started by ‘sql-connect’.
sql-connection-alistAn alist of connection parameters for interacting with a SQL product.
sql-connection-historyHistory of connections used.
sql-contains-namesWhen non-nil, the current buffer contains database names.
sql-databaseDefault database.
sql-database-historyHistory of databases used.
sql-db2-escape-newlinesNon-nil if newlines should be escaped by a backslash in DB2 SQLi.
sql-db2-login-paramsList of login parameters needed to connect to DB2.
sql-db2-optionsList of additional options for ‘sql-db2-program’.
sql-db2-programCommand to start db2 by IBM.
sql-debug-redirectIf non-nil, display messages related to the use of redirection.
sql-debug-sendDisplay text sent to SQL process pragmatically.
sql-default-directoryDefault directory for SQL processes.
sql-dialectSelect the SQL database product used.
sql-display-sqli-buffer-functionFunction to be called to display a SQLi buffer after ‘sql-send-*’.
sql-electric-stuffTreat some input as electric.
sql-imenu-generic-expressionDefine interesting points in the SQL buffer for ‘imenu’.
sql-informix-login-paramsList of login parameters needed to connect to Informix.
sql-informix-programCommand to start dbaccess by Informix.
sql-ingres-login-paramsList of login parameters needed to connect to Ingres.
sql-ingres-programCommand to start sql by Ingres.
sql-input-ring-file-nameIf non-nil, name of the file to read/write input history.
sql-input-ring-separatorSeparator between commands in the history file.
sql-interactive-mode-abbrev-tableAbbrev table for ‘sql-interactive-mode’.
sql-interactive-mode-hookHook for customizing ‘sql-interactive-mode’.
sql-interactive-mode-mapMode map used for ‘sql-interactive-mode’.
sql-interactive-mode-menuMenu for ‘sql-interactive-mode’.
sql-interactive-productProduct under ‘sql-interactive-mode’.
sql-interbase-login-paramsList of login parameters needed to connect to Interbase.
sql-interbase-optionsList of additional options for ‘sql-interbase-program’.
sql-interbase-programCommand to start isql by Interbase.
sql-linter-login-paramsLogin parameters to needed to connect to Linter.
sql-linter-optionsList of additional options for ‘sql-linter-program’.
sql-linter-programCommand to start inl by RELEX.
sql-login-delayMaximum number of seconds you are willing to wait for a login connection.
sql-login-hookHook for interacting with a buffer in ‘sql-interactive-mode’.
sql-mariadb-login-paramsList of login parameters needed to connect to MySQL.
sql-mariadb-optionsList of additional options for ‘sql-mysql-program’.
sql-mariadb-programCommand to start mysql by Oracle.
sql-mode-abbrev-tableAbbrev table used in ‘sql-mode’ and ‘sql-interactive-mode’.
sql-mode-ansi-font-lock-keywordsANSI SQL keywords used by font-lock.
sql-mode-db2-font-lock-keywordsDB2 SQL keywords used by font-lock.
sql-mode-font-lock-keywordsSQL keywords used by font-lock.
sql-mode-font-lock-object-namePattern to match the names of top-level objects.
sql-mode-hookHook for customizing ‘sql-mode’.
sql-mode-informix-font-lock-keywordsInformix SQL keywords used by font-lock.
sql-mode-ingres-font-lock-keywordsIngres SQL keywords used by font-lock.
sql-mode-interbase-font-lock-keywordsInterbase SQL keywords used by font-lock.
sql-mode-linter-font-lock-keywordsLinter SQL keywords used by font-lock.
sql-mode-mapMode map used for ‘sql-mode’.
sql-mode-mariadb-font-lock-keywordsMariaDB is SQL compatible with MySQL.
sql-mode-menuMenu for ‘sql-mode’.
sql-mode-ms-font-lock-keywordsMicrosoft SQLServer SQL keywords used by font-lock.
sql-mode-mysql-font-lock-keywordsMySQL SQL keywords used by font-lock.
sql-mode-oracle-font-lock-keywordsOracle SQL keywords used by font-lock.
sql-mode-postgres-font-lock-keywordsPostgres SQL keywords used by font-lock.
sql-mode-solid-font-lock-keywordsSolid SQL keywords used by font-lock.
sql-mode-sqlite-font-lock-keywordsSQLite SQL keywords used by font-lock.
sql-mode-sybase-font-lock-keywordsSybase SQL keywords used by font-lock.
sql-mode-syntax-tableSyntax table used in ‘sql-mode’ and ‘sql-interactive-mode’.
sql-ms-login-paramsList of login parameters needed to connect to Microsoft.
sql-ms-optionsList of additional options for ‘sql-ms-program’.
sql-ms-programCommand to start osql by Microsoft.
sql-mysql-login-paramsList of login parameters needed to connect to MySQL.
sql-mysql-optionsList of additional options for ‘sql-mysql-program’.
sql-mysql-programCommand to start mysql by Oracle.
sql-oracle-completion-typesList of object types to include for completion under Oracle.
sql-oracle-login-paramsList of login parameters needed to connect to Oracle.
sql-oracle-optionsList of additional options for ‘sql-oracle-program’.
sql-oracle-programCommand to start sqlplus by Oracle.
sql-oracle-scan-onNon-nil if placeholders should be replaced in Oracle SQLi.
sql-oracle-statement-startersAdditional statement-starting keywords in Oracle.
sql-output-newline-countNumber of newlines in the input string.
sql-passwordDefault password.
sql-password-search-wallet-functionFunction to handle the lookup of the database password.
sql-password-walletIdentification of the password wallet.
sql-placeholder-historyHistory of placeholder values used.
sql-pop-to-buffer-after-send-regionFunction to be called to display a SQLi buffer after ‘sql-send-*’.
sql-portDefault port for connecting to a MySQL or Postgres server.
sql-postgres-login-paramsList of login parameters needed to connect to Postgres.
sql-postgres-optionsList of additional options for ‘sql-postgres-program’.
sql-postgres-programCommand to start psql by Postgres.
sql-postgres-statement-startersAdditional statement-starting keywords in Postgres.
sql-productSelect the SQL database product used.
sql-product-alistAn alist of product specific configuration settings.
sql-product-historyHistory of products used.
sql-prompt-cont-regexpPrompt pattern of statement continuation prompts.
sql-prompt-lengthPrompt used to set ‘left-margin’ in ‘sql-interactive-mode’.
sql-prompt-regexpPrompt used to initialize ‘comint-prompt-regexp’.
sql-send-terminatorWhen non-nil, add a terminator to text sent to the SQL interpreter.
sql-serverDefault server or host.
sql-server-historyHistory of servers used.
sql-set-sqli-hookHook for reacting to changes of ‘sql-buffer’.
sql-solid-login-paramsList of login parameters needed to connect to Solid.
sql-solid-programCommand to start SOLID SQL Editor.
sql-sqlite-login-paramsList of login parameters needed to connect to SQLite.
sql-sqlite-optionsList of additional options for ‘sql-sqlite-program’.
sql-sqlite-programCommand to start SQLite.
sql-sybase-login-paramsList of login parameters needed to connect to Sybase.
sql-sybase-optionsList of additional options for ‘sql-sybase-program’.
sql-sybase-programCommand to start isql by Sybase.
sql-use-indent-supportIf non-nil then use the SQL indent support features of sql-indent.
sql-userDefault username.
sql-user-historyHistory of usernames used.
sql-vertica-login-paramsList of login parameters needed to connect to Vertica.
sql-vertica-optionsList of additional options for ‘sql-vertica-program’.
sql-vertica-programCommand to start the Vertica client.

Defined functions (118)

sql--adjust-interactive-setup()
sql--completion-table(STRING PRED ACTION)
sql--make-help-docstring()
sql-accumulate-and-indent()
sql-add-connection(CONNECTION PARAMS)
sql-add-product(PRODUCT DISPLAY &rest PLIST)
sql-add-product-keywords(PRODUCT KEYWORDS &optional APPEND)
sql-auth-source-search-wallet(WALLET PRODUCT USER SERVER DATABASE PORT)
sql-beginning-of-statement(ARG)
sql-buffer-hidden-p(BUF)
sql-buffer-live-p(BUFFER &optional PRODUCT CONNECTION)
sql-build-completions(SCHEMA)
sql-build-completions-1(SCHEMA COMPLETION-LIST FEATURE)
sql-comint(PRODUCT PARAMS &optional BUF-NAME)
sql-comint-automatic-password(_)
sql-comint-db2(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-informix(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-ingres(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-interbase(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-linter(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-mariadb(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-ms(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-mysql(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-oracle(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-postgres(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-solid(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-sqlite(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-sybase(PRODUCT OPTIONS &optional BUF-NAME)
sql-comint-vertica(PRODUCT OPTIONS &optional BUF-NAME)
sql-connect(CONNECTION &optional BUF-NAME)
sql-connection-menu-filter(TAIL)
sql-copy-column()
sql-db2(&optional BUFFER)
sql-default-value(VAR)
sql-del-product(PRODUCT)
sql-display-buffer(BUF)
sql-end-of-statement(ARG)
sql-escape-newlines-filter(STRING)
sql-execute(SQLBUF OUTBUF COMMAND ENHANCED ARG)
sql-execute-feature(SQLBUF OUTBUF FEATURE ENHANCED ARG)
sql-find-sqli-buffer(&optional PRODUCT CONNECTION)
sql-font-lock-keywords-builder(FACE BOUNDARIES &rest KEYWORDS)
sql-for-each-login(LOGIN-PARAMS BODY)
sql-generate-unique-sqli-buffer-name(PRODUCT BASE)
sql-get-login(&rest WHAT)
sql-get-login-ext(SYMBOL PROMPT HISTORY-VAR PLIST)
sql-get-product-feature(PRODUCT FEATURE &optional FALLBACK NOT-INDIRECT)
sql-help()
sql-help-list-products(INDENT FREEP)
sql-highlight-product()
sql-indent-enable()
sql-informix(&optional BUFFER)
sql-ingres(&optional BUFFER)
sql-input-sender(PROC STRING)
sql-interactive-mode()
sql-interactive-mode-menu(ARG1)
sql-interactive-remove-continuation-prompt(OLINE)
sql-interbase(&optional BUFFER)
sql-is-sqli-buffer-p(BUFFER)
sql-linter(&optional BUFFER)
sql-list-all(&optional ENHANCED)
sql-list-table(NAME &optional ENHANCED)
sql-magic-go()
sql-magic-semicolon(ARG)
sql-make-alternate-buffer-name(&optional PRODUCT)
sql-make-progress-reporter(BUF MESSAGE &optional MIN-VALUE MAX-VALUE CURRENT-VALUE MIN-CHANGE MIN-TIME)
sql-mariadb(&optional BUFFER)
sql-mode()
sql-mode-menu(ARG1)
sql-ms(&optional BUFFER)
sql-mysql(&optional BUFFER)
sql-oracle(&optional BUFFER)
sql-oracle--list-object-name(OBJ-NAME)
sql-oracle-completion-object(SQLBUF SCHEMA)
sql-oracle-list-all(SQLBUF OUTBUF ENHANCED TABLE-NAME)
sql-oracle-list-table(SQLBUF OUTBUF ENHANCED TABLE-NAME)
sql-oracle-restore-settings(SQLBUF SAVED-SETTINGS)
sql-oracle-save-settings(SQLBUF)
sql-placeholders-filter(STRING)
sql-postgres(&optional BUFFER)
sql-postgres-completion-object(SQLBUF SCHEMA)
sql-postgres-list-databases()
sql-product-font-lock(KEYWORDS-ONLY IMENU)
sql-product-interactive(&optional PRODUCT NEW-NAME)
sql-progress-reporter-done(REPORTER)
sql-progress-reporter-update(REPORTER &optional VALUE)
sql-read-connection(PROMPT &optional INITIAL DEFAULT)
sql-read-product(PROMPT &optional INITIAL)
sql-read-table-name(PROMPT)
sql-redirect(SQLBUF COMMAND &optional OUTBUF SAVE-PRIOR)
sql-redirect-one(SQLBUF COMMAND OUTBUF SAVE-PRIOR)
sql-redirect-value(SQLBUF COMMAND &optional REGEXP REGEXP-GROUPS)
sql-regexp-abbrev(KEYWORD)
sql-regexp-abbrev-list(&rest KEYW-LIST)
sql-remove-tabs-filter(STR)
sql-rename-buffer(&optional NEW-NAME)
sql-save-connection(NAME)
sql-send-buffer()
sql-send-line-and-next()
sql-send-magic-terminator(BUF STR TERMINATOR)
sql-send-paragraph()
sql-send-region(START END)
sql-send-string(STR)
sql-set-dialect(PRODUCT)
sql-set-product(PRODUCT)
sql-set-product-feature(PRODUCT FEATURE NEWVALUE)
sql-set-sqli-buffer()
sql-set-sqli-buffer-generally()
sql-show-sqli-buffer()
sql-solid(&optional BUFFER)
sql-sqlite(&optional BUFFER)
sql-sqlite-completion-object(SQLBUF SCHEMA)
sql-statement-regexp(PROD)
sql-stop(PROCESS EVENT)
sql-str-literal(S)
sql-sybase(&optional BUFFER)
sql-toggle-pop-to-buffer-after-send-region(&optional VALUE)
sql-vertica(&optional BUFFER)

Defined faces (0)