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-name | Buffer-local string used to possibly rename the SQLi buffer. |
sql-ansi-statement-starters | Regexp of keywords that start SQL commands. |
sql-buffer | Current SQLi buffer. |
sql-completion-column | A list of column names used for completion. |
sql-completion-object | A list of database objects used for completion. |
sql-connection | Connection name if interactive session started by ‘sql-connect’. |
sql-connection-alist | An alist of connection parameters for interacting with a SQL product. |
sql-connection-history | History of connections used. |
sql-contains-names | When non-nil, the current buffer contains database names. |
sql-database | Default database. |
sql-database-history | History of databases used. |
sql-db2-escape-newlines | Non-nil if newlines should be escaped by a backslash in DB2 SQLi. |
sql-db2-login-params | List of login parameters needed to connect to DB2. |
sql-db2-options | List of additional options for ‘sql-db2-program’. |
sql-db2-program | Command to start db2 by IBM. |
sql-debug-redirect | If non-nil, display messages related to the use of redirection. |
sql-debug-send | Display text sent to SQL process pragmatically. |
sql-default-directory | Default directory for SQL processes. |
sql-dialect | Select the SQL database product used. |
sql-display-sqli-buffer-function | Function to be called to display a SQLi buffer after ‘sql-send-*’. |
sql-electric-stuff | Treat some input as electric. |
sql-imenu-generic-expression | Define interesting points in the SQL buffer for ‘imenu’. |
sql-informix-login-params | List of login parameters needed to connect to Informix. |
sql-informix-program | Command to start dbaccess by Informix. |
sql-ingres-login-params | List of login parameters needed to connect to Ingres. |
sql-ingres-program | Command to start sql by Ingres. |
sql-input-ring-file-name | If non-nil, name of the file to read/write input history. |
sql-input-ring-separator | Separator between commands in the history file. |
sql-interactive-mode-abbrev-table | Abbrev table for ‘sql-interactive-mode’. |
sql-interactive-mode-hook | Hook for customizing ‘sql-interactive-mode’. |
sql-interactive-mode-map | Mode map used for ‘sql-interactive-mode’. |
sql-interactive-mode-menu | Menu for ‘sql-interactive-mode’. |
sql-interactive-product | Product under ‘sql-interactive-mode’. |
sql-interbase-login-params | List of login parameters needed to connect to Interbase. |
sql-interbase-options | List of additional options for ‘sql-interbase-program’. |
sql-interbase-program | Command to start isql by Interbase. |
sql-linter-login-params | Login parameters to needed to connect to Linter. |
sql-linter-options | List of additional options for ‘sql-linter-program’. |
sql-linter-program | Command to start inl by RELEX. |
sql-login-delay | Maximum number of seconds you are willing to wait for a login connection. |
sql-login-hook | Hook for interacting with a buffer in ‘sql-interactive-mode’. |
sql-mariadb-login-params | List of login parameters needed to connect to MySQL. |
sql-mariadb-options | List of additional options for ‘sql-mysql-program’. |
sql-mariadb-program | Command to start mysql by Oracle. |
sql-mode-abbrev-table | Abbrev table used in ‘sql-mode’ and ‘sql-interactive-mode’. |
sql-mode-ansi-font-lock-keywords | ANSI SQL keywords used by font-lock. |
sql-mode-db2-font-lock-keywords | DB2 SQL keywords used by font-lock. |
sql-mode-font-lock-keywords | SQL keywords used by font-lock. |
sql-mode-font-lock-object-name | Pattern to match the names of top-level objects. |
sql-mode-hook | Hook for customizing ‘sql-mode’. |
sql-mode-informix-font-lock-keywords | Informix SQL keywords used by font-lock. |
sql-mode-ingres-font-lock-keywords | Ingres SQL keywords used by font-lock. |
sql-mode-interbase-font-lock-keywords | Interbase SQL keywords used by font-lock. |
sql-mode-linter-font-lock-keywords | Linter SQL keywords used by font-lock. |
sql-mode-map | Mode map used for ‘sql-mode’. |
sql-mode-mariadb-font-lock-keywords | MariaDB is SQL compatible with MySQL. |
sql-mode-menu | Menu for ‘sql-mode’. |
sql-mode-ms-font-lock-keywords | Microsoft SQLServer SQL keywords used by font-lock. |
sql-mode-mysql-font-lock-keywords | MySQL SQL keywords used by font-lock. |
sql-mode-oracle-font-lock-keywords | Oracle SQL keywords used by font-lock. |
sql-mode-postgres-font-lock-keywords | Postgres SQL keywords used by font-lock. |
sql-mode-solid-font-lock-keywords | Solid SQL keywords used by font-lock. |
sql-mode-sqlite-font-lock-keywords | SQLite SQL keywords used by font-lock. |
sql-mode-sybase-font-lock-keywords | Sybase SQL keywords used by font-lock. |
sql-mode-syntax-table | Syntax table used in ‘sql-mode’ and ‘sql-interactive-mode’. |
sql-ms-login-params | List of login parameters needed to connect to Microsoft. |
sql-ms-options | List of additional options for ‘sql-ms-program’. |
sql-ms-program | Command to start osql by Microsoft. |
sql-mysql-login-params | List of login parameters needed to connect to MySQL. |
sql-mysql-options | List of additional options for ‘sql-mysql-program’. |
sql-mysql-program | Command to start mysql by Oracle. |
sql-oracle-completion-types | List of object types to include for completion under Oracle. |
sql-oracle-login-params | List of login parameters needed to connect to Oracle. |
sql-oracle-options | List of additional options for ‘sql-oracle-program’. |
sql-oracle-program | Command to start sqlplus by Oracle. |
sql-oracle-scan-on | Non-nil if placeholders should be replaced in Oracle SQLi. |
sql-oracle-statement-starters | Additional statement-starting keywords in Oracle. |
sql-output-newline-count | Number of newlines in the input string. |
sql-password | Default password. |
sql-password-search-wallet-function | Function to handle the lookup of the database password. |
sql-password-wallet | Identification of the password wallet. |
sql-placeholder-history | History of placeholder values used. |
sql-pop-to-buffer-after-send-region | Function to be called to display a SQLi buffer after ‘sql-send-*’. |
sql-port | Default port for connecting to a MySQL or Postgres server. |
sql-postgres-login-params | List of login parameters needed to connect to Postgres. |
sql-postgres-options | List of additional options for ‘sql-postgres-program’. |
sql-postgres-program | Command to start psql by Postgres. |
sql-postgres-statement-starters | Additional statement-starting keywords in Postgres. |
sql-product | Select the SQL database product used. |
sql-product-alist | An alist of product specific configuration settings. |
sql-product-history | History of products used. |
sql-prompt-cont-regexp | Prompt pattern of statement continuation prompts. |
sql-prompt-length | Prompt used to set ‘left-margin’ in ‘sql-interactive-mode’. |
sql-prompt-regexp | Prompt used to initialize ‘comint-prompt-regexp’. |
sql-send-terminator | When non-nil, add a terminator to text sent to the SQL interpreter. |
sql-server | Default server or host. |
sql-server-history | History of servers used. |
sql-set-sqli-hook | Hook for reacting to changes of ‘sql-buffer’. |
sql-solid-login-params | List of login parameters needed to connect to Solid. |
sql-solid-program | Command to start SOLID SQL Editor. |
sql-sqlite-login-params | List of login parameters needed to connect to SQLite. |
sql-sqlite-options | List of additional options for ‘sql-sqlite-program’. |
sql-sqlite-program | Command to start SQLite. |
sql-sybase-login-params | List of login parameters needed to connect to Sybase. |
sql-sybase-options | List of additional options for ‘sql-sybase-program’. |
sql-sybase-program | Command to start isql by Sybase. |
sql-use-indent-support | If non-nil then use the SQL indent support features of sql-indent. |
sql-user | Default username. |
sql-user-history | History of usernames used. |
sql-vertica-login-params | List of login parameters needed to connect to Vertica. |
sql-vertica-options | List of additional options for ‘sql-vertica-program’. |
sql-vertica-program | Command to start the Vertica client. |