2012-12-06 12:29:30 -05:00
|
|
|
|
;;; sql.el --- specialized comint.el for SQL interpreters -*- lexical-binding: t -*-
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2021-01-01 01:13:56 -08:00
|
|
|
|
;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-08-24 10:50:59 +00:00
|
|
|
|
;; Author: Alex Schroeder <alex@gnu.org>
|
2013-03-11 00:09:37 -04:00
|
|
|
|
;; Maintainer: Michael Mauger <michael@mauger.com>
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
;; Version: 3.6
|
1999-02-13 12:04:00 +00:00
|
|
|
|
;; Keywords: comm languages processes
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1999-01-11 15:26:36 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
1999-02-19 04:27:18 +00:00
|
|
|
|
;; Please send bug reports and bug fixes to the mailing list at
|
2018-03-22 14:31:33 -04:00
|
|
|
|
;; 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
|
2006-12-25 20:11:21 +00:00
|
|
|
|
;; 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
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; maintainers consulting experience. In the past twenty years, I
|
2006-12-25 20:11:21 +00:00
|
|
|
|
;; have used Oracle, Sybase, Informix, MySQL, Postgres, and SQLServer.
|
|
|
|
|
;; On some assignments, I have used two or more of these concurrently.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;; 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
|
2006-12-25 20:11:21 +00:00
|
|
|
|
;; facilitate your plans. Facilities have been provided to add
|
|
|
|
|
;; products and product-specific configuration.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;; sql-interactive-mode is used to interact with a SQL interpreter
|
1999-02-13 12:04:00 +00:00
|
|
|
|
;; process in a SQLi buffer (usually called `*SQL*'). The SQLi buffer
|
2006-12-25 20:11:21 +00:00
|
|
|
|
;; is created by calling a SQL interpreter-specific entry function or
|
|
|
|
|
;; sql-product-interactive. Do *not* call sql-interactive-mode by
|
|
|
|
|
;; itself.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;; The list of currently supported interpreters and the corresponding
|
1999-02-13 12:04:00 +00:00
|
|
|
|
;; entry function used to create the SQLi buffers is shown with
|
1999-01-11 15:26:36 +00:00
|
|
|
|
;; `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.
|
|
|
|
|
|
2000-09-05 10:44:21 +00:00
|
|
|
|
;; sql-mode can be used to keep editing SQL statements. The SQL
|
|
|
|
|
;; statements can be sent to the SQL process in the SQLi buffer.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;; For documentation on the functionality provided by comint mode, and
|
2001-03-06 12:26:35 +00:00
|
|
|
|
;; the hooks available for customizing it, see the file `comint.el'.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-09-29 09:51:59 +00:00
|
|
|
|
;; Hint for newbies: take a look at `dabbrev-expand', `abbrev-mode', and
|
|
|
|
|
;; `imenu-add-menubar-index'.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;;; Bugs:
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; sql-ms now uses osql instead of isql. Osql flushes its error
|
|
|
|
|
;; stream more frequently than isql so that error messages are
|
|
|
|
|
;; available. There is no prompt and some output still is buffered.
|
|
|
|
|
;; This improves the interaction under Emacs but it still is somewhat
|
|
|
|
|
;; awkward.
|
|
|
|
|
|
2011-11-26 20:43:11 -08:00
|
|
|
|
;; Quoted identifiers are not supported for highlighting. Most
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; databases support the use of double quoted strings in place of
|
|
|
|
|
;; identifiers; ms (Microsoft SQLServer) also supports identifiers
|
|
|
|
|
;; enclosed within brackets [].
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;;; Product Support:
|
|
|
|
|
|
|
|
|
|
;; To add support for additional SQL products the following steps
|
|
|
|
|
;; must be followed ("xyz" is the name of the product in the examples
|
|
|
|
|
;; below):
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; 1) Add the product to the list of known products.
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; (sql-add-product 'xyz "XyzDB"
|
|
|
|
|
;; '(:free-software t))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; 2) Define font lock settings. All ANSI keywords will be
|
|
|
|
|
;; highlighted automatically, so only product specific keywords
|
|
|
|
|
;; need to be defined here.
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; (defvar my-sql-mode-xyz-font-lock-keywords
|
|
|
|
|
;; '(("\\b\\(red\\|orange\\|yellow\\)\\b"
|
|
|
|
|
;; . font-lock-keyword-face))
|
|
|
|
|
;; "XyzDB SQL keywords used by font-lock.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; (sql-set-product-feature 'xyz
|
|
|
|
|
;; :font-lock
|
|
|
|
|
;; 'my-sql-mode-xyz-font-lock-keywords)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; 3) Define any special syntax characters including comments and
|
|
|
|
|
;; identifier characters.
|
|
|
|
|
|
|
|
|
|
;; (sql-set-product-feature 'xyz
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; :syntax-alist ((?# . "_")))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
;; 4) Define the interactive command interpreter for the database
|
|
|
|
|
;; product.
|
|
|
|
|
|
|
|
|
|
;; (defcustom my-sql-xyz-program "ixyz"
|
|
|
|
|
;; "Command to start ixyz by XyzDB."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; :type 'file
|
|
|
|
|
;; :group 'SQL)
|
|
|
|
|
;;
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; (sql-set-product-feature 'xyz
|
|
|
|
|
;; :sqli-program 'my-sql-xyz-program)
|
|
|
|
|
;; (sql-set-product-feature 'xyz
|
|
|
|
|
;; :prompt-regexp "^xyzdb> ")
|
|
|
|
|
;; (sql-set-product-feature 'xyz
|
|
|
|
|
;; :prompt-length 7)
|
|
|
|
|
|
|
|
|
|
;; 5) Define login parameters and command line formatting.
|
|
|
|
|
|
|
|
|
|
;; (defcustom my-sql-xyz-login-params '(user password server database)
|
|
|
|
|
;; "Login parameters to needed to connect to XyzDB."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
;; :type 'sql-login-params
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; :group 'SQL)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;;
|
|
|
|
|
;; (sql-set-product-feature 'xyz
|
|
|
|
|
;; :sqli-login 'my-sql-xyz-login-params)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; (defcustom my-sql-xyz-options '("-X" "-Y" "-Z")
|
|
|
|
|
;; "List of additional options for `sql-xyz-program'."
|
|
|
|
|
;; :type '(repeat string)
|
|
|
|
|
;; :group 'SQL)
|
|
|
|
|
;;
|
|
|
|
|
;; (sql-set-product-feature 'xyz
|
|
|
|
|
;; :sqli-options 'my-sql-xyz-options))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
;; (defun my-sql-comint-xyz (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; "Connect ti XyzDB in a comint buffer."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;;
|
|
|
|
|
;; ;; Do something with `sql-user', `sql-password',
|
|
|
|
|
;; ;; `sql-database', and `sql-server'.
|
2012-12-06 12:29:30 -05:00
|
|
|
|
;; (let ((params
|
|
|
|
|
;; (append
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; (if (not (string= "" sql-user))
|
2012-12-06 12:29:30 -05:00
|
|
|
|
;; (list "-U" sql-user))
|
|
|
|
|
;; (if (not (string= "" sql-password))
|
|
|
|
|
;; (list "-P" sql-password))
|
|
|
|
|
;; (if (not (string= "" sql-database))
|
|
|
|
|
;; (list "-D" sql-database))
|
|
|
|
|
;; (if (not (string= "" sql-server))
|
|
|
|
|
;; (list "-S" sql-server))
|
|
|
|
|
;; options)))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
;; (sql-comint product params buf-name)))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;;
|
|
|
|
|
;; (sql-set-product-feature 'xyz
|
2010-07-20 21:56:55 -04:00
|
|
|
|
;; :sqli-comint-func 'my-sql-comint-xyz)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; 6) Define a convenience function to invoke the SQL interpreter.
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
;; (defun my-sql-xyz (&optional buffer)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; "Run ixyz by XyzDB as an inferior process."
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
;; (interactive "P")
|
|
|
|
|
;; (sql-product-interactive 'xyz buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2003-07-14 20:39:39 +00:00
|
|
|
|
;;; To Do:
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Improve keyword highlighting for individual products. I have tried
|
|
|
|
|
;; to update those database that I use. Feel free to send me updates,
|
|
|
|
|
;; or direct me to the reference manuals for your favorite database.
|
2003-07-14 20:39:39 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; When there are no keywords defined, the ANSI keywords are
|
|
|
|
|
;; highlighted. ANSI keywords are highlighted even if the keyword is
|
|
|
|
|
;; not used for your current product. This should help identify
|
|
|
|
|
;; portability concerns.
|
|
|
|
|
|
|
|
|
|
;; Add different highlighting levels.
|
|
|
|
|
|
|
|
|
|
;; Add support for listing available tables or the columns in a table.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;;; Thanks to all the people who helped me out:
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Alex Schroeder <alex@gnu.org> -- the original author
|
1999-01-11 15:26:36 +00:00
|
|
|
|
;; Kai Blauberg <kai.blauberg@metla.fi>
|
|
|
|
|
;; <ibalaban@dalet.com>
|
|
|
|
|
;; Yair Friedman <yfriedma@JohnBryce.Co.Il>
|
|
|
|
|
;; Gregor Zych <zych@pool.informatik.rwth-aachen.de>
|
1999-02-06 05:09:31 +00:00
|
|
|
|
;; nino <nino@inform.dk>
|
1999-09-29 09:51:59 +00:00
|
|
|
|
;; Berend de Boer <berend@pobox.com>
|
2004-04-29 21:55:28 +00:00
|
|
|
|
;; Adam Jenkins <adam@thejenkins.org>
|
2013-03-11 00:09:37 -04:00
|
|
|
|
;; Michael Mauger <michael@mauger.com> -- improved product support
|
2004-05-04 21:59:40 +00:00
|
|
|
|
;; Drew Adams <drew.adams@oracle.com> -- Emacs 20 support
|
|
|
|
|
;; Harald Maier <maierh@myself.com> -- sql-send-string
|
2014-09-08 08:27:19 -04:00
|
|
|
|
;; Stefan Monnier <monnier@iro.umontreal.ca> -- font-lock corrections;
|
2018-10-01 00:12:51 -04:00
|
|
|
|
;; code polish; on-going guidance and mentorship
|
2012-01-04 22:45:30 -05:00
|
|
|
|
;; Paul Sleigh <bat@flurf.net> -- MySQL keyword enhancement
|
|
|
|
|
;; Andrew Schein <andrew@andrewschein.com> -- sql-port bug
|
2014-09-08 08:27:19 -04:00
|
|
|
|
;; Ian Bjorhovde <idbjorh@dataproxy.com> -- db2 escape newlines
|
2012-09-10 15:22:53 -04:00
|
|
|
|
;; incorrectly enabled by default
|
2013-03-11 00:09:37 -04:00
|
|
|
|
;; Roman Scherer <roman.scherer@nugg.ad> -- Connection documentation
|
|
|
|
|
;; Mark Wilkinson <wilkinsonmr@gmail.com> -- file-local variables ignored
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
;; Simen Heggestøyl <simenheg@gmail.com> -- Postgres database completion
|
2018-06-10 20:01:36 -04:00
|
|
|
|
;; Robert Cochran <robert-emacs@cochranmail.com> -- MariaDB support
|
2018-10-01 00:12:51 -04:00
|
|
|
|
;; Alex Harsanyi <alexharsanyi@gmail.com> -- sql-indent package and support
|
2019-04-20 20:13:56 -04:00
|
|
|
|
;; Roy Mathew <rmathew8@gmail.com> -- bug in `sql-send-string'
|
2013-03-11 00:09:37 -04:00
|
|
|
|
;;
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(require 'cl-lib)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(require 'comint)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(require 'thingatpt)
|
2013-07-23 20:25:53 -04:00
|
|
|
|
(require 'view)
|
2019-02-19 16:54:16 -05:00
|
|
|
|
(eval-when-compile (require 'subr-x)) ; string-empty-p
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
2005-08-30 11:15:37 +00:00
|
|
|
|
(defvar font-lock-keyword-face)
|
|
|
|
|
(defvar font-lock-set-defaults)
|
|
|
|
|
(defvar font-lock-string-face)
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
;;; Allow customization
|
|
|
|
|
|
|
|
|
|
(defgroup SQL nil
|
2005-07-04 03:25:26 +00:00
|
|
|
|
"Running a SQL interpreter from within Emacs buffers."
|
1999-04-01 13:59:57 +00:00
|
|
|
|
:version "20.4"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:group 'languages
|
1999-01-11 15:26:36 +00:00
|
|
|
|
:group 'processes)
|
|
|
|
|
|
2013-07-23 20:25:53 -04:00
|
|
|
|
;; These five variables will be used as defaults, if set.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-user ""
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Default username."
|
1999-01-11 15:26:36 +00:00
|
|
|
|
:type 'string
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:safe 'stringp)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-password ""
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Default password.
|
2012-09-17 13:41:04 +08:00
|
|
|
|
If you customize this, the value will be stored in your init
|
|
|
|
|
file. Since that is a plaintext file, this could be dangerous."
|
1999-01-11 15:26:36 +00:00
|
|
|
|
:type 'string
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:risky t)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-database ""
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Default database."
|
1999-01-11 15:26:36 +00:00
|
|
|
|
:type 'string
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:safe 'stringp)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-server ""
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Default server or host."
|
1999-01-11 15:26:36 +00:00
|
|
|
|
:type 'string
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:safe 'stringp)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defcustom sql-port 0
|
2012-02-07 23:54:09 -08:00
|
|
|
|
"Default port for connecting to a MySQL or Postgres server."
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:version "24.1"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:type 'number
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:safe 'numberp)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2014-09-08 08:38:53 -04:00
|
|
|
|
(defcustom sql-default-directory nil
|
|
|
|
|
"Default directory for SQL processes."
|
2014-09-29 14:14:08 -04:00
|
|
|
|
:version "25.1"
|
2014-09-09 16:39:31 -04:00
|
|
|
|
:type '(choice (const nil) string)
|
2014-09-08 08:38:53 -04:00
|
|
|
|
:safe 'stringp)
|
|
|
|
|
|
2010-07-22 20:59:43 -04:00
|
|
|
|
;; Login parameter type
|
|
|
|
|
|
2018-03-22 14:31:33 -04:00
|
|
|
|
;; This seems too prescriptive. It probably fails to match some of
|
|
|
|
|
;; the possible combinations. It would probably be better to just use
|
|
|
|
|
;; plist for most of it.
|
2010-07-22 20:59:43 -04:00
|
|
|
|
(define-widget 'sql-login-params 'lazy
|
|
|
|
|
"Widget definition of the login parameters list"
|
|
|
|
|
:tag "Login Parameters"
|
2013-05-10 19:21:29 -07:00
|
|
|
|
:type '(set :tag "Login Parameters"
|
|
|
|
|
(choice :tag "user"
|
|
|
|
|
:value user
|
|
|
|
|
(const user)
|
|
|
|
|
(list :tag "Specify a default"
|
|
|
|
|
(const user)
|
|
|
|
|
(list :tag "Default"
|
|
|
|
|
:inline t (const :default) string)))
|
|
|
|
|
(const password)
|
|
|
|
|
(choice :tag "server"
|
|
|
|
|
:value server
|
|
|
|
|
(const server)
|
|
|
|
|
(list :tag "Specify a default"
|
|
|
|
|
(const server)
|
|
|
|
|
(list :tag "Default"
|
|
|
|
|
:inline t (const :default) string))
|
|
|
|
|
(list :tag "file"
|
|
|
|
|
(const :format "" server)
|
|
|
|
|
(const :format "" :file)
|
|
|
|
|
regexp)
|
|
|
|
|
(list :tag "completion"
|
|
|
|
|
(const :format "" server)
|
|
|
|
|
(const :format "" :completion)
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(const :format "" :must-match)
|
2013-05-10 19:21:29 -07:00
|
|
|
|
(restricted-sexp
|
|
|
|
|
:match-alternatives (listp stringp))))
|
|
|
|
|
(choice :tag "database"
|
|
|
|
|
:value database
|
|
|
|
|
(const database)
|
|
|
|
|
(list :tag "Specify a default"
|
|
|
|
|
(const database)
|
|
|
|
|
(list :tag "Default"
|
|
|
|
|
:inline t (const :default) string))
|
|
|
|
|
(list :tag "file"
|
|
|
|
|
(const :format "" database)
|
|
|
|
|
(const :format "" :file)
|
2018-03-22 14:31:33 -04:00
|
|
|
|
(choice (const nil) regexp)
|
|
|
|
|
(const :format "" :must-match)
|
|
|
|
|
(symbol :tag ":must-match"))
|
2013-05-10 19:21:29 -07:00
|
|
|
|
(list :tag "completion"
|
|
|
|
|
(const :format "" database)
|
2018-03-22 14:31:33 -04:00
|
|
|
|
(const :format "" :default)
|
|
|
|
|
(string :tag ":default")
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(const :format "" :completion)
|
2018-03-22 14:31:33 -04:00
|
|
|
|
(sexp :tag ":completion")
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(const :format "" :must-match)
|
2020-09-25 15:42:35 +02:00
|
|
|
|
(symbol :tag ":must-match")))
|
2013-05-10 19:21:29 -07:00
|
|
|
|
(const port)))
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; SQL Product support
|
|
|
|
|
|
|
|
|
|
(defvar sql-interactive-product nil
|
|
|
|
|
"Product under `sql-interactive-mode'.")
|
|
|
|
|
|
2010-07-18 14:44:32 -04:00
|
|
|
|
(defvar sql-connection nil
|
|
|
|
|
"Connection name if interactive session started by `sql-connect'.")
|
|
|
|
|
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(defvar sql-product-alist
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
'((ansi
|
2009-08-16 15:48:15 +00:00
|
|
|
|
:name "ANSI"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
:font-lock sql-mode-ansi-font-lock-keywords
|
|
|
|
|
:statement sql-ansi-statement-starters)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(db2
|
2009-08-16 15:48:15 +00:00
|
|
|
|
:name "DB2"
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-db2-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-db2-program
|
|
|
|
|
:sqli-options sql-db2-options
|
|
|
|
|
:sqli-login sql-db2-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-db2
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp "^db2 => "
|
|
|
|
|
:prompt-length 7
|
2015-09-17 12:28:45 -07:00
|
|
|
|
:prompt-cont-regexp "^db2 (cont\\.) => "
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:input-filter sql-escape-newlines-filter)
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(informix
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:name "Informix"
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-informix-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-informix-program
|
|
|
|
|
:sqli-options sql-informix-options
|
|
|
|
|
:sqli-login sql-informix-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-informix
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp "^> "
|
|
|
|
|
:prompt-length 2
|
|
|
|
|
:syntax-alist ((?{ . "<") (?} . ">")))
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(ingres
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:name "Ingres"
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-ingres-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-ingres-program
|
|
|
|
|
:sqli-options sql-ingres-options
|
|
|
|
|
:sqli-login sql-ingres-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-ingres
|
2015-09-17 16:08:20 -07:00
|
|
|
|
:prompt-regexp "^\\* "
|
2010-08-10 19:04:32 -04:00
|
|
|
|
:prompt-length 2
|
2015-09-17 16:08:20 -07:00
|
|
|
|
:prompt-cont-regexp "^\\* ")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(interbase
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:name "Interbase"
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-interbase-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-interbase-program
|
|
|
|
|
:sqli-options sql-interbase-options
|
|
|
|
|
:sqli-login sql-interbase-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-interbase
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp "^SQL> "
|
|
|
|
|
:prompt-length 5)
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(linter
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:name "Linter"
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-linter-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-linter-program
|
|
|
|
|
:sqli-options sql-linter-options
|
|
|
|
|
:sqli-login sql-linter-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-linter
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp "^SQL>"
|
|
|
|
|
:prompt-length 4)
|
|
|
|
|
|
2018-06-10 20:01:36 -04:00
|
|
|
|
(mariadb
|
|
|
|
|
:name "MariaDB"
|
|
|
|
|
:free-software t
|
|
|
|
|
:font-lock sql-mode-mariadb-font-lock-keywords
|
|
|
|
|
:sqli-program sql-mariadb-program
|
|
|
|
|
:sqli-options sql-mariadb-options
|
|
|
|
|
:sqli-login sql-mariadb-login-params
|
|
|
|
|
:sqli-comint-func sql-comint-mariadb
|
|
|
|
|
:list-all "SHOW TABLES;"
|
|
|
|
|
:list-table "DESCRIBE %s;"
|
|
|
|
|
:prompt-regexp "^MariaDB \\[.*]> "
|
|
|
|
|
:prompt-cont-regexp "^ [\"'`-]> "
|
|
|
|
|
:syntax-alist ((?# . "< b"))
|
|
|
|
|
:input-filter sql-remove-tabs-filter)
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(ms
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:name "Microsoft"
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-ms-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-ms-program
|
|
|
|
|
:sqli-options sql-ms-options
|
|
|
|
|
:sqli-login sql-ms-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-ms
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp "^[0-9]*>"
|
2019-04-21 00:40:00 -04:00
|
|
|
|
:prompt-cont-regexp "^[0-9]*>"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-length 5
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
:syntax-alist ((?@ . "_"))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:terminator ("^go" . "go"))
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(mysql
|
2009-08-16 15:48:15 +00:00
|
|
|
|
:name "MySQL"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:free-software t
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-mysql-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-mysql-program
|
|
|
|
|
:sqli-options sql-mysql-options
|
|
|
|
|
:sqli-login sql-mysql-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-mysql
|
2010-09-18 22:11:18 -04:00
|
|
|
|
:list-all "SHOW TABLES;"
|
|
|
|
|
:list-table "DESCRIBE %s;"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp "^mysql> "
|
|
|
|
|
:prompt-length 6
|
2010-08-10 19:04:32 -04:00
|
|
|
|
:prompt-cont-regexp "^ -> "
|
2020-08-09 20:55:52 +02:00
|
|
|
|
:syntax-alist ((?# . "< b") (?\\ . "\\"))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:input-filter sql-remove-tabs-filter)
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(oracle
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:name "Oracle"
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-oracle-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-oracle-program
|
|
|
|
|
:sqli-options sql-oracle-options
|
|
|
|
|
:sqli-login sql-oracle-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-oracle
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
:list-all sql-oracle-list-all
|
|
|
|
|
:list-table sql-oracle-list-table
|
|
|
|
|
:completion-object sql-oracle-completion-object
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp "^SQL> "
|
|
|
|
|
:prompt-length 5
|
2013-07-23 20:25:53 -04:00
|
|
|
|
:prompt-cont-regexp "^\\(?:[ ][ ][1-9]\\|[ ][1-9][0-9]\\|[1-9][0-9]\\{2\\}\\)[ ]\\{2\\}"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
:statement sql-oracle-statement-starters
|
|
|
|
|
:syntax-alist ((?$ . "_") (?# . "_"))
|
2019-04-20 20:13:56 -04:00
|
|
|
|
:terminator ("\\(^/\\|;\\)" . "/")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:input-filter sql-placeholders-filter)
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(postgres
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:name "Postgres"
|
|
|
|
|
:free-software t
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-postgres-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-postgres-program
|
|
|
|
|
:sqli-options sql-postgres-options
|
|
|
|
|
:sqli-login sql-postgres-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-postgres
|
2010-09-18 22:11:18 -04:00
|
|
|
|
:list-all ("\\d+" . "\\dS+")
|
|
|
|
|
:list-table ("\\d+ %s" . "\\dS+ %s")
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
:completion-object sql-postgres-completion-object
|
2021-10-11 20:04:46 -04:00
|
|
|
|
:prompt-regexp "^[-[:alnum:]_]*[-=][#>] "
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-length 5
|
2021-10-11 20:04:46 -04:00
|
|
|
|
:prompt-cont-regexp "^[-[:alnum:]_]*[-'(][#>] "
|
2021-05-19 15:02:33 +02:00
|
|
|
|
:statement sql-postgres-statement-starters
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:input-filter sql-remove-tabs-filter
|
2019-04-20 20:13:56 -04:00
|
|
|
|
:terminator ("\\(^\\s-*\\\\g\\|;\\)" . "\\g"))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(solid
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:name "Solid"
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-solid-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-solid-program
|
|
|
|
|
:sqli-options sql-solid-options
|
|
|
|
|
:sqli-login sql-solid-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-solid
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp "^"
|
|
|
|
|
:prompt-length 0)
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(sqlite
|
2009-08-16 15:48:15 +00:00
|
|
|
|
:name "SQLite"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:free-software t
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-sqlite-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-sqlite-program
|
|
|
|
|
:sqli-options sql-sqlite-options
|
|
|
|
|
:sqli-login sql-sqlite-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-sqlite
|
2010-09-18 22:11:18 -04:00
|
|
|
|
:list-all ".tables"
|
|
|
|
|
:list-table ".schema %s"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
:completion-object sql-sqlite-completion-object
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp "^sqlite> "
|
2010-08-10 19:04:32 -04:00
|
|
|
|
:prompt-length 8
|
2019-04-20 20:13:56 -04:00
|
|
|
|
:prompt-cont-regexp "^ \\.\\.\\.> ")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(sybase
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:name "Sybase"
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
:font-lock sql-mode-sybase-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program sql-sybase-program
|
|
|
|
|
:sqli-options sql-sybase-options
|
|
|
|
|
:sqli-login sql-sybase-login-params
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:sqli-comint-func sql-comint-sybase
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp "^SQL> "
|
|
|
|
|
:prompt-length 5
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
:syntax-alist ((?@ . "_"))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:terminator ("^go" . "go"))
|
2014-09-12 15:57:40 -04:00
|
|
|
|
|
|
|
|
|
(vertica
|
|
|
|
|
:name "Vertica"
|
|
|
|
|
:sqli-program sql-vertica-program
|
|
|
|
|
:sqli-options sql-vertica-options
|
|
|
|
|
:sqli-login sql-vertica-login-params
|
2014-09-22 15:17:40 -04:00
|
|
|
|
:sqli-comint-func sql-comint-vertica
|
|
|
|
|
:list-all ("\\d" . "\\dS")
|
2014-09-12 15:57:40 -04:00
|
|
|
|
:list-table "\\d %s"
|
2016-04-24 13:44:37 +02:00
|
|
|
|
:prompt-regexp "^[[:alnum:]_]*=[#>] "
|
2014-09-12 15:57:40 -04:00
|
|
|
|
:prompt-length 5
|
2016-04-24 13:44:37 +02:00
|
|
|
|
:prompt-cont-regexp "^[[:alnum:]_]*[-(][#>] ")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"An alist of product specific configuration settings.
|
|
|
|
|
|
|
|
|
|
Without an entry in this list a product will not be properly
|
|
|
|
|
highlighted and will not support `sql-interactive-mode'.
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
|
|
|
|
Each element in the list is in the following format:
|
|
|
|
|
|
2015-09-17 16:08:20 -07:00
|
|
|
|
(PRODUCT FEATURE VALUE ...)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
where PRODUCT is the appropriate value of `sql-product'. The
|
|
|
|
|
product name is then followed by FEATURE-VALUE pairs. If a
|
|
|
|
|
FEATURE is not specified, its VALUE is treated as nil. FEATURE
|
|
|
|
|
may be any one of the following:
|
|
|
|
|
|
|
|
|
|
:name string containing the displayable name of
|
|
|
|
|
the product.
|
|
|
|
|
|
|
|
|
|
:free-software is the product Free (as in Freedom) software?
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
|
|
|
|
:font-lock name of the variable containing the product
|
|
|
|
|
specific font lock highlighting patterns.
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-program name of the variable containing the product
|
|
|
|
|
specific interactive program name.
|
|
|
|
|
|
|
|
|
|
:sqli-options name of the variable containing the list
|
|
|
|
|
of product specific options.
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:sqli-login name of the variable containing the list of
|
|
|
|
|
login parameters (i.e., user, password,
|
|
|
|
|
database and server) needed to connect to
|
|
|
|
|
the database.
|
|
|
|
|
|
2017-01-14 11:50:11 -05:00
|
|
|
|
:sqli-comint-func function of two arguments, PRODUCT
|
2017-01-14 10:40:01 +02:00
|
|
|
|
and OPTIONS, that will open a comint buffer
|
|
|
|
|
and connect to the database. PRODUCT is the
|
|
|
|
|
first argument to be passed to `sql-comint',
|
|
|
|
|
and OPTIONS should be included in its second
|
|
|
|
|
argument. The function should use the values
|
|
|
|
|
of `sql-user', `sql-password', `sql-database',
|
|
|
|
|
`sql-server' and `sql-port' to . Do product
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
specific configuration of comint in this
|
2017-01-14 10:40:01 +02:00
|
|
|
|
function. See `sql-comint-oracle' for an
|
|
|
|
|
example of such a function.
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
:list-all Command string or function which produces
|
|
|
|
|
a listing of all objects in the database.
|
|
|
|
|
If it's a cons cell, then the car
|
|
|
|
|
produces the standard list of objects and
|
|
|
|
|
the cdr produces an enhanced list of
|
|
|
|
|
objects. What \"enhanced\" means is
|
|
|
|
|
dependent on the SQL product and may not
|
|
|
|
|
exist. In general though, the
|
|
|
|
|
\"enhanced\" list should include visible
|
|
|
|
|
objects from other schemas.
|
|
|
|
|
|
|
|
|
|
:list-table Command string or function which produces
|
|
|
|
|
a detailed listing of a specific database
|
|
|
|
|
table. If its a cons cell, then the car
|
|
|
|
|
produces the standard list and the cdr
|
|
|
|
|
produces an enhanced list.
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
:completion-object A function that returns a list of
|
|
|
|
|
objects. Called with a single
|
|
|
|
|
parameter--if nil then list objects
|
|
|
|
|
accessible in the current schema, if
|
|
|
|
|
not-nil it is the name of a schema whose
|
|
|
|
|
objects should be listed.
|
|
|
|
|
|
|
|
|
|
:completion-column A function that returns a list of
|
|
|
|
|
columns. Called with a single
|
|
|
|
|
parameter--if nil then list objects
|
|
|
|
|
accessible in the current schema, if
|
|
|
|
|
not-nil it is the name of a schema whose
|
|
|
|
|
objects should be listed.
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:prompt-regexp regular expression string that matches
|
2004-04-29 21:55:28 +00:00
|
|
|
|
the prompt issued by the product
|
2010-05-09 22:07:58 -04:00
|
|
|
|
interpreter.
|
|
|
|
|
|
|
|
|
|
:prompt-length length of the prompt on the line.
|
|
|
|
|
|
2010-08-10 19:04:32 -04:00
|
|
|
|
:prompt-cont-regexp regular expression string that matches
|
|
|
|
|
the continuation prompt issued by the
|
|
|
|
|
product interpreter.
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:input-filter function which can filter strings sent to
|
|
|
|
|
the command interpreter. It is also used
|
|
|
|
|
by the `sql-send-string',
|
|
|
|
|
`sql-send-region', `sql-send-paragraph'
|
|
|
|
|
and `sql-send-buffer' functions. The
|
|
|
|
|
function is passed the string sent to the
|
|
|
|
|
command interpreter and must return the
|
2010-08-10 19:04:32 -04:00
|
|
|
|
filtered string. May also be a list of
|
|
|
|
|
such functions.
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
:statement name of a variable containing a regexp that
|
|
|
|
|
matches the beginning of SQL statements.
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:terminator the terminator to be sent after a
|
|
|
|
|
`sql-send-string', `sql-send-region',
|
|
|
|
|
`sql-send-paragraph' and
|
|
|
|
|
`sql-send-buffer' command. May be the
|
|
|
|
|
literal string or a cons of a regexp to
|
|
|
|
|
match an existing terminator in the
|
|
|
|
|
string and the terminator to be used if
|
|
|
|
|
its absent. By default \";\".
|
|
|
|
|
|
|
|
|
|
:syntax-alist alist of syntax table entries to enable
|
|
|
|
|
special character treatment by font-lock
|
|
|
|
|
and imenu.
|
|
|
|
|
|
|
|
|
|
Other features can be stored but they will be ignored. However,
|
|
|
|
|
you can develop new functionality which is product independent by
|
|
|
|
|
using `sql-get-product-feature' to lookup the product specific
|
|
|
|
|
settings.")
|
|
|
|
|
|
|
|
|
|
(defvar sql-indirect-features
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
'(:font-lock :sqli-program :sqli-options :sqli-login :statement))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-07-18 14:44:32 -04:00
|
|
|
|
(defcustom sql-connection-alist nil
|
2012-02-07 23:54:09 -08:00
|
|
|
|
"An alist of connection parameters for interacting with a SQL product.
|
2010-07-18 14:44:32 -04:00
|
|
|
|
Each element of the alist is as follows:
|
|
|
|
|
|
2015-09-17 16:08:20 -07:00
|
|
|
|
(CONNECTION \(SQL-VARIABLE VALUE) ...)
|
2010-07-18 14:44:32 -04:00
|
|
|
|
|
2013-03-11 00:09:37 -04:00
|
|
|
|
Where CONNECTION is a case-insensitive string identifying the
|
|
|
|
|
connection, SQL-VARIABLE is the symbol name of a SQL mode
|
|
|
|
|
variable, and VALUE is the value to be assigned to the variable.
|
|
|
|
|
The most common SQL-VARIABLE settings associated with a
|
|
|
|
|
connection are: `sql-product', `sql-user', `sql-password',
|
|
|
|
|
`sql-port', `sql-server', and `sql-database'.
|
2010-07-18 14:44:32 -04:00
|
|
|
|
|
|
|
|
|
If a SQL-VARIABLE is part of the connection, it will not be
|
2012-02-07 23:54:09 -08:00
|
|
|
|
prompted for during login. The command `sql-connect' starts a
|
|
|
|
|
predefined SQLi session using the parameters from this list.
|
|
|
|
|
Connections defined here appear in the submenu SQL->Start... for
|
|
|
|
|
making new SQLi sessions."
|
2010-07-20 21:56:55 -04:00
|
|
|
|
:type `(alist :key-type (string :tag "Connection")
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:value-type
|
|
|
|
|
(set
|
|
|
|
|
(group (const :tag "Product" sql-product)
|
|
|
|
|
(choice
|
2012-12-06 12:29:30 -05:00
|
|
|
|
,@(mapcar
|
|
|
|
|
(lambda (prod-info)
|
|
|
|
|
`(const :tag
|
|
|
|
|
,(or (plist-get (cdr prod-info) :name)
|
|
|
|
|
(capitalize
|
|
|
|
|
(symbol-name (car prod-info))))
|
|
|
|
|
(quote ,(car prod-info))))
|
|
|
|
|
sql-product-alist)))
|
2010-07-18 14:44:32 -04:00
|
|
|
|
(group (const :tag "Username" sql-user) string)
|
|
|
|
|
(group (const :tag "Password" sql-password) string)
|
|
|
|
|
(group (const :tag "Server" sql-server) string)
|
|
|
|
|
(group (const :tag "Database" sql-database) string)
|
2010-07-20 21:56:55 -04:00
|
|
|
|
(group (const :tag "Port" sql-port) integer)
|
|
|
|
|
(repeat :inline t
|
|
|
|
|
(list :tab "Other"
|
|
|
|
|
(symbol :tag " Variable Symbol")
|
2020-03-14 15:39:31 -04:00
|
|
|
|
;; FIXME: Why "Value *Expression*"?
|
2010-07-20 21:56:55 -04:00
|
|
|
|
(sexp :tag "Value Expression")))))
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-07-18 14:44:32 -04:00
|
|
|
|
|
2021-10-11 20:04:46 -04:00
|
|
|
|
(defun sql-add-connection (connection params)
|
|
|
|
|
"Add a new connection to `sql-connection-alist'.
|
2018-04-20 18:34:39 -04:00
|
|
|
|
|
2021-10-11 20:04:46 -04:00
|
|
|
|
If CONNECTION already exists, it is replaced with PARAMS."
|
|
|
|
|
(setq sql-connection-alist
|
|
|
|
|
(assoc-delete-all connection sql-connection-alist))
|
|
|
|
|
(push
|
|
|
|
|
(cons connection params)
|
|
|
|
|
sql-connection-alist))
|
|
|
|
|
|
|
|
|
|
(defvaralias 'sql-dialect 'sql-product)
|
2009-08-16 15:48:15 +00:00
|
|
|
|
(defcustom sql-product 'ansi
|
2012-12-06 12:29:30 -05:00
|
|
|
|
"Select the SQL database product used.
|
|
|
|
|
This allows highlighting buffers properly when you open them."
|
2009-08-16 15:48:15 +00:00
|
|
|
|
:type `(choice
|
|
|
|
|
,@(mapcar (lambda (prod-info)
|
|
|
|
|
`(const :tag
|
|
|
|
|
,(or (plist-get (cdr prod-info) :name)
|
|
|
|
|
(capitalize (symbol-name (car prod-info))))
|
|
|
|
|
,(car prod-info)))
|
|
|
|
|
sql-product-alist))
|
2010-07-18 14:44:32 -04:00
|
|
|
|
:safe 'symbolp)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2018-10-01 00:12:51 -04:00
|
|
|
|
;; SQL indent support
|
|
|
|
|
|
|
|
|
|
(defcustom sql-use-indent-support t
|
|
|
|
|
"If non-nil then use the SQL indent support features of sql-indent.
|
|
|
|
|
The `sql-indent' package in ELPA provides indentation support for
|
|
|
|
|
SQL statements with easy customizations to support varied layout
|
|
|
|
|
requirements.
|
|
|
|
|
|
|
|
|
|
The package must be available to be loaded and activated."
|
|
|
|
|
:link '(url-link "https://elpa.gnu.org/packages/sql-indent.html")
|
2019-10-01 10:50:47 +02:00
|
|
|
|
:type 'boolean
|
2018-10-01 00:12:51 -04:00
|
|
|
|
:version "27.1")
|
|
|
|
|
|
|
|
|
|
(defun sql-indent-enable ()
|
|
|
|
|
"Enable `sqlind-minor-mode' if available and requested."
|
2019-02-20 09:25:54 -05:00
|
|
|
|
(when (fboundp 'sqlind-minor-mode)
|
2018-10-01 00:12:51 -04:00
|
|
|
|
(sqlind-minor-mode (if sql-use-indent-support +1 -1))))
|
|
|
|
|
|
2019-02-18 23:15:54 -05:00
|
|
|
|
;; Secure Password wallet
|
|
|
|
|
|
|
|
|
|
(require 'auth-source)
|
|
|
|
|
|
|
|
|
|
(defun sql-auth-source-search-wallet (wallet product user server database port)
|
|
|
|
|
"Read auth source WALLET to locate the USER secret.
|
|
|
|
|
Sets `auth-sources' to WALLET and uses `auth-source-search' to locate the entry.
|
|
|
|
|
The DATABASE and SERVER are concatenated with a slash between them as the
|
|
|
|
|
host key."
|
|
|
|
|
(let* ((auth-sources wallet)
|
|
|
|
|
host
|
|
|
|
|
secret h-secret sd-secret)
|
|
|
|
|
|
|
|
|
|
;; product
|
|
|
|
|
(setq product (symbol-name product))
|
|
|
|
|
|
|
|
|
|
;; user
|
|
|
|
|
(setq user (unless (string-empty-p user) user))
|
|
|
|
|
|
|
|
|
|
;; port
|
|
|
|
|
(setq port
|
|
|
|
|
(when (and port (numberp port) (not (zerop port)))
|
|
|
|
|
(number-to-string port)))
|
|
|
|
|
|
|
|
|
|
;; server
|
|
|
|
|
(setq server (unless (string-empty-p server) server))
|
|
|
|
|
|
|
|
|
|
;; database
|
|
|
|
|
(setq database (unless (string-empty-p database) database))
|
|
|
|
|
|
|
|
|
|
;; host
|
|
|
|
|
(setq host (if server
|
|
|
|
|
(if database
|
|
|
|
|
(concat server "/" database)
|
|
|
|
|
server)
|
|
|
|
|
database))
|
|
|
|
|
|
|
|
|
|
;; Perform search
|
|
|
|
|
(dolist (s (auth-source-search :max 1000))
|
|
|
|
|
(when (and
|
|
|
|
|
;; Is PRODUCT specified, in the enty, and they are equal
|
|
|
|
|
(if product
|
|
|
|
|
(if (plist-member s :product)
|
|
|
|
|
(equal (plist-get s :product) product)
|
|
|
|
|
t)
|
|
|
|
|
t)
|
|
|
|
|
;; Is USER specified, in the entry, and they are equal
|
|
|
|
|
(if user
|
|
|
|
|
(if (plist-member s :user)
|
|
|
|
|
(equal (plist-get s :user) user)
|
|
|
|
|
t)
|
|
|
|
|
t)
|
|
|
|
|
;; Is PORT specified, in the entry, and they are equal
|
|
|
|
|
(if port
|
|
|
|
|
(if (plist-member s :port)
|
|
|
|
|
(equal (plist-get s :port) port)
|
|
|
|
|
t)
|
|
|
|
|
t))
|
|
|
|
|
;; Is HOST specified, in the entry, and they are equal
|
|
|
|
|
;; then the H-SECRET list
|
|
|
|
|
(if (and host
|
|
|
|
|
(plist-member s :host)
|
|
|
|
|
(equal (plist-get s :host) host))
|
|
|
|
|
(push s h-secret)
|
|
|
|
|
;; Are SERVER and DATABASE specified, present, and equal
|
|
|
|
|
;; then the SD-SECRET list
|
|
|
|
|
(if (and server
|
|
|
|
|
(plist-member s :server)
|
|
|
|
|
database
|
|
|
|
|
(plist-member s :database)
|
|
|
|
|
(equal (plist-get s :server) server)
|
|
|
|
|
(equal (plist-get s :database) database))
|
|
|
|
|
(push s sd-secret)
|
|
|
|
|
;; Is SERVER specified, in the entry, and they are equal
|
|
|
|
|
;; then the base SECRET list
|
|
|
|
|
(if (and server
|
|
|
|
|
(plist-member s :server)
|
|
|
|
|
(equal (plist-get s :server) server))
|
|
|
|
|
(push s secret)
|
|
|
|
|
;; Is DATABASE specified, in the entry, and they are equal
|
|
|
|
|
;; then the base SECRET list
|
|
|
|
|
(if (and database
|
|
|
|
|
(plist-member s :database)
|
|
|
|
|
(equal (plist-get s :database) database))
|
|
|
|
|
(push s secret)))))))
|
|
|
|
|
(setq secret (or h-secret sd-secret secret))
|
|
|
|
|
|
|
|
|
|
;; If we found a single secret, return the password
|
|
|
|
|
(when (= 1 (length secret))
|
|
|
|
|
(setq secret (car secret))
|
|
|
|
|
(if (plist-member secret :secret)
|
|
|
|
|
(plist-get secret :secret)
|
|
|
|
|
nil))))
|
|
|
|
|
|
|
|
|
|
(defcustom sql-password-wallet
|
|
|
|
|
(let (wallet w)
|
|
|
|
|
(dolist (ext '(".json.gpg" ".gpg" ".json" "") wallet)
|
|
|
|
|
(unless wallet
|
|
|
|
|
(setq w (locate-user-emacs-file (concat "sql-wallet" ext)
|
|
|
|
|
(concat ".sql-wallet" ext)))
|
|
|
|
|
(when (file-exists-p w)
|
2020-09-25 15:15:21 +02:00
|
|
|
|
(setq wallet (list w))))))
|
2019-02-18 23:15:54 -05:00
|
|
|
|
"Identification of the password wallet.
|
|
|
|
|
See `sql-password-search-wallet-function' to understand how this value
|
|
|
|
|
is used to locate the password wallet."
|
2020-09-25 15:15:21 +02:00
|
|
|
|
:type (plist-get (symbol-plist 'auth-sources) 'custom-type)
|
2019-02-18 23:15:54 -05:00
|
|
|
|
:version "27.1")
|
|
|
|
|
|
|
|
|
|
(defvar sql-password-search-wallet-function #'sql-auth-source-search-wallet
|
|
|
|
|
"Function to handle the lookup of the database password.
|
|
|
|
|
The specified function will be called as:
|
|
|
|
|
(wallet-func WALLET PRODUCT USER SERVER DATABASE PORT)
|
|
|
|
|
|
|
|
|
|
It is expected to return either a string containing the password,
|
2019-12-24 02:37:08 +01:00
|
|
|
|
a function returning the password, or nil. If you want to support
|
2019-02-18 23:15:54 -05:00
|
|
|
|
another format of password file, then implement a different
|
|
|
|
|
search wallet function and identify the location of the password
|
|
|
|
|
store with `sql-password-wallet'.")
|
|
|
|
|
|
2011-11-14 15:59:56 -08:00
|
|
|
|
;; misc customization of sql.el behavior
|
1999-09-29 09:51:59 +00:00
|
|
|
|
|
2000-06-26 13:09:49 +00:00
|
|
|
|
(defcustom sql-electric-stuff nil
|
|
|
|
|
"Treat some input as electric.
|
|
|
|
|
If set to the symbol `semicolon', then hitting `;' will send current
|
|
|
|
|
input in the SQLi buffer to the process.
|
|
|
|
|
If set to the symbol `go', then hitting `go' on a line by itself will
|
|
|
|
|
send current input in the SQLi buffer to the process.
|
|
|
|
|
If set to nil, then you must use \\[comint-send-input] in order to send
|
|
|
|
|
current input in the SQLi buffer to the process."
|
|
|
|
|
:type '(choice (const :tag "Nothing" nil)
|
2010-04-24 04:59:23 +02:00
|
|
|
|
(const :tag "The semicolon `;'" semicolon)
|
2000-06-26 13:09:49 +00:00
|
|
|
|
(const :tag "The string `go' by itself" go))
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "20.8")
|
2000-06-26 13:09:49 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-send-terminator nil
|
|
|
|
|
"When non-nil, add a terminator to text sent to the SQL interpreter.
|
|
|
|
|
|
|
|
|
|
When text is sent to the SQL interpreter (via `sql-send-string',
|
|
|
|
|
`sql-send-region', `sql-send-paragraph' or `sql-send-buffer'), a
|
|
|
|
|
command terminator can be automatically sent as well. The
|
|
|
|
|
terminator is not sent, if the string sent already ends with the
|
|
|
|
|
terminator.
|
|
|
|
|
|
|
|
|
|
If this value is t, then the default command terminator for the
|
|
|
|
|
SQL interpreter is sent. If this value is a string, then the
|
|
|
|
|
string is sent.
|
|
|
|
|
|
|
|
|
|
If the value is a cons cell of the form (PAT . TERM), then PAT is
|
|
|
|
|
a regexp used to match the terminator in the string and TERM is
|
|
|
|
|
the terminator to be sent. This form is useful if the SQL
|
|
|
|
|
interpreter has more than one way of submitting a SQL command.
|
|
|
|
|
The PAT regexp can match any of them, and TERM is the way we do
|
|
|
|
|
it automatically."
|
|
|
|
|
|
|
|
|
|
:type '(choice (const :tag "No Terminator" nil)
|
|
|
|
|
(const :tag "Default Terminator" t)
|
|
|
|
|
(string :tag "Terminator String")
|
|
|
|
|
(cons :tag "Terminator Pattern and String"
|
2019-12-21 18:52:06 +01:00
|
|
|
|
(regexp :tag "Terminator Pattern")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(string :tag "Terminator String")))
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "22.2")
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(defvar sql-contains-names nil
|
|
|
|
|
"When non-nil, the current buffer contains database names.
|
|
|
|
|
|
|
|
|
|
Globally should be set to nil; it will be non-nil in `sql-mode',
|
|
|
|
|
`sql-interactive-mode' and list all buffers.")
|
|
|
|
|
|
2014-02-15 17:50:45 -05:00
|
|
|
|
(defvar sql-login-delay 7.5 ;; Secs
|
|
|
|
|
"Maximum number of seconds you are willing to wait for a login connection.")
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(defvaralias 'sql-pop-to-buffer-after-send-region 'sql-display-sqli-buffer-function)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2019-02-20 09:25:54 -05:00
|
|
|
|
(defcustom sql-display-sqli-buffer-function #'display-buffer
|
2018-06-02 19:21:31 -04:00
|
|
|
|
"Function to be called to display a SQLi buffer after `sql-send-*'.
|
|
|
|
|
|
|
|
|
|
When set to a function, it will be called to display the buffer.
|
|
|
|
|
When set to t, the default function `pop-to-buffer' will be
|
|
|
|
|
called. If not set, no attempt will be made to display the
|
|
|
|
|
buffer."
|
|
|
|
|
|
|
|
|
|
:type '(choice (const :tag "Default" t)
|
|
|
|
|
(const :tag "No display" nil)
|
|
|
|
|
(function :tag "Display Buffer function"))
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "27.1")
|
1999-02-19 04:24:12 +00:00
|
|
|
|
|
1999-09-29 09:51:59 +00:00
|
|
|
|
;; imenu support for sql-mode.
|
|
|
|
|
|
|
|
|
|
(defvar sql-imenu-generic-expression
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Items are in reverse order because they are rendered in reverse.
|
2013-01-14 22:21:56 -05:00
|
|
|
|
'(("Rules/Defaults" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*\\(?:rule\\|default\\)\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\s-+\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
|
|
|
|
|
("Sequences" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*sequence\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
|
|
|
|
|
("Triggers" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*trigger\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
|
|
|
|
|
("Functions" "^\\s-*\\(?:create\\s-+\\(?:\\w+\\s-+\\)*\\)?function\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
|
|
|
|
|
("Procedures" "^\\s-*\\(?:create\\s-+\\(?:\\w+\\s-+\\)*\\)?proc\\(?:edure\\)?\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
|
|
|
|
|
("Packages" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*package\\s-+\\(?:body\\s-+\\)?\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
|
|
|
|
|
("Types" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*type\\s-+\\(?:body\\s-+\\)?\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
|
|
|
|
|
("Indexes" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*index\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
|
|
|
|
|
("Tables/Views" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*\\(?:table\\|view\\)\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1))
|
1999-09-29 09:51:59 +00:00
|
|
|
|
"Define interesting points in the SQL buffer for `imenu'.
|
|
|
|
|
|
2000-06-26 13:09:49 +00:00
|
|
|
|
This is used to set `imenu-generic-expression' when SQL mode is
|
2010-04-24 04:59:23 +02:00
|
|
|
|
entered. Subsequent changes to `sql-imenu-generic-expression' will
|
2018-06-02 19:21:31 -04:00
|
|
|
|
not affect existing SQL buffers because `imenu-generic-expression' is
|
2010-04-24 04:59:23 +02:00
|
|
|
|
a local variable.")
|
1999-09-29 09:51:59 +00:00
|
|
|
|
|
|
|
|
|
;; history file
|
|
|
|
|
|
1999-02-19 04:24:12 +00:00
|
|
|
|
(defcustom sql-input-ring-file-name nil
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"If non-nil, name of the file to read/write input history.
|
1999-02-19 04:24:12 +00:00
|
|
|
|
|
1999-06-17 05:35:21 +00:00
|
|
|
|
You have to set this variable if you want the history of your commands
|
|
|
|
|
saved from one Emacs session to the next. If this variable is set,
|
|
|
|
|
exiting the SQL interpreter in an SQLi buffer will write the input
|
|
|
|
|
history to the specified file. Starting a new process in a SQLi buffer
|
|
|
|
|
will read the input history from the specified file.
|
|
|
|
|
|
2000-07-27 20:06:37 +00:00
|
|
|
|
This is used to initialize `comint-input-ring-file-name'.
|
|
|
|
|
|
|
|
|
|
Note that the size of the input history is determined by the variable
|
|
|
|
|
`comint-input-ring-size'."
|
1999-02-19 04:24:12 +00:00
|
|
|
|
:type '(choice (const :tag "none" nil)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
(file)))
|
1999-02-19 04:24:12 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-input-ring-separator "\n--\n"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Separator between commands in the history file.
|
1999-02-19 04:24:12 +00:00
|
|
|
|
|
|
|
|
|
If set to \"\\n\", each line in the history file will be interpreted as
|
|
|
|
|
one command. Multi-line commands are split into several commands when
|
|
|
|
|
the input ring is initialized from a history file.
|
|
|
|
|
|
2021-10-08 21:02:14 +02:00
|
|
|
|
This variable used to initialize `comint-input-ring-separator'."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'string)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;; The usual hooks
|
|
|
|
|
|
2018-10-01 00:12:51 -04:00
|
|
|
|
(defcustom sql-interactive-mode-hook '(sql-indent-enable)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Hook for customizing `sql-interactive-mode'."
|
1999-01-11 15:26:36 +00:00
|
|
|
|
:type 'hook
|
2018-10-01 00:12:51 -04:00
|
|
|
|
:version "27.1")
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2018-10-01 00:12:51 -04:00
|
|
|
|
(defcustom sql-mode-hook '(sql-indent-enable)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Hook for customizing `sql-mode'."
|
1999-01-11 15:26:36 +00:00
|
|
|
|
:type 'hook
|
2018-10-01 00:12:51 -04:00
|
|
|
|
:version "27.1")
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-02-19 04:24:12 +00:00
|
|
|
|
(defcustom sql-set-sqli-hook '()
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Hook for reacting to changes of `sql-buffer'.
|
1999-02-19 04:24:12 +00:00
|
|
|
|
|
|
|
|
|
This is called by `sql-set-sqli-buffer' when the value of `sql-buffer'
|
|
|
|
|
is changed."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'hook)
|
1999-02-19 04:24:12 +00:00
|
|
|
|
|
2012-01-04 22:45:30 -05:00
|
|
|
|
(defcustom sql-login-hook '()
|
|
|
|
|
"Hook for interacting with a buffer in `sql-interactive-mode'.
|
|
|
|
|
|
|
|
|
|
This hook is invoked in a buffer once it is ready to accept input
|
|
|
|
|
for the first time."
|
Add missing :version tags to new defgroups and defcustoms
* window.el (window-sides-slots):
* tool-bar.el (tool-bar-position):
* term/xterm.el (xterm-extra-capabilities):
* ses.el (ses-self-reference-early-detection):
* progmodes/verilog-mode.el (verilog-auto-declare-nettype)
(verilog-auto-wire-type)
(verilog-auto-delete-trailing-whitespace)
(verilog-auto-reset-blocking-in-non, verilog-auto-inst-sort)
(verilog-auto-tieoff-declaration):
* progmodes/sql.el (sql-login-hook, sql-ansi-statement-starters)
(sql-oracle-statement-starters, sql-oracle-scan-on):
* progmodes/prolog.el (prolog-align-comments-flag)
(prolog-indent-mline-comments-flag, prolog-object-end-to-0-flag)
(prolog-left-indent-regexp, prolog-paren-indent-p)
(prolog-paren-indent, prolog-parse-mode, prolog-keywords)
(prolog-types, prolog-mode-specificators)
(prolog-determinism-specificators, prolog-directives)
(prolog-electric-newline-flag, prolog-hungry-delete-key-flag)
(prolog-electric-dot-flag)
(prolog-electric-dot-full-predicate-template)
(prolog-electric-underscore-flag, prolog-electric-tab-flag)
(prolog-electric-if-then-else-flag, prolog-electric-colon-flag)
(prolog-electric-dash-flag, prolog-old-sicstus-keys-flag)
(prolog-program-switches, prolog-prompt-regexp)
(prolog-debug-on-string, prolog-debug-off-string)
(prolog-trace-on-string, prolog-trace-off-string)
(prolog-zip-on-string, prolog-zip-off-string)
(prolog-use-standard-consult-compile-method-flag)
(prolog-use-prolog-tokenizer-flag, prolog-imenu-flag)
(prolog-imenu-max-lines, prolog-info-predicate-index)
(prolog-underscore-wordchar-flag, prolog-use-sicstus-sd)
(prolog-char-quote-workaround):
* progmodes/cc-vars.el (c-defun-tactic):
* net/tramp.el (tramp-encoding-command-interactive)
(tramp-local-end-of-line):
* net/soap-client.el (soap-client):
* net/netrc.el (netrc-file):
* net/gnutls.el (gnutls):
* minibuffer.el (completion-category-overrides)
(completion-cycle-threshold)
(completion-pcm-complete-word-inserts-delimiters):
* man.el (Man-name-local-regexp):
* mail/feedmail.el (feedmail-display-full-frame):
* international/characters.el (glyphless-char-display-control):
* eshell/em-ls.el (eshell-ls-date-format):
* emacs-lisp/cl-indent.el (lisp-lambda-list-keyword-alignment)
(lisp-lambda-list-keyword-parameter-indentation)
(lisp-lambda-list-keyword-parameter-alignment):
* doc-view.el (doc-view-image-width, doc-view-unoconv-program):
* dired-x.el (dired-omit-verbose):
* cus-theme.el (custom-theme-allow-multiple-selections):
* calc/calc.el (calc-highlight-selections-with-faces)
(calc-lu-field-reference, calc-lu-power-reference)
(calc-note-threshold):
* battery.el (battery-mode-line-limit):
* arc-mode.el (archive-7z-extract, archive-7z-expunge)
(archive-7z-update):
* allout.el (allout-prefixed-keybindings)
(allout-unprefixed-keybindings)
(allout-inhibit-auto-fill-on-headline)
(allout-flattened-numbering-abbreviation):
* allout-widgets.el (allout-widgets-auto-activation)
(allout-widgets-icons-dark-subdir)
(allout-widgets-icons-light-subdir, allout-widgets-icon-types)
(allout-widgets-theme-dark-background)
(allout-widgets-theme-light-background)
(allout-widgets-item-image-properties-emacs)
(allout-widgets-item-image-properties-xemacs)
(allout-widgets-run-unit-tests-on-load)
(allout-widgets-time-decoration-activity)
(allout-widgets-hook-error-post-time)
(allout-widgets-track-decoration):
* gnus/sieve-manage.el (sieve-manage-default-stream):
* gnus/shr.el (shr):
* gnus/nnir.el (nnir-ignored-newsgroups, nnir-summary-line-format)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-notmuch-program)
(nnir-notmuch-additional-switches, nnir-notmuch-remove-prefix)
(nnir-method-default-engines):
* gnus/message.el (message-cite-reply-position):
* gnus/gssapi.el (gssapi-program):
* gnus/gravatar.el (gravatar):
* gnus/gnus-sum.el (gnus-refer-thread-use-nnir):
* gnus/gnus-registry.el (gnus-registry-unfollowed-addresses)
(gnus-registry-max-pruned-entries):
* gnus/gnus-picon.el (gnus-picon-inhibit-top-level-domains):
* gnus/gnus-int.el (gnus-after-set-mark-hook)
(gnus-before-update-mark-hook):
* gnus/gnus-async.el (gnus-async-post-fetch-function):
* gnus/auth-source.el (auth-source-cache-expiry):
Add missing :version tags to new defcustoms and defgroups.
2012-02-11 14:13:29 -08:00
|
|
|
|
:version "24.1"
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'hook)
|
2012-01-04 22:45:30 -05:00
|
|
|
|
|
2001-03-06 12:26:35 +00:00
|
|
|
|
;; Customization for Oracle
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-oracle-program "sqlplus"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Command to start sqlplus by Oracle.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
Starts `sql-interactive-mode' after doing some setup.
|
|
|
|
|
|
2010-05-14 15:31:36 +02:00
|
|
|
|
On Windows, \"sqlplus\" usually starts the sqlplus \"GUI\". In order
|
|
|
|
|
to start the sqlplus console, use \"plus33\" or something similar.
|
|
|
|
|
You will find the file in your Orant\\bin directory."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
1999-02-06 05:09:31 +00:00
|
|
|
|
|
2014-02-15 17:50:45 -05:00
|
|
|
|
(defcustom sql-oracle-options '("-L")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of additional options for `sql-oracle-program'."
|
2000-06-26 13:09:49 +00:00
|
|
|
|
:type '(repeat string)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.4")
|
2000-06-26 13:09:49 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-oracle-login-params '(user password database)
|
|
|
|
|
"List of login parameters needed to connect to Oracle."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
(defcustom sql-oracle-scan-on t
|
|
|
|
|
"Non-nil if placeholders should be replaced in Oracle SQLi.
|
|
|
|
|
|
|
|
|
|
When non-nil, Emacs will scan text sent to sqlplus and prompt
|
|
|
|
|
for replacement text for & placeholders as sqlplus does. This
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
is needed on Windows where SQL*Plus output is buffered and the
|
2010-05-09 22:07:58 -04:00
|
|
|
|
prompts are not shown until after the text is entered.
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
You need to issue the following command in SQL*Plus to be safe:
|
|
|
|
|
|
|
|
|
|
SET DEFINE OFF
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
In older versions of SQL*Plus, this was the SET SCAN OFF command."
|
Add missing :version tags to new defgroups and defcustoms
* window.el (window-sides-slots):
* tool-bar.el (tool-bar-position):
* term/xterm.el (xterm-extra-capabilities):
* ses.el (ses-self-reference-early-detection):
* progmodes/verilog-mode.el (verilog-auto-declare-nettype)
(verilog-auto-wire-type)
(verilog-auto-delete-trailing-whitespace)
(verilog-auto-reset-blocking-in-non, verilog-auto-inst-sort)
(verilog-auto-tieoff-declaration):
* progmodes/sql.el (sql-login-hook, sql-ansi-statement-starters)
(sql-oracle-statement-starters, sql-oracle-scan-on):
* progmodes/prolog.el (prolog-align-comments-flag)
(prolog-indent-mline-comments-flag, prolog-object-end-to-0-flag)
(prolog-left-indent-regexp, prolog-paren-indent-p)
(prolog-paren-indent, prolog-parse-mode, prolog-keywords)
(prolog-types, prolog-mode-specificators)
(prolog-determinism-specificators, prolog-directives)
(prolog-electric-newline-flag, prolog-hungry-delete-key-flag)
(prolog-electric-dot-flag)
(prolog-electric-dot-full-predicate-template)
(prolog-electric-underscore-flag, prolog-electric-tab-flag)
(prolog-electric-if-then-else-flag, prolog-electric-colon-flag)
(prolog-electric-dash-flag, prolog-old-sicstus-keys-flag)
(prolog-program-switches, prolog-prompt-regexp)
(prolog-debug-on-string, prolog-debug-off-string)
(prolog-trace-on-string, prolog-trace-off-string)
(prolog-zip-on-string, prolog-zip-off-string)
(prolog-use-standard-consult-compile-method-flag)
(prolog-use-prolog-tokenizer-flag, prolog-imenu-flag)
(prolog-imenu-max-lines, prolog-info-predicate-index)
(prolog-underscore-wordchar-flag, prolog-use-sicstus-sd)
(prolog-char-quote-workaround):
* progmodes/cc-vars.el (c-defun-tactic):
* net/tramp.el (tramp-encoding-command-interactive)
(tramp-local-end-of-line):
* net/soap-client.el (soap-client):
* net/netrc.el (netrc-file):
* net/gnutls.el (gnutls):
* minibuffer.el (completion-category-overrides)
(completion-cycle-threshold)
(completion-pcm-complete-word-inserts-delimiters):
* man.el (Man-name-local-regexp):
* mail/feedmail.el (feedmail-display-full-frame):
* international/characters.el (glyphless-char-display-control):
* eshell/em-ls.el (eshell-ls-date-format):
* emacs-lisp/cl-indent.el (lisp-lambda-list-keyword-alignment)
(lisp-lambda-list-keyword-parameter-indentation)
(lisp-lambda-list-keyword-parameter-alignment):
* doc-view.el (doc-view-image-width, doc-view-unoconv-program):
* dired-x.el (dired-omit-verbose):
* cus-theme.el (custom-theme-allow-multiple-selections):
* calc/calc.el (calc-highlight-selections-with-faces)
(calc-lu-field-reference, calc-lu-power-reference)
(calc-note-threshold):
* battery.el (battery-mode-line-limit):
* arc-mode.el (archive-7z-extract, archive-7z-expunge)
(archive-7z-update):
* allout.el (allout-prefixed-keybindings)
(allout-unprefixed-keybindings)
(allout-inhibit-auto-fill-on-headline)
(allout-flattened-numbering-abbreviation):
* allout-widgets.el (allout-widgets-auto-activation)
(allout-widgets-icons-dark-subdir)
(allout-widgets-icons-light-subdir, allout-widgets-icon-types)
(allout-widgets-theme-dark-background)
(allout-widgets-theme-light-background)
(allout-widgets-item-image-properties-emacs)
(allout-widgets-item-image-properties-xemacs)
(allout-widgets-run-unit-tests-on-load)
(allout-widgets-time-decoration-activity)
(allout-widgets-hook-error-post-time)
(allout-widgets-track-decoration):
* gnus/sieve-manage.el (sieve-manage-default-stream):
* gnus/shr.el (shr):
* gnus/nnir.el (nnir-ignored-newsgroups, nnir-summary-line-format)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-notmuch-program)
(nnir-notmuch-additional-switches, nnir-notmuch-remove-prefix)
(nnir-method-default-engines):
* gnus/message.el (message-cite-reply-position):
* gnus/gssapi.el (gssapi-program):
* gnus/gravatar.el (gravatar):
* gnus/gnus-sum.el (gnus-refer-thread-use-nnir):
* gnus/gnus-registry.el (gnus-registry-unfollowed-addresses)
(gnus-registry-max-pruned-entries):
* gnus/gnus-picon.el (gnus-picon-inhibit-top-level-domains):
* gnus/gnus-int.el (gnus-after-set-mark-hook)
(gnus-before-update-mark-hook):
* gnus/gnus-async.el (gnus-async-post-fetch-function):
* gnus/auth-source.el (auth-source-cache-expiry):
Add missing :version tags to new defcustoms and defgroups.
2012-02-11 14:13:29 -08:00
|
|
|
|
:version "24.1"
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'boolean)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2012-09-10 15:22:53 -04:00
|
|
|
|
(defcustom sql-db2-escape-newlines nil
|
|
|
|
|
"Non-nil if newlines should be escaped by a backslash in DB2 SQLi.
|
|
|
|
|
|
|
|
|
|
When non-nil, Emacs will automatically insert a space and
|
|
|
|
|
backslash prior to every newline in multi-line SQL statements as
|
|
|
|
|
they are submitted to an interactive DB2 session."
|
|
|
|
|
:version "24.3"
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'boolean)
|
2012-09-10 15:22:53 -04:00
|
|
|
|
|
2003-06-17 20:58:37 +00:00
|
|
|
|
;; Customization for SQLite
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defcustom sql-sqlite-program (or (executable-find "sqlite3")
|
|
|
|
|
(executable-find "sqlite")
|
|
|
|
|
"sqlite")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Command to start SQLite.
|
2003-06-17 20:58:37 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
2003-06-17 20:58:37 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-sqlite-options nil
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of additional options for `sql-sqlite-program'."
|
2003-06-17 20:58:37 +00:00
|
|
|
|
:type '(repeat string)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "20.8")
|
2003-06-17 20:58:37 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defcustom sql-sqlite-login-params '((database :file nil
|
|
|
|
|
:must-match confirm))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of login parameters needed to connect to SQLite."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "26.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2018-06-10 20:01:36 -04:00
|
|
|
|
;; Customization for MariaDB
|
|
|
|
|
|
|
|
|
|
;; MariaDB is a drop-in replacement for MySQL, so just make the
|
|
|
|
|
;; MariaDB variables aliases of the MySQL ones.
|
|
|
|
|
|
|
|
|
|
(defvaralias 'sql-mariadb-program 'sql-mysql-program)
|
|
|
|
|
(defvaralias 'sql-mariadb-options 'sql-mysql-options)
|
|
|
|
|
(defvaralias 'sql-mariadb-login-params 'sql-mysql-login-params)
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Customization for MySQL
|
1999-02-06 05:09:31 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-mysql-program "mysql"
|
2018-06-10 20:01:36 -04:00
|
|
|
|
"Command to start mysql by Oracle.
|
1999-02-06 05:09:31 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
2000-10-05 15:26:13 +00:00
|
|
|
|
(defcustom sql-mysql-options nil
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of additional options for `sql-mysql-program'.
|
2000-12-19 10:09:25 +00:00
|
|
|
|
The following list of options is reported to make things work
|
|
|
|
|
on Windows: \"-C\" \"-t\" \"-f\" \"-n\"."
|
2000-10-05 15:26:13 +00:00
|
|
|
|
:type '(repeat string)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "20.8")
|
2000-10-05 15:26:13 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-mysql-login-params '(user password database server)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"List of login parameters needed to connect to MySQL."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2001-03-06 12:26:35 +00:00
|
|
|
|
;; Customization for Solid
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-solid-program "solsql"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Command to start SOLID SQL Editor.
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-solid-login-params '(user password server)
|
|
|
|
|
"List of login parameters needed to connect to Solid."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2010-05-14 15:31:36 +02:00
|
|
|
|
;; Customization for Sybase
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-sybase-program "isql"
|
2010-05-14 15:31:36 +02:00
|
|
|
|
"Command to start isql by Sybase.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2000-10-18 14:38:55 +00:00
|
|
|
|
(defcustom sql-sybase-options nil
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of additional options for `sql-sybase-program'.
|
2000-10-18 14:38:55 +00:00
|
|
|
|
Some versions of isql might require the -n option in order to work."
|
|
|
|
|
:type '(repeat string)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "20.8")
|
2000-10-18 14:38:55 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-sybase-login-params '(server user password database)
|
|
|
|
|
"List of login parameters needed to connect to Sybase."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2001-03-06 12:26:35 +00:00
|
|
|
|
;; Customization for Informix
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-informix-program "dbaccess"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Command to start dbaccess by Informix.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-informix-login-params '(database)
|
|
|
|
|
"List of login parameters needed to connect to Informix."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2001-03-06 12:26:35 +00:00
|
|
|
|
;; Customization for Ingres
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-ingres-program "sql"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Command to start sql by Ingres.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-ingres-login-params '(database)
|
|
|
|
|
"List of login parameters needed to connect to Ingres."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2001-03-06 12:26:35 +00:00
|
|
|
|
;; Customization for Microsoft
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2019-04-21 00:40:00 -04:00
|
|
|
|
;; Microsoft documentation seems to indicate that ISQL and OSQL are
|
|
|
|
|
;; going away and being replaced by SQLCMD. If anyone has experience
|
|
|
|
|
;; using SQLCMD, modified product configuration and feedback on its
|
|
|
|
|
;; use would be greatly appreciated.
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(defcustom sql-ms-program "osql"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Command to start osql by Microsoft.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2002-11-21 08:32:06 +00:00
|
|
|
|
(defcustom sql-ms-options '("-w" "300" "-n")
|
|
|
|
|
;; -w is the linesize
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of additional options for `sql-ms-program'."
|
2002-11-21 08:32:06 +00:00
|
|
|
|
:type '(repeat string)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "22.1")
|
2002-11-21 08:32:06 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-ms-login-params '(user password server database)
|
|
|
|
|
"List of login parameters needed to connect to Microsoft."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2001-03-06 12:26:35 +00:00
|
|
|
|
;; Customization for Postgres
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-postgres-program "psql"
|
1999-09-29 09:51:59 +00:00
|
|
|
|
"Command to start psql by Postgres.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2000-12-19 10:09:25 +00:00
|
|
|
|
(defcustom sql-postgres-options '("-P" "pager=off")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of additional options for `sql-postgres-program'.
|
2001-08-20 10:02:07 +00:00
|
|
|
|
The default setting includes the -P option which breaks older versions
|
|
|
|
|
of the psql client (such as version 6.5.3). The -P option is equivalent
|
|
|
|
|
to the --pset option. If you want the psql to prompt you for a user
|
|
|
|
|
name, add the string \"-u\" to the list of options. If you want to
|
|
|
|
|
provide a user name on the command line (newer versions such as 7.1),
|
|
|
|
|
add your name with a \"-U\" prefix (such as \"-Umark\") to the list."
|
2000-09-05 10:44:21 +00:00
|
|
|
|
:type '(repeat string)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "20.8")
|
2000-09-05 10:44:21 +00:00
|
|
|
|
|
2016-11-15 19:08:22 +01:00
|
|
|
|
(defcustom sql-postgres-login-params
|
|
|
|
|
`((user :default ,(user-login-name))
|
|
|
|
|
(database :default ,(user-login-name)
|
|
|
|
|
:completion ,(completion-table-dynamic
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(lambda (_) (sql-postgres-list-databases)))
|
|
|
|
|
:must-match confirm)
|
2016-11-15 19:08:22 +01:00
|
|
|
|
server)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of login parameters needed to connect to Postgres."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "26.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2016-11-15 19:08:22 +01:00
|
|
|
|
(defun sql-postgres-list-databases ()
|
|
|
|
|
"Return a list of available PostgreSQL databases."
|
|
|
|
|
(when (executable-find sql-postgres-program)
|
|
|
|
|
(let ((res '()))
|
2017-08-09 15:34:34 +02:00
|
|
|
|
(ignore-errors
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(dolist (row (process-lines sql-postgres-program
|
|
|
|
|
"--list"
|
|
|
|
|
"--no-psqlrc"
|
|
|
|
|
"--tuples-only"))
|
|
|
|
|
(when (string-match "^ \\([^ |]+\\) +|.*" row)
|
2017-08-09 15:34:34 +02:00
|
|
|
|
(push (match-string 1 row) res))))
|
2016-11-15 19:08:22 +01:00
|
|
|
|
(nreverse res))))
|
|
|
|
|
|
2001-03-06 12:26:35 +00:00
|
|
|
|
;; Customization for Interbase
|
|
|
|
|
|
|
|
|
|
(defcustom sql-interbase-program "isql"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Command to start isql by Interbase.
|
2001-03-06 12:26:35 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
2001-03-06 12:26:35 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-interbase-options nil
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of additional options for `sql-interbase-program'."
|
2001-03-06 12:26:35 +00:00
|
|
|
|
:type '(repeat string)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "20.8")
|
2001-03-06 12:26:35 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-interbase-login-params '(user password database)
|
|
|
|
|
"List of login parameters needed to connect to Interbase."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2001-04-20 10:03:48 +00:00
|
|
|
|
;; Customization for DB2
|
|
|
|
|
|
|
|
|
|
(defcustom sql-db2-program "db2"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Command to start db2 by IBM.
|
2001-04-20 10:03:48 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
2001-04-20 10:03:48 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-db2-options nil
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of additional options for `sql-db2-program'."
|
2001-04-20 10:03:48 +00:00
|
|
|
|
:type '(repeat string)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "20.8")
|
2001-04-20 10:03:48 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-db2-login-params nil
|
|
|
|
|
"List of login parameters needed to connect to DB2."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2002-11-21 08:32:06 +00:00
|
|
|
|
;; Customization for Linter
|
|
|
|
|
|
|
|
|
|
(defcustom sql-linter-program "inl"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Command to start inl by RELEX.
|
2002-11-21 08:32:06 +00:00
|
|
|
|
|
|
|
|
|
Starts `sql-interactive-mode' after doing some setup."
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
2002-11-21 08:32:06 +00:00
|
|
|
|
|
|
|
|
|
(defcustom sql-linter-options nil
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"List of additional options for `sql-linter-program'."
|
2002-11-21 08:32:06 +00:00
|
|
|
|
:type '(repeat string)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "21.3")
|
2002-11-21 08:32:06 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defcustom sql-linter-login-params '(user password database server)
|
|
|
|
|
"Login parameters to needed to connect to Linter."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
:type 'sql-login-params
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:version "24.1")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Variables which do not need customization
|
|
|
|
|
|
|
|
|
|
(defvar sql-user-history nil
|
|
|
|
|
"History of usernames used.")
|
|
|
|
|
|
|
|
|
|
(defvar sql-database-history nil
|
|
|
|
|
"History of databases used.")
|
|
|
|
|
|
|
|
|
|
(defvar sql-server-history nil
|
|
|
|
|
"History of servers used.")
|
|
|
|
|
|
|
|
|
|
;; Passwords are not kept in a history.
|
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(defvar sql-product-history nil
|
|
|
|
|
"History of products used.")
|
|
|
|
|
|
|
|
|
|
(defvar sql-connection-history nil
|
|
|
|
|
"History of connections used.")
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(defvar sql-buffer nil
|
1999-02-13 12:04:00 +00:00
|
|
|
|
"Current SQLi buffer.
|
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The global value of `sql-buffer' is the name of the latest SQLi buffer
|
1999-02-13 12:04:00 +00:00
|
|
|
|
created. Any SQL buffer created will make a local copy of this value.
|
|
|
|
|
See `sql-interactive-mode' for more on multiple sessions. If you want
|
|
|
|
|
to change the SQLi buffer a SQL mode sends its SQL strings to, change
|
1999-02-19 04:24:12 +00:00
|
|
|
|
the local value of `sql-buffer' using \\[sql-set-sqli-buffer].")
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defvar sql-prompt-regexp nil
|
|
|
|
|
"Prompt used to initialize `comint-prompt-regexp'.
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
You can change `sql-prompt-regexp' on `sql-interactive-mode-hook'.")
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-02-06 05:09:31 +00:00
|
|
|
|
(defvar sql-prompt-length 0
|
|
|
|
|
"Prompt used to set `left-margin' in `sql-interactive-mode'.
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
You can change `sql-prompt-length' on `sql-interactive-mode-hook'.")
|
1999-02-06 05:09:31 +00:00
|
|
|
|
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(defvar sql-prompt-cont-regexp nil
|
|
|
|
|
"Prompt pattern of statement continuation prompts.")
|
|
|
|
|
|
1999-02-19 04:24:12 +00:00
|
|
|
|
(defvar sql-alternate-buffer-name nil
|
|
|
|
|
"Buffer-local string used to possibly rename the SQLi buffer.
|
|
|
|
|
|
|
|
|
|
Used by `sql-rename-buffer'.")
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(defun sql-buffer-live-p (buffer &optional product connection)
|
2012-12-06 12:29:30 -05:00
|
|
|
|
"Return non-nil if the process associated with buffer is live.
|
2010-09-13 16:05:23 -04:00
|
|
|
|
|
|
|
|
|
BUFFER can be a buffer object or a buffer name. The buffer must
|
2012-12-06 12:29:30 -05:00
|
|
|
|
be a live buffer, have a running process attached to it, be in
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
`sql-interactive-mode', and, if PRODUCT or CONNECTION are
|
|
|
|
|
specified, it's `sql-product' or `sql-connection' must match."
|
2010-09-13 16:05:23 -04:00
|
|
|
|
|
|
|
|
|
(when buffer
|
|
|
|
|
(setq buffer (get-buffer buffer))
|
|
|
|
|
(and buffer
|
|
|
|
|
(buffer-live-p buffer)
|
|
|
|
|
(comint-check-proc buffer)
|
|
|
|
|
(with-current-buffer buffer
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(and (derived-mode-p 'sql-interactive-mode)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(or (not product)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(eq product sql-product))
|
2018-07-11 05:28:21 +03:00
|
|
|
|
(or (not connection)
|
|
|
|
|
(and (stringp connection)
|
|
|
|
|
(string= connection sql-connection))))))))
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
|
2019-04-24 20:59:25 -04:00
|
|
|
|
(defun sql-is-sqli-buffer-p (buffer)
|
|
|
|
|
"Return non-nil if buffer is a SQLi buffer."
|
|
|
|
|
(when buffer
|
|
|
|
|
(setq buffer (get-buffer buffer))
|
|
|
|
|
(and buffer
|
|
|
|
|
(buffer-live-p buffer)
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(derived-mode-p 'sql-interactive-mode)))))
|
|
|
|
|
|
2000-06-26 13:09:49 +00:00
|
|
|
|
;; Keymap for sql-interactive-mode.
|
|
|
|
|
|
2002-11-21 08:32:06 +00:00
|
|
|
|
(defvar sql-interactive-mode-map
|
2000-06-26 13:09:49 +00:00
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2020-03-14 15:39:31 -04:00
|
|
|
|
(set-keymap-parent map comint-mode-map)
|
2000-06-26 13:09:49 +00:00
|
|
|
|
(define-key map (kbd "C-j") 'sql-accumulate-and-indent)
|
|
|
|
|
(define-key map (kbd "C-c C-w") 'sql-copy-column)
|
|
|
|
|
(define-key map (kbd "O") 'sql-magic-go)
|
|
|
|
|
(define-key map (kbd "o") 'sql-magic-go)
|
|
|
|
|
(define-key map (kbd ";") 'sql-magic-semicolon)
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(define-key map (kbd "C-c C-l a") 'sql-list-all)
|
|
|
|
|
(define-key map (kbd "C-c C-l t") 'sql-list-table)
|
2000-06-26 13:09:49 +00:00
|
|
|
|
map)
|
|
|
|
|
"Mode map used for `sql-interactive-mode'.
|
|
|
|
|
Based on `comint-mode-map'.")
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;; Keymap for sql-mode.
|
|
|
|
|
|
|
|
|
|
(defvar sql-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2000-06-26 13:09:49 +00:00
|
|
|
|
(define-key map (kbd "C-c C-c") 'sql-send-paragraph)
|
|
|
|
|
(define-key map (kbd "C-c C-r") 'sql-send-region)
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(define-key map (kbd "C-c C-s") 'sql-send-string)
|
2000-06-26 13:09:49 +00:00
|
|
|
|
(define-key map (kbd "C-c C-b") 'sql-send-buffer)
|
2014-09-08 08:27:19 -04:00
|
|
|
|
(define-key map (kbd "C-c C-n") 'sql-send-line-and-next)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(define-key map (kbd "C-c C-i") 'sql-product-interactive)
|
2014-09-08 08:31:54 -04:00
|
|
|
|
(define-key map (kbd "C-c C-z") 'sql-show-sqli-buffer)
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(define-key map (kbd "C-c C-l a") 'sql-list-all)
|
|
|
|
|
(define-key map (kbd "C-c C-l t") 'sql-list-table)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(define-key map [remap beginning-of-defun] 'sql-beginning-of-statement)
|
|
|
|
|
(define-key map [remap end-of-defun] 'sql-end-of-statement)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
map)
|
|
|
|
|
"Mode map used for `sql-mode'.")
|
|
|
|
|
|
|
|
|
|
;; easy menu for sql-mode.
|
|
|
|
|
|
1999-09-29 09:51:59 +00:00
|
|
|
|
(easy-menu-define
|
|
|
|
|
sql-mode-menu sql-mode-map
|
1999-01-11 15:26:36 +00:00
|
|
|
|
"Menu for `sql-mode'."
|
2009-08-16 15:48:15 +00:00
|
|
|
|
`("SQL"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
["Send Paragraph" sql-send-paragraph (sql-buffer-live-p sql-buffer)]
|
2010-05-09 22:07:58 -04:00
|
|
|
|
["Send Region" sql-send-region (and mark-active
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(sql-buffer-live-p sql-buffer))]
|
|
|
|
|
["Send Buffer" sql-send-buffer (sql-buffer-live-p sql-buffer)]
|
|
|
|
|
["Send String" sql-send-string (sql-buffer-live-p sql-buffer)]
|
2010-07-20 21:56:55 -04:00
|
|
|
|
"--"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
["List all objects" sql-list-all (and (sql-buffer-live-p sql-buffer)
|
|
|
|
|
(sql-get-product-feature sql-product :list-all))]
|
|
|
|
|
["List table details" sql-list-table (and (sql-buffer-live-p sql-buffer)
|
|
|
|
|
(sql-get-product-feature sql-product :list-table))]
|
2010-09-18 22:11:18 -04:00
|
|
|
|
"--"
|
2010-07-20 21:56:55 -04:00
|
|
|
|
["Start SQLi session" sql-product-interactive
|
|
|
|
|
:visible (not sql-connection-alist)
|
|
|
|
|
:enable (sql-get-product-feature sql-product :sqli-comint-func)]
|
|
|
|
|
("Start..."
|
|
|
|
|
:visible sql-connection-alist
|
|
|
|
|
:filter sql-connection-menu-filter
|
|
|
|
|
"--"
|
|
|
|
|
["New SQLi Session" sql-product-interactive (sql-get-product-feature sql-product :sqli-comint-func)])
|
|
|
|
|
["--"
|
|
|
|
|
:visible sql-connection-alist]
|
1999-02-13 12:04:00 +00:00
|
|
|
|
["Show SQLi buffer" sql-show-sqli-buffer t]
|
1999-02-19 04:24:12 +00:00
|
|
|
|
["Set SQLi buffer" sql-set-sqli-buffer t]
|
1999-09-29 09:51:59 +00:00
|
|
|
|
["Pop to SQLi buffer after send"
|
1999-01-11 15:26:36 +00:00
|
|
|
|
sql-toggle-pop-to-buffer-after-send-region
|
|
|
|
|
:style toggle
|
2001-04-20 10:03:48 +00:00
|
|
|
|
:selected sql-pop-to-buffer-after-send-region]
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
["--" nil nil]
|
|
|
|
|
("Product"
|
2009-08-16 15:48:15 +00:00
|
|
|
|
,@(mapcar (lambda (prod-info)
|
|
|
|
|
(let* ((prod (pop prod-info))
|
|
|
|
|
(name (or (plist-get prod-info :name)
|
|
|
|
|
(capitalize (symbol-name prod))))
|
|
|
|
|
(cmd (intern (format "sql-highlight-%s-keywords" prod))))
|
|
|
|
|
(fset cmd `(lambda () ,(format "Highlight %s SQL keywords." name)
|
|
|
|
|
(interactive)
|
|
|
|
|
(sql-set-product ',prod)))
|
|
|
|
|
(vector name cmd
|
|
|
|
|
:style 'radio
|
|
|
|
|
:selected `(eq sql-product ',prod))))
|
|
|
|
|
sql-product-alist))))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-02-19 04:24:12 +00:00
|
|
|
|
;; easy menu for sql-interactive-mode.
|
|
|
|
|
|
1999-09-29 09:51:59 +00:00
|
|
|
|
(easy-menu-define
|
1999-02-19 04:24:12 +00:00
|
|
|
|
sql-interactive-mode-menu sql-interactive-mode-map
|
|
|
|
|
"Menu for `sql-interactive-mode'."
|
|
|
|
|
'("SQL"
|
2010-07-20 21:56:55 -04:00
|
|
|
|
["Rename Buffer" sql-rename-buffer t]
|
2010-09-18 22:11:18 -04:00
|
|
|
|
["Save Connection" sql-save-connection (not sql-connection)]
|
|
|
|
|
"--"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
["List all objects" sql-list-all (sql-get-product-feature sql-product :list-all)]
|
|
|
|
|
["List table details" sql-list-table (sql-get-product-feature sql-product :list-table)]))
|
1999-02-19 04:24:12 +00:00
|
|
|
|
|
2012-09-17 13:41:04 +08:00
|
|
|
|
;; Abbreviations -- if you want more of them, define them in your init
|
|
|
|
|
;; file. Abbrevs have to be enabled in your init file, too.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(define-abbrev-table 'sql-mode-abbrev-table
|
|
|
|
|
'(("ins" "insert" nil nil t)
|
|
|
|
|
("upd" "update" nil nil t)
|
|
|
|
|
("del" "delete" nil nil t)
|
|
|
|
|
("sel" "select" nil nil t)
|
|
|
|
|
("proc" "procedure" nil nil t)
|
|
|
|
|
("func" "function" nil nil t)
|
|
|
|
|
("cr" "create" nil nil t))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
"Abbrev table used in `sql-mode' and `sql-interactive-mode'.")
|
|
|
|
|
|
|
|
|
|
;; Syntax Table
|
|
|
|
|
|
1999-09-29 09:51:59 +00:00
|
|
|
|
(defvar sql-mode-syntax-table
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(let ((table (make-syntax-table)))
|
|
|
|
|
;; C-style comments /**/ (see elisp manual "Syntax Flags"))
|
|
|
|
|
(modify-syntax-entry ?/ ". 14" table)
|
|
|
|
|
(modify-syntax-entry ?* ". 23" table)
|
2006-12-25 20:11:21 +00:00
|
|
|
|
;; double-dash starts comments
|
2004-05-04 21:59:40 +00:00
|
|
|
|
(modify-syntax-entry ?- ". 12b" table)
|
2006-12-25 20:11:21 +00:00
|
|
|
|
;; newline and formfeed end comments
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(modify-syntax-entry ?\n "> b" table)
|
|
|
|
|
(modify-syntax-entry ?\f "> b" table)
|
2006-12-25 20:11:21 +00:00
|
|
|
|
;; single quotes (') delimit strings
|
1999-02-06 05:09:31 +00:00
|
|
|
|
(modify-syntax-entry ?' "\"" table)
|
2006-12-25 20:11:21 +00:00
|
|
|
|
;; double quotes (") don't delimit strings
|
|
|
|
|
(modify-syntax-entry ?\" "." table)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Make these all punctuation
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(mapc (lambda (c) (modify-syntax-entry c "." table))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(string-to-list "!#$%&+,.:;<=>?@\\|"))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
table)
|
|
|
|
|
"Syntax table used in `sql-mode' and `sql-interactive-mode'.")
|
|
|
|
|
|
2021-05-27 22:52:11 +02:00
|
|
|
|
;; Motion Function Keywords
|
|
|
|
|
|
|
|
|
|
(defvar sql-ansi-statement-starters
|
|
|
|
|
(regexp-opt '("create" "alter" "drop"
|
|
|
|
|
"select" "insert" "update" "delete" "merge"
|
|
|
|
|
"grant" "revoke"))
|
|
|
|
|
"Regexp of keywords that start SQL commands.
|
|
|
|
|
|
|
|
|
|
All products share this list; products should define a regexp to
|
|
|
|
|
identify additional keywords in a variable defined by
|
|
|
|
|
the :statement feature.")
|
|
|
|
|
|
|
|
|
|
(defvar sql-oracle-statement-starters
|
|
|
|
|
(regexp-opt '("declare" "begin" "with"))
|
|
|
|
|
"Additional statement-starting keywords in Oracle.")
|
|
|
|
|
|
|
|
|
|
(defvar sql-postgres-statement-starters
|
|
|
|
|
(regexp-opt '("with"))
|
|
|
|
|
"Additional statement-starting keywords in Postgres.")
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
;; Font lock support
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(defvar sql-mode-font-lock-object-name
|
2006-12-25 20:11:21 +00:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(list (concat "^\\s-*\\(?:create\\|drop\\|alter\\)\\s-+" ;; lead off with CREATE, DROP or ALTER
|
|
|
|
|
"\\(?:\\w+\\s-+\\)*" ;; optional intervening keywords
|
|
|
|
|
"\\(?:table\\|view\\|\\(?:package\\|type\\)\\(?:\\s-+body\\)?\\|proc\\(?:edure\\)?"
|
|
|
|
|
"\\|function\\|trigger\\|sequence\\|rule\\|default\\)\\s-+"
|
2012-11-21 13:38:56 -08:00
|
|
|
|
"\\(?:if\\s-+not\\s-+exists\\s-+\\)?" ;; IF NOT EXISTS
|
2013-01-14 22:21:56 -05:00
|
|
|
|
"\\(\\w+\\(?:\\s-*[.]\\s-*\\w+\\)*\\)")
|
2006-12-25 20:11:21 +00:00
|
|
|
|
1 'font-lock-function-name-face))
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
|
|
|
|
"Pattern to match the names of top-level objects.
|
|
|
|
|
|
|
|
|
|
The pattern matches the name in a CREATE, DROP or ALTER
|
|
|
|
|
statement. The format of variable should be a valid
|
|
|
|
|
`font-lock-keywords' entry.")
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; While there are international and American standards for SQL, they
|
|
|
|
|
;; are not followed closely, and most vendors offer significant
|
|
|
|
|
;; capabilities beyond those defined in the standard specifications.
|
|
|
|
|
|
2011-11-26 20:43:11 -08:00
|
|
|
|
;; SQL mode provides support for highlighting based on the product. In
|
|
|
|
|
;; addition to highlighting the product keywords, any ANSI keywords not
|
|
|
|
|
;; used by the product are also highlighted. This will help identify
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; keywords that could be restricted in future versions of the product
|
|
|
|
|
;; or might be a problem if ported to another product.
|
|
|
|
|
|
|
|
|
|
;; To reduce the complexity and size of the regular expressions
|
|
|
|
|
;; generated to match keywords, ANSI keywords are filtered out of
|
|
|
|
|
;; product keywords if they are equivalent. To do this, we define a
|
|
|
|
|
;; function `sql-font-lock-keywords-builder' that removes any keywords
|
|
|
|
|
;; that are matched by the ANSI patterns and results in the same face
|
|
|
|
|
;; being applied. For this to work properly, we must play some games
|
|
|
|
|
;; with the execution and compile time behavior. This code is a
|
|
|
|
|
;; little tricky but works properly.
|
|
|
|
|
|
|
|
|
|
;; When defining the keywords for individual products you should
|
|
|
|
|
;; include all of the keywords that you want matched. The filtering
|
|
|
|
|
;; against the ANSI keywords will be automatic if you use the
|
|
|
|
|
;; `sql-font-lock-keywords-builder' function and follow the
|
|
|
|
|
;; implementation pattern used for the other products in this file.
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2021-04-11 22:34:58 -04:00
|
|
|
|
(defvar sql-mode-ansi-font-lock-keywords)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
(eval-and-compile
|
|
|
|
|
(defun sql-font-lock-keywords-builder (face boundaries &rest keywords)
|
|
|
|
|
"Generation of regexp matching any one of KEYWORDS."
|
|
|
|
|
|
|
|
|
|
(let ((bdy (or boundaries '("\\b" . "\\b")))
|
|
|
|
|
kwd)
|
|
|
|
|
|
|
|
|
|
;; Remove keywords that are defined in ANSI
|
|
|
|
|
(setq kwd keywords)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; (dolist (k keywords)
|
|
|
|
|
;; (catch 'next
|
|
|
|
|
;; (dolist (a sql-mode-ansi-font-lock-keywords)
|
|
|
|
|
;; (when (and (eq face (cdr a))
|
|
|
|
|
;; (eq (string-match (car a) k 0) 0)
|
|
|
|
|
;; (eq (match-end 0) (length k)))
|
|
|
|
|
;; (setq kwd (delq k kwd))
|
|
|
|
|
;; (throw 'next nil)))))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
;; Create a properly formed font-lock-keywords item
|
|
|
|
|
(cons (concat (car bdy)
|
|
|
|
|
(regexp-opt kwd t)
|
|
|
|
|
(cdr bdy))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
face)))
|
|
|
|
|
|
|
|
|
|
(defun sql-regexp-abbrev (keyword)
|
Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 11:20:00 +02:00
|
|
|
|
(let ((brk (string-search "~" keyword))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(len (length keyword))
|
|
|
|
|
(sep "\\(?:")
|
|
|
|
|
re i)
|
|
|
|
|
(if (not brk)
|
|
|
|
|
keyword
|
|
|
|
|
(setq re (substring keyword 0 brk)
|
|
|
|
|
i (+ 2 brk)
|
|
|
|
|
brk (1+ brk))
|
|
|
|
|
(while (<= i len)
|
|
|
|
|
(setq re (concat re sep (substring keyword brk i))
|
|
|
|
|
sep "\\|"
|
|
|
|
|
i (1+ i)))
|
|
|
|
|
(concat re "\\)?"))))
|
|
|
|
|
|
|
|
|
|
(defun sql-regexp-abbrev-list (&rest keyw-list)
|
|
|
|
|
(let ((re nil)
|
|
|
|
|
(sep "\\<\\(?:"))
|
|
|
|
|
(while keyw-list
|
|
|
|
|
(setq re (concat re sep (sql-regexp-abbrev (car keyw-list)))
|
|
|
|
|
sep "\\|"
|
|
|
|
|
keyw-list (cdr keyw-list)))
|
|
|
|
|
(concat re "\\)\\>"))))
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(setq sql-mode-ansi-font-lock-keywords
|
|
|
|
|
(list
|
|
|
|
|
;; ANSI Non Reserved keywords
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"ada" "asensitive" "assignment" "asymmetric" "atomic" "between"
|
|
|
|
|
"bitvar" "called" "catalog_name" "chain" "character_set_catalog"
|
|
|
|
|
"character_set_name" "character_set_schema" "checked" "class_origin"
|
|
|
|
|
"cobol" "collation_catalog" "collation_name" "collation_schema"
|
|
|
|
|
"column_name" "command_function" "command_function_code" "committed"
|
|
|
|
|
"condition_number" "connection_name" "constraint_catalog"
|
|
|
|
|
"constraint_name" "constraint_schema" "contains" "cursor_name"
|
|
|
|
|
"datetime_interval_code" "datetime_interval_precision" "defined"
|
|
|
|
|
"definer" "dispatch" "dynamic_function" "dynamic_function_code"
|
|
|
|
|
"existing" "exists" "final" "fortran" "generated" "granted"
|
|
|
|
|
"hierarchy" "hold" "implementation" "infix" "insensitive" "instance"
|
|
|
|
|
"instantiable" "invoker" "key_member" "key_type" "length" "m"
|
|
|
|
|
"message_length" "message_octet_length" "message_text" "method" "more"
|
|
|
|
|
"mumps" "name" "nullable" "number" "options" "overlaps" "overriding"
|
|
|
|
|
"parameter_mode" "parameter_name" "parameter_ordinal_position"
|
|
|
|
|
"parameter_specific_catalog" "parameter_specific_name"
|
|
|
|
|
"parameter_specific_schema" "pascal" "pli" "position" "repeatable"
|
|
|
|
|
"returned_length" "returned_octet_length" "returned_sqlstate"
|
|
|
|
|
"routine_catalog" "routine_name" "routine_schema" "row_count" "scale"
|
|
|
|
|
"schema_name" "security" "self" "sensitive" "serializable"
|
|
|
|
|
"server_name" "similar" "simple" "source" "specific_name" "style"
|
|
|
|
|
"subclass_origin" "sublist" "symmetric" "system" "table_name"
|
|
|
|
|
"transaction_active" "transactions_committed"
|
|
|
|
|
"transactions_rolled_back" "transform" "transforms" "trigger_catalog"
|
|
|
|
|
"trigger_name" "trigger_schema" "type" "uncommitted" "unnamed"
|
|
|
|
|
"user_defined_type_catalog" "user_defined_type_name"
|
|
|
|
|
"user_defined_type_schema"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; ANSI Reserved keywords
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"absolute" "action" "add" "admin" "after" "aggregate" "alias" "all"
|
|
|
|
|
"allocate" "alter" "and" "any" "are" "as" "asc" "assertion" "at"
|
|
|
|
|
"authorization" "before" "begin" "both" "breadth" "by" "call"
|
|
|
|
|
"cascade" "cascaded" "case" "catalog" "check" "class" "close"
|
|
|
|
|
"collate" "collation" "column" "commit" "completion" "connect"
|
|
|
|
|
"connection" "constraint" "constraints" "constructor" "continue"
|
|
|
|
|
"corresponding" "create" "cross" "cube" "current" "cursor" "cycle"
|
|
|
|
|
"data" "day" "deallocate" "declare" "default" "deferrable" "deferred"
|
|
|
|
|
"delete" "depth" "deref" "desc" "describe" "descriptor" "destroy"
|
|
|
|
|
"destructor" "deterministic" "diagnostics" "dictionary" "disconnect"
|
|
|
|
|
"distinct" "domain" "drop" "dynamic" "each" "else" "end" "equals"
|
|
|
|
|
"escape" "every" "except" "exception" "exec" "execute" "external"
|
|
|
|
|
"false" "fetch" "first" "for" "foreign" "found" "free" "from" "full"
|
|
|
|
|
"function" "general" "get" "global" "go" "goto" "grant" "group"
|
|
|
|
|
"grouping" "having" "host" "hour" "identity" "ignore" "immediate" "in"
|
|
|
|
|
"indicator" "initialize" "initially" "inner" "inout" "input" "insert"
|
|
|
|
|
"intersect" "into" "is" "isolation" "iterate" "join" "key" "language"
|
|
|
|
|
"last" "lateral" "leading" "left" "less" "level" "like" "limit"
|
|
|
|
|
"local" "locator" "map" "match" "minute" "modifies" "modify" "module"
|
|
|
|
|
"month" "names" "natural" "new" "next" "no" "none" "not" "null" "of"
|
|
|
|
|
"off" "old" "on" "only" "open" "operation" "option" "or" "order"
|
|
|
|
|
"ordinality" "out" "outer" "output" "pad" "parameter" "parameters"
|
|
|
|
|
"partial" "path" "postfix" "prefix" "preorder" "prepare" "preserve"
|
|
|
|
|
"primary" "prior" "privileges" "procedure" "public" "read" "reads"
|
|
|
|
|
"recursive" "references" "referencing" "relative" "restrict" "result"
|
|
|
|
|
"return" "returns" "revoke" "right" "role" "rollback" "rollup"
|
|
|
|
|
"routine" "rows" "savepoint" "schema" "scroll" "search" "second"
|
|
|
|
|
"section" "select" "sequence" "session" "set" "sets" "size" "some"
|
|
|
|
|
"space" "specific" "specifictype" "sql" "sqlexception" "sqlstate"
|
|
|
|
|
"sqlwarning" "start" "state" "statement" "static" "structure" "table"
|
|
|
|
|
"temporary" "terminate" "than" "then" "timezone_hour"
|
|
|
|
|
"timezone_minute" "to" "trailing" "transaction" "translation"
|
|
|
|
|
"trigger" "true" "under" "union" "unique" "unknown" "unnest" "update"
|
|
|
|
|
"usage" "using" "value" "values" "variable" "view" "when" "whenever"
|
|
|
|
|
"where" "with" "without" "work" "write" "year"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; ANSI Functions
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-builtin-face nil
|
|
|
|
|
"abs" "avg" "bit_length" "cardinality" "cast" "char_length"
|
|
|
|
|
"character_length" "coalesce" "convert" "count" "current_date"
|
|
|
|
|
"current_path" "current_role" "current_time" "current_timestamp"
|
|
|
|
|
"current_user" "extract" "localtime" "localtimestamp" "lower" "max"
|
|
|
|
|
"min" "mod" "nullif" "octet_length" "overlay" "placing" "session_user"
|
|
|
|
|
"substring" "sum" "system_user" "translate" "treat" "trim" "upper"
|
|
|
|
|
"user"
|
|
|
|
|
)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; ANSI Data Types
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-type-face nil
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"array" "binary" "bit" "blob" "boolean" "char" "character" "clob"
|
|
|
|
|
"date" "dec" "decimal" "double" "float" "int" "integer" "interval"
|
|
|
|
|
"large" "national" "nchar" "nclob" "numeric" "object" "precision"
|
|
|
|
|
"real" "ref" "row" "scope" "smallint" "time" "timestamp" "varchar"
|
|
|
|
|
"varying" "zone"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
))))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defvar sql-mode-ansi-font-lock-keywords
|
|
|
|
|
(eval-when-compile sql-mode-ansi-font-lock-keywords)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"ANSI SQL keywords used by font-lock.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-ansi-font-lock-keywords'. You may want
|
|
|
|
|
to add functions and PL/SQL keywords.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(defun sql--oracle-show-reserved-words ()
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; This function is for use by the maintainer of SQL.EL only.
|
|
|
|
|
(if (or (and (not (derived-mode-p 'sql-mode))
|
|
|
|
|
(not (derived-mode-p 'sql-interactive-mode)))
|
|
|
|
|
(not sql-buffer)
|
|
|
|
|
(not (eq sql-product 'oracle)))
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "Not an Oracle buffer")
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
|
|
|
|
(let ((b "*RESERVED WORDS*"))
|
|
|
|
|
(sql-execute sql-buffer b
|
|
|
|
|
(concat "SELECT "
|
|
|
|
|
" keyword "
|
|
|
|
|
", reserved AS \"Res\" "
|
|
|
|
|
", res_type AS \"Type\" "
|
|
|
|
|
", res_attr AS \"Attr\" "
|
|
|
|
|
", res_semi AS \"Semi\" "
|
|
|
|
|
", duplicate AS \"Dup\" "
|
|
|
|
|
"FROM V$RESERVED_WORDS "
|
|
|
|
|
"WHERE length > 1 "
|
|
|
|
|
"AND SUBSTR(keyword, 1, 1) BETWEEN 'A' AND 'Z' "
|
|
|
|
|
"ORDER BY 2 DESC, 3 DESC, 4 DESC, 5 DESC, 6 DESC, 1;")
|
|
|
|
|
nil nil)
|
|
|
|
|
(with-current-buffer b
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-product 'oracle)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-product-font-lock t nil)
|
|
|
|
|
(font-lock-mode +1)))))
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(defvar sql-mode-oracle-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(list
|
|
|
|
|
;; Oracle SQL*Plus Commands
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Only recognized in they start in column 1 and the
|
|
|
|
|
;; abbreviation is followed by a space or the end of line.
|
|
|
|
|
(list (concat "^" (sql-regexp-abbrev "rem~ark") "\\(?:\\s-.*\\)?$")
|
|
|
|
|
0 'font-lock-comment-face t)
|
|
|
|
|
|
|
|
|
|
(list
|
|
|
|
|
(concat
|
|
|
|
|
"^\\(?:"
|
|
|
|
|
(sql-regexp-abbrev-list
|
|
|
|
|
"[@]\\{1,2\\}" "acc~ept" "a~ppend" "archive" "attribute"
|
|
|
|
|
"bre~ak" "bti~tle" "c~hange" "cl~ear" "col~umn" "conn~ect"
|
|
|
|
|
"copy" "def~ine" "del" "desc~ribe" "disc~onnect" "ed~it"
|
|
|
|
|
"exec~ute" "exit" "get" "help" "ho~st" "[$]" "i~nput" "l~ist"
|
|
|
|
|
"passw~ord" "pau~se" "pri~nt" "pro~mpt" "quit" "recover"
|
|
|
|
|
"repf~ooter" "reph~eader" "r~un" "sav~e" "sho~w" "shutdown"
|
|
|
|
|
"spo~ol" "sta~rt" "startup" "store" "tim~ing" "tti~tle"
|
|
|
|
|
"undef~ine" "var~iable" "whenever")
|
|
|
|
|
"\\|"
|
|
|
|
|
(concat "\\(?:"
|
|
|
|
|
(sql-regexp-abbrev "comp~ute")
|
|
|
|
|
"\\s-+"
|
|
|
|
|
(sql-regexp-abbrev-list
|
|
|
|
|
"avg" "cou~nt" "min~imum" "max~imum" "num~ber" "sum"
|
|
|
|
|
"std" "var~iance")
|
|
|
|
|
"\\)")
|
|
|
|
|
"\\|"
|
|
|
|
|
(concat "\\(?:set\\s-+"
|
|
|
|
|
(sql-regexp-abbrev-list
|
|
|
|
|
"appi~nfo" "array~size" "auto~commit" "autop~rint"
|
|
|
|
|
"autorecovery" "autot~race" "blo~ckterminator"
|
|
|
|
|
"cmds~ep" "colsep" "com~patibility" "con~cat"
|
|
|
|
|
"copyc~ommit" "copytypecheck" "def~ine" "describe"
|
|
|
|
|
"echo" "editf~ile" "emb~edded" "esc~ape" "feed~back"
|
|
|
|
|
"flagger" "flu~sh" "hea~ding" "heads~ep" "instance"
|
|
|
|
|
"lin~esize" "lobof~fset" "long" "longc~hunksize"
|
|
|
|
|
"mark~up" "newp~age" "null" "numf~ormat" "num~width"
|
|
|
|
|
"pages~ize" "pau~se" "recsep" "recsepchar"
|
|
|
|
|
"scan" "serverout~put" "shift~inout" "show~mode"
|
|
|
|
|
"sqlbl~anklines" "sqlc~ase" "sqlco~ntinue"
|
|
|
|
|
"sqln~umber" "sqlpluscompat~ibility" "sqlpre~fix"
|
|
|
|
|
"sqlp~rompt" "sqlt~erminator" "suf~fix" "tab"
|
|
|
|
|
"term~out" "ti~me" "timi~ng" "trim~out" "trims~pool"
|
|
|
|
|
"und~erline" "ver~ify" "wra~p")
|
|
|
|
|
"\\)")
|
|
|
|
|
|
|
|
|
|
"\\)\\(?:\\s-.*\\)?\\(?:[-]\n.*\\)*$")
|
|
|
|
|
0 'font-lock-doc-face t)
|
2014-02-15 17:50:45 -05:00
|
|
|
|
'("&?&\\(?:\\sw\\|\\s_\\)+[.]?" 0 font-lock-preprocessor-face t)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2014-11-01 22:04:26 -04:00
|
|
|
|
;; Oracle PL/SQL Attributes (Declare these first to match %TYPE correctly)
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-builtin-face '("%" . "\\b")
|
|
|
|
|
"bulk_exceptions" "bulk_rowcount" "found" "isopen" "notfound"
|
|
|
|
|
"rowcount" "rowtype" "type"
|
|
|
|
|
)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Oracle Functions
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-builtin-face nil
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"abs" "acos" "add_months" "appendchildxml" "ascii" "asciistr" "asin"
|
|
|
|
|
"atan" "atan2" "avg" "bfilename" "bin_to_num" "bitand" "cardinality"
|
|
|
|
|
"cast" "ceil" "chartorowid" "chr" "cluster_id" "cluster_probability"
|
|
|
|
|
"cluster_set" "coalesce" "collect" "compose" "concat" "convert" "corr"
|
2012-01-04 22:45:30 -05:00
|
|
|
|
"connect_by_root" "connect_by_iscycle" "connect_by_isleaf"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"corr_k" "corr_s" "cos" "cosh" "count" "covar_pop" "covar_samp"
|
2011-11-15 18:37:37 +01:00
|
|
|
|
"cube_table" "cume_dist" "current_date" "current_timestamp" "cv"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"dataobj_to_partition" "dbtimezone" "decode" "decompose" "deletexml"
|
|
|
|
|
"dense_rank" "depth" "deref" "dump" "empty_blob" "empty_clob"
|
|
|
|
|
"existsnode" "exp" "extract" "extractvalue" "feature_id" "feature_set"
|
|
|
|
|
"feature_value" "first" "first_value" "floor" "from_tz" "greatest"
|
|
|
|
|
"grouping" "grouping_id" "group_id" "hextoraw" "initcap"
|
|
|
|
|
"insertchildxml" "insertchildxmlafter" "insertchildxmlbefore"
|
|
|
|
|
"insertxmlafter" "insertxmlbefore" "instr" "instr2" "instr4" "instrb"
|
|
|
|
|
"instrc" "iteration_number" "lag" "last" "last_day" "last_value"
|
|
|
|
|
"lead" "least" "length" "length2" "length4" "lengthb" "lengthc"
|
|
|
|
|
"listagg" "ln" "lnnvl" "localtimestamp" "log" "lower" "lpad" "ltrim"
|
|
|
|
|
"make_ref" "max" "median" "min" "mod" "months_between" "nanvl" "nchr"
|
|
|
|
|
"new_time" "next_day" "nlssort" "nls_charset_decl_len"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"nls_charset_id" "nls_charset_name" "nls_initcap" "nls_lower"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"nls_upper" "nth_value" "ntile" "nullif" "numtodsinterval"
|
|
|
|
|
"numtoyminterval" "nvl" "nvl2" "ora_dst_affected" "ora_dst_convert"
|
|
|
|
|
"ora_dst_error" "ora_hash" "path" "percentile_cont" "percentile_disc"
|
|
|
|
|
"percent_rank" "power" "powermultiset" "powermultiset_by_cardinality"
|
|
|
|
|
"prediction" "prediction_bounds" "prediction_cost"
|
|
|
|
|
"prediction_details" "prediction_probability" "prediction_set"
|
|
|
|
|
"presentnnv" "presentv" "previous" "rank" "ratio_to_report" "rawtohex"
|
2014-11-01 22:04:26 -04:00
|
|
|
|
"rawtonhex" "ref" "reftohex" "regexp_count" "regexp_instr" "regexp_like"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"regexp_replace" "regexp_substr" "regr_avgx" "regr_avgy" "regr_count"
|
|
|
|
|
"regr_intercept" "regr_r2" "regr_slope" "regr_sxx" "regr_sxy"
|
|
|
|
|
"regr_syy" "remainder" "replace" "round" "rowidtochar" "rowidtonchar"
|
|
|
|
|
"row_number" "rpad" "rtrim" "scn_to_timestamp" "sessiontimezone" "set"
|
|
|
|
|
"sign" "sin" "sinh" "soundex" "sqrt" "stats_binomial_test"
|
|
|
|
|
"stats_crosstab" "stats_f_test" "stats_ks_test" "stats_mode"
|
|
|
|
|
"stats_mw_test" "stats_one_way_anova" "stats_t_test_indep"
|
|
|
|
|
"stats_t_test_indepu" "stats_t_test_one" "stats_t_test_paired"
|
|
|
|
|
"stats_wsr_test" "stddev" "stddev_pop" "stddev_samp" "substr"
|
|
|
|
|
"substr2" "substr4" "substrb" "substrc" "sum" "sysdate" "systimestamp"
|
|
|
|
|
"sys_connect_by_path" "sys_context" "sys_dburigen" "sys_extract_utc"
|
|
|
|
|
"sys_guid" "sys_typeid" "sys_xmlagg" "sys_xmlgen" "tan" "tanh"
|
|
|
|
|
"timestamp_to_scn" "to_binary_double" "to_binary_float" "to_blob"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"to_char" "to_clob" "to_date" "to_dsinterval" "to_lob" "to_multi_byte"
|
|
|
|
|
"to_nchar" "to_nclob" "to_number" "to_single_byte" "to_timestamp"
|
|
|
|
|
"to_timestamp_tz" "to_yminterval" "translate" "treat" "trim" "trunc"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"tz_offset" "uid" "unistr" "updatexml" "upper" "user" "userenv"
|
|
|
|
|
"value" "variance" "var_pop" "var_samp" "vsize" "width_bucket"
|
|
|
|
|
"xmlagg" "xmlcast" "xmlcdata" "xmlcolattval" "xmlcomment" "xmlconcat"
|
|
|
|
|
"xmldiff" "xmlelement" "xmlexists" "xmlforest" "xmlisvalid" "xmlparse"
|
|
|
|
|
"xmlpatch" "xmlpi" "xmlquery" "xmlroot" "xmlsequence" "xmlserialize"
|
|
|
|
|
"xmltable" "xmltransform"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
|
|
|
|
;; See the table V$RESERVED_WORDS
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Oracle Keywords
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"abort" "access" "accessed" "account" "activate" "add" "admin"
|
|
|
|
|
"advise" "after" "agent" "aggregate" "all" "allocate" "allow" "alter"
|
|
|
|
|
"always" "analyze" "ancillary" "and" "any" "apply" "archive"
|
|
|
|
|
"archivelog" "array" "as" "asc" "associate" "at" "attribute"
|
|
|
|
|
"attributes" "audit" "authenticated" "authid" "authorization" "auto"
|
|
|
|
|
"autoallocate" "automatic" "availability" "backup" "before" "begin"
|
|
|
|
|
"behalf" "between" "binding" "bitmap" "block" "blocksize" "body"
|
|
|
|
|
"both" "buffer_pool" "build" "by" "cache" "call" "cancel"
|
|
|
|
|
"cascade" "case" "category" "certificate" "chained" "change" "check"
|
|
|
|
|
"checkpoint" "child" "chunk" "class" "clear" "clone" "close" "cluster"
|
|
|
|
|
"column" "column_value" "columns" "comment" "commit" "committed"
|
|
|
|
|
"compatibility" "compile" "complete" "composite_limit" "compress"
|
|
|
|
|
"compute" "connect" "connect_time" "consider" "consistent"
|
|
|
|
|
"constraint" "constraints" "constructor" "contents" "context"
|
|
|
|
|
"continue" "controlfile" "corruption" "cost" "cpu_per_call"
|
|
|
|
|
"cpu_per_session" "create" "cross" "cube" "current" "currval" "cycle"
|
|
|
|
|
"dangling" "data" "database" "datafile" "datafiles" "day" "ddl"
|
|
|
|
|
"deallocate" "debug" "default" "deferrable" "deferred" "definer"
|
|
|
|
|
"delay" "delete" "demand" "desc" "determines" "deterministic"
|
|
|
|
|
"dictionary" "dimension" "directory" "disable" "disassociate"
|
|
|
|
|
"disconnect" "distinct" "distinguished" "distributed" "dml" "drop"
|
|
|
|
|
"each" "element" "else" "enable" "end" "equals_path" "escape"
|
|
|
|
|
"estimate" "except" "exceptions" "exchange" "excluding" "exists"
|
|
|
|
|
"expire" "explain" "extent" "external" "externally"
|
|
|
|
|
"failed_login_attempts" "fast" "file" "final" "finish" "flush" "for"
|
|
|
|
|
"force" "foreign" "freelist" "freelists" "freepools" "fresh" "from"
|
|
|
|
|
"full" "function" "functions" "generated" "global" "global_name"
|
|
|
|
|
"globally" "grant" "group" "grouping" "groups" "guard" "hash"
|
|
|
|
|
"hashkeys" "having" "heap" "hierarchy" "id" "identified" "identifier"
|
|
|
|
|
"idle_time" "immediate" "in" "including" "increment" "index" "indexed"
|
|
|
|
|
"indexes" "indextype" "indextypes" "indicator" "initial" "initialized"
|
|
|
|
|
"initially" "initrans" "inner" "insert" "instance" "instantiable"
|
|
|
|
|
"instead" "intersect" "into" "invalidate" "is" "isolation" "java"
|
|
|
|
|
"join" "keep" "key" "kill" "language" "left" "less" "level"
|
|
|
|
|
"levels" "library" "like" "like2" "like4" "likec" "limit" "link"
|
|
|
|
|
"list" "lob" "local" "location" "locator" "lock" "log" "logfile"
|
|
|
|
|
"logging" "logical" "logical_reads_per_call"
|
|
|
|
|
"logical_reads_per_session" "managed" "management" "manual" "map"
|
|
|
|
|
"mapping" "master" "matched" "materialized" "maxdatafiles"
|
|
|
|
|
"maxextents" "maximize" "maxinstances" "maxlogfiles" "maxloghistory"
|
|
|
|
|
"maxlogmembers" "maxsize" "maxtrans" "maxvalue" "member" "memory"
|
|
|
|
|
"merge" "migrate" "minextents" "minimize" "minimum" "minus" "minvalue"
|
|
|
|
|
"mode" "modify" "monitoring" "month" "mount" "move" "movement" "name"
|
|
|
|
|
"named" "natural" "nested" "never" "new" "next" "nextval" "no"
|
|
|
|
|
"noarchivelog" "noaudit" "nocache" "nocompress" "nocopy" "nocycle"
|
|
|
|
|
"nodelay" "noforce" "nologging" "nomapping" "nomaxvalue" "nominimize"
|
|
|
|
|
"nominvalue" "nomonitoring" "none" "noorder" "noparallel" "norely"
|
|
|
|
|
"noresetlogs" "noreverse" "normal" "norowdependencies" "nosort"
|
|
|
|
|
"noswitch" "not" "nothing" "notimeout" "novalidate" "nowait" "null"
|
|
|
|
|
"nulls" "object" "of" "off" "offline" "oidindex" "old" "on" "online"
|
|
|
|
|
"only" "open" "operator" "optimal" "option" "or" "order"
|
2013-03-11 00:09:37 -04:00
|
|
|
|
"organization" "out" "outer" "outline" "over" "overflow" "overriding"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"package" "packages" "parallel" "parallel_enable" "parameters"
|
|
|
|
|
"parent" "partition" "partitions" "password" "password_grace_time"
|
|
|
|
|
"password_life_time" "password_lock_time" "password_reuse_max"
|
|
|
|
|
"password_reuse_time" "password_verify_function" "pctfree"
|
|
|
|
|
"pctincrease" "pctthreshold" "pctused" "pctversion" "percent"
|
2014-11-01 22:04:26 -04:00
|
|
|
|
"performance" "permanent" "pfile" "physical" "pipelined" "pivot" "plan"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"post_transaction" "pragma" "prebuilt" "preserve" "primary" "private"
|
|
|
|
|
"private_sga" "privileges" "procedure" "profile" "protection" "public"
|
|
|
|
|
"purge" "query" "quiesce" "quota" "range" "read" "reads" "rebuild"
|
|
|
|
|
"records_per_block" "recover" "recovery" "recycle" "reduced" "ref"
|
|
|
|
|
"references" "referencing" "refresh" "register" "reject" "relational"
|
|
|
|
|
"rely" "rename" "reset" "resetlogs" "resize" "resolve" "resolver"
|
|
|
|
|
"resource" "restrict" "restrict_references" "restricted" "result"
|
|
|
|
|
"resumable" "resume" "retention" "return" "returning" "reuse"
|
|
|
|
|
"reverse" "revoke" "rewrite" "right" "rnds" "rnps" "role" "roles"
|
|
|
|
|
"rollback" "rollup" "row" "rowdependencies" "rownum" "rows" "sample"
|
|
|
|
|
"savepoint" "scan" "schema" "scn" "scope" "segment" "select"
|
|
|
|
|
"selectivity" "self" "sequence" "serializable" "session"
|
|
|
|
|
"sessions_per_user" "set" "sets" "settings" "shared" "shared_pool"
|
|
|
|
|
"shrink" "shutdown" "siblings" "sid" "single" "size" "skip" "some"
|
|
|
|
|
"sort" "source" "space" "specification" "spfile" "split" "standby"
|
|
|
|
|
"start" "statement_id" "static" "statistics" "stop" "storage" "store"
|
|
|
|
|
"structure" "subpartition" "subpartitions" "substitutable"
|
|
|
|
|
"successful" "supplemental" "suspend" "switch" "switchover" "synonym"
|
|
|
|
|
"sys" "system" "table" "tables" "tablespace" "tempfile" "template"
|
|
|
|
|
"temporary" "test" "than" "then" "thread" "through" "time_zone"
|
|
|
|
|
"timeout" "to" "trace" "transaction" "trigger" "triggers" "truncate"
|
|
|
|
|
"trust" "type" "types" "unarchived" "under" "under_path" "undo"
|
2014-11-01 22:04:26 -04:00
|
|
|
|
"uniform" "union" "unique" "unlimited" "unlock" "unpivot" "unquiesce"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"unrecoverable" "until" "unusable" "unused" "update" "upgrade" "usage"
|
|
|
|
|
"use" "using" "validate" "validation" "value" "values" "variable"
|
|
|
|
|
"varray" "version" "view" "wait" "when" "whenever" "where" "with"
|
|
|
|
|
"without" "wnds" "wnps" "work" "write" "xmldata" "xmlschema" "xmltype"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Oracle Data Types
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-type-face nil
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"bfile" "binary_double" "binary_float" "blob" "byte" "char" "charbyte"
|
|
|
|
|
"clob" "date" "day" "float" "interval" "local" "long" "longraw"
|
|
|
|
|
"minute" "month" "nchar" "nclob" "number" "nvarchar2" "raw" "rowid" "second"
|
|
|
|
|
"time" "timestamp" "urowid" "varchar2" "with" "year" "zone"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Oracle PL/SQL Functions
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-builtin-face nil
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"delete" "trim" "extend" "exists" "first" "last" "count" "limit"
|
2013-03-11 00:09:37 -04:00
|
|
|
|
"prior" "next" "sqlcode" "sqlerrm"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Oracle PL/SQL Reserved words
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
|
|
|
|
"all" "alter" "and" "any" "as" "asc" "at" "begin" "between" "by"
|
|
|
|
|
"case" "check" "clusters" "cluster" "colauth" "columns" "compress"
|
|
|
|
|
"connect" "crash" "create" "cursor" "declare" "default" "desc"
|
|
|
|
|
"distinct" "drop" "else" "end" "exception" "exclusive" "fetch" "for"
|
|
|
|
|
"from" "function" "goto" "grant" "group" "having" "identified" "if"
|
|
|
|
|
"in" "index" "indexes" "insert" "intersect" "into" "is" "like" "lock"
|
|
|
|
|
"minus" "mode" "nocompress" "not" "nowait" "null" "of" "on" "option"
|
|
|
|
|
"or" "order" "overlaps" "procedure" "public" "resource" "revoke"
|
|
|
|
|
"select" "share" "size" "sql" "start" "subtype" "tabauth" "table"
|
|
|
|
|
"then" "to" "type" "union" "unique" "update" "values" "view" "views"
|
|
|
|
|
"when" "where" "with"
|
|
|
|
|
|
|
|
|
|
"true" "false"
|
|
|
|
|
"raise_application_error"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Oracle PL/SQL Keywords
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"a" "add" "agent" "aggregate" "array" "attribute" "authid" "avg"
|
|
|
|
|
"bfile_base" "binary" "blob_base" "block" "body" "both" "bound" "bulk"
|
|
|
|
|
"byte" "c" "call" "calling" "cascade" "char" "char_base" "character"
|
|
|
|
|
"charset" "charsetform" "charsetid" "clob_base" "close" "collect"
|
|
|
|
|
"comment" "commit" "committed" "compiled" "constant" "constructor"
|
|
|
|
|
"context" "continue" "convert" "count" "current" "customdatum"
|
|
|
|
|
"dangling" "data" "date" "date_base" "day" "define" "delete"
|
|
|
|
|
"deterministic" "double" "duration" "element" "elsif" "empty" "escape"
|
|
|
|
|
"except" "exceptions" "execute" "exists" "exit" "external" "final"
|
|
|
|
|
"fixed" "float" "forall" "force" "general" "hash" "heap" "hidden"
|
|
|
|
|
"hour" "immediate" "including" "indicator" "indices" "infinite"
|
|
|
|
|
"instantiable" "int" "interface" "interval" "invalidate" "isolation"
|
|
|
|
|
"java" "language" "large" "leading" "length" "level" "library" "like2"
|
|
|
|
|
"like4" "likec" "limit" "limited" "local" "long" "loop" "map" "max"
|
|
|
|
|
"maxlen" "member" "merge" "min" "minute" "mod" "modify" "month"
|
|
|
|
|
"multiset" "name" "nan" "national" "native" "nchar" "new" "nocopy"
|
|
|
|
|
"number_base" "object" "ocicoll" "ocidate" "ocidatetime" "ociduration"
|
|
|
|
|
"ociinterval" "ociloblocator" "ocinumber" "ociraw" "ociref"
|
|
|
|
|
"ocirefcursor" "ocirowid" "ocistring" "ocitype" "old" "only" "opaque"
|
|
|
|
|
"open" "operator" "oracle" "oradata" "organization" "orlany" "orlvary"
|
|
|
|
|
"others" "out" "overriding" "package" "parallel_enable" "parameter"
|
|
|
|
|
"parameters" "parent" "partition" "pascal" "pipe" "pipelined" "pragma"
|
|
|
|
|
"precision" "prior" "private" "raise" "range" "raw" "read" "record"
|
|
|
|
|
"ref" "reference" "relies_on" "rem" "remainder" "rename" "result"
|
|
|
|
|
"result_cache" "return" "returning" "reverse" "rollback" "row"
|
|
|
|
|
"sample" "save" "savepoint" "sb1" "sb2" "sb4" "second" "segment"
|
|
|
|
|
"self" "separate" "sequence" "serializable" "set" "short" "size_t"
|
|
|
|
|
"some" "sparse" "sqlcode" "sqldata" "sqlname" "sqlstate" "standard"
|
|
|
|
|
"static" "stddev" "stored" "string" "struct" "style" "submultiset"
|
|
|
|
|
"subpartition" "substitutable" "sum" "synonym" "tdo" "the" "time"
|
|
|
|
|
"timestamp" "timezone_abbr" "timezone_hour" "timezone_minute"
|
|
|
|
|
"timezone_region" "trailing" "transaction" "transactional" "trusted"
|
|
|
|
|
"ub1" "ub2" "ub4" "under" "unsigned" "untrusted" "use" "using"
|
|
|
|
|
"valist" "value" "variable" "variance" "varray" "varying" "void"
|
|
|
|
|
"while" "work" "wrapped" "write" "year" "zone"
|
|
|
|
|
;; Pragma
|
|
|
|
|
"autonomous_transaction" "exception_init" "inline"
|
|
|
|
|
"restrict_references" "serially_reusable"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Oracle PL/SQL Data Types
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-type-face nil
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"\"BINARY LARGE OBJECT\"" "\"CHAR LARGE OBJECT\"" "\"CHAR VARYING\""
|
|
|
|
|
"\"CHARACTER LARGE OBJECT\"" "\"CHARACTER VARYING\""
|
|
|
|
|
"\"DOUBLE PRECISION\"" "\"INTERVAL DAY TO SECOND\""
|
|
|
|
|
"\"INTERVAL YEAR TO MONTH\"" "\"LONG RAW\"" "\"NATIONAL CHAR\""
|
|
|
|
|
"\"NATIONAL CHARACTER LARGE OBJECT\"" "\"NATIONAL CHARACTER\""
|
|
|
|
|
"\"NCHAR LARGE OBJECT\"" "\"NCHAR\"" "\"NCLOB\"" "\"NVARCHAR2\""
|
|
|
|
|
"\"TIME WITH TIME ZONE\"" "\"TIMESTAMP WITH LOCAL TIME ZONE\""
|
|
|
|
|
"\"TIMESTAMP WITH TIME ZONE\""
|
|
|
|
|
"bfile" "bfile_base" "binary_double" "binary_float" "binary_integer"
|
|
|
|
|
"blob" "blob_base" "boolean" "char" "character" "char_base" "clob"
|
|
|
|
|
"clob_base" "cursor" "date" "day" "dec" "decimal"
|
|
|
|
|
"dsinterval_unconstrained" "float" "int" "integer" "interval" "local"
|
|
|
|
|
"long" "mlslabel" "month" "natural" "naturaln" "nchar_cs" "number"
|
|
|
|
|
"number_base" "numeric" "pls_integer" "positive" "positiven" "raw"
|
|
|
|
|
"real" "ref" "rowid" "second" "signtype" "simple_double"
|
|
|
|
|
"simple_float" "simple_integer" "smallint" "string" "time" "timestamp"
|
|
|
|
|
"timestamp_ltz_unconstrained" "timestamp_tz_unconstrained"
|
|
|
|
|
"timestamp_unconstrained" "time_tz_unconstrained" "time_unconstrained"
|
|
|
|
|
"to" "urowid" "varchar" "varchar2" "with" "year"
|
|
|
|
|
"yminterval_unconstrained" "zone"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Oracle PL/SQL Exceptions
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-warning-face nil
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"access_into_null" "case_not_found" "collection_is_null"
|
|
|
|
|
"cursor_already_open" "dup_val_on_index" "invalid_cursor"
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"invalid_number" "login_denied" "no_data_found" "no_data_needed"
|
|
|
|
|
"not_logged_on" "program_error" "rowtype_mismatch" "self_is_null"
|
|
|
|
|
"storage_error" "subscript_beyond_count" "subscript_outside_limit"
|
|
|
|
|
"sys_invalid_rowid" "timeout_on_resource" "too_many_rows"
|
|
|
|
|
"value_error" "zero_divide"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"Oracle SQL keywords used by font-lock.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-oracle-font-lock-keywords'. You may want
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
to add functions and PL/SQL keywords.")
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(defvar sql-mode-postgres-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(list
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
;; Postgres psql commands
|
|
|
|
|
'("^\\s-*\\\\.*$" . font-lock-doc-face)
|
|
|
|
|
|
|
|
|
|
;; Postgres unreserved words but may have meaning
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-builtin-face nil "a"
|
|
|
|
|
"abs" "absent" "according" "ada" "alias" "allocate" "are" "array_agg"
|
|
|
|
|
"asensitive" "atomic" "attribute" "attributes" "avg" "base64"
|
|
|
|
|
"bernoulli" "bit_length" "bitvar" "blob" "blocked" "bom" "breadth" "c"
|
|
|
|
|
"call" "cardinality" "catalog_name" "ceil" "ceiling" "char_length"
|
|
|
|
|
"character_length" "character_set_catalog" "character_set_name"
|
|
|
|
|
"character_set_schema" "characters" "checked" "class_origin" "clob"
|
|
|
|
|
"cobol" "collation" "collation_catalog" "collation_name"
|
|
|
|
|
"collation_schema" "collect" "column_name" "columns"
|
|
|
|
|
"command_function" "command_function_code" "completion" "condition"
|
|
|
|
|
"condition_number" "connect" "connection_name" "constraint_catalog"
|
|
|
|
|
"constraint_name" "constraint_schema" "constructor" "contains"
|
|
|
|
|
"control" "convert" "corr" "corresponding" "count" "covar_pop"
|
|
|
|
|
"covar_samp" "cube" "cume_dist" "current_default_transform_group"
|
|
|
|
|
"current_path" "current_transform_group_for_type" "cursor_name"
|
|
|
|
|
"datalink" "datetime_interval_code" "datetime_interval_precision" "db"
|
|
|
|
|
"defined" "degree" "dense_rank" "depth" "deref" "derived" "describe"
|
|
|
|
|
"descriptor" "destroy" "destructor" "deterministic" "diagnostics"
|
|
|
|
|
"disconnect" "dispatch" "dlnewcopy" "dlpreviouscopy" "dlurlcomplete"
|
|
|
|
|
"dlurlcompleteonly" "dlurlcompletewrite" "dlurlpath" "dlurlpathonly"
|
|
|
|
|
"dlurlpathwrite" "dlurlscheme" "dlurlserver" "dlvalue" "dynamic"
|
|
|
|
|
"dynamic_function" "dynamic_function_code" "element" "empty"
|
|
|
|
|
"end-exec" "equals" "every" "exception" "exec" "existing" "exp" "file"
|
|
|
|
|
"filter" "final" "first_value" "flag" "floor" "fortran" "found" "free"
|
|
|
|
|
"fs" "fusion" "g" "general" "generated" "get" "go" "goto" "grouping"
|
|
|
|
|
"hex" "hierarchy" "host" "id" "ignore" "implementation" "import"
|
|
|
|
|
"indent" "indicator" "infix" "initialize" "instance" "instantiable"
|
|
|
|
|
"integrity" "intersection" "iterate" "k" "key_member" "key_type" "lag"
|
|
|
|
|
"last_value" "lateral" "lead" "length" "less" "library" "like_regex"
|
|
|
|
|
"link" "ln" "locator" "lower" "m" "map" "matched" "max"
|
|
|
|
|
"max_cardinality" "member" "merge" "message_length"
|
|
|
|
|
"message_octet_length" "message_text" "method" "min" "mod" "modifies"
|
|
|
|
|
"modify" "module" "more" "multiset" "mumps" "namespace" "nclob"
|
|
|
|
|
"nesting" "new" "nfc" "nfd" "nfkc" "nfkd" "nil" "normalize"
|
|
|
|
|
"normalized" "nth_value" "ntile" "nullable" "number"
|
|
|
|
|
"occurrences_regex" "octet_length" "octets" "old" "open" "operation"
|
|
|
|
|
"ordering" "ordinality" "others" "output" "overriding" "p" "pad"
|
|
|
|
|
"parameter" "parameter_mode" "parameter_name"
|
|
|
|
|
"parameter_ordinal_position" "parameter_specific_catalog"
|
|
|
|
|
"parameter_specific_name" "parameter_specific_schema" "parameters"
|
|
|
|
|
"pascal" "passing" "passthrough" "percent_rank" "percentile_cont"
|
|
|
|
|
"percentile_disc" "permission" "pli" "position_regex" "postfix"
|
|
|
|
|
"power" "prefix" "preorder" "public" "rank" "reads" "recovery" "ref"
|
|
|
|
|
"referencing" "regr_avgx" "regr_avgy" "regr_count" "regr_intercept"
|
|
|
|
|
"regr_r2" "regr_slope" "regr_sxx" "regr_sxy" "regr_syy" "requiring"
|
|
|
|
|
"respect" "restore" "result" "return" "returned_cardinality"
|
|
|
|
|
"returned_length" "returned_octet_length" "returned_sqlstate" "rollup"
|
|
|
|
|
"routine" "routine_catalog" "routine_name" "routine_schema"
|
|
|
|
|
"row_count" "row_number" "scale" "schema_name" "scope" "scope_catalog"
|
|
|
|
|
"scope_name" "scope_schema" "section" "selective" "self" "sensitive"
|
|
|
|
|
"server_name" "sets" "size" "source" "space" "specific"
|
|
|
|
|
"specific_name" "specifictype" "sql" "sqlcode" "sqlerror"
|
|
|
|
|
"sqlexception" "sqlstate" "sqlwarning" "sqrt" "state" "static"
|
|
|
|
|
"stddev_pop" "stddev_samp" "structure" "style" "subclass_origin"
|
|
|
|
|
"sublist" "submultiset" "substring_regex" "sum" "system_user" "t"
|
|
|
|
|
"table_name" "tablesample" "terminate" "than" "ties" "timezone_hour"
|
|
|
|
|
"timezone_minute" "token" "top_level_count" "transaction_active"
|
|
|
|
|
"transactions_committed" "transactions_rolled_back" "transform"
|
|
|
|
|
"transforms" "translate" "translate_regex" "translation"
|
|
|
|
|
"trigger_catalog" "trigger_name" "trigger_schema" "trim_array"
|
|
|
|
|
"uescape" "under" "unlink" "unnamed" "unnest" "untyped" "upper" "uri"
|
|
|
|
|
"usage" "user_defined_type_catalog" "user_defined_type_code"
|
|
|
|
|
"user_defined_type_name" "user_defined_type_schema" "var_pop"
|
|
|
|
|
"var_samp" "varbinary" "variable" "whenever" "width_bucket" "within"
|
|
|
|
|
"xmlagg" "xmlbinary" "xmlcast" "xmlcomment" "xmldeclaration"
|
|
|
|
|
"xmldocument" "xmlexists" "xmliterate" "xmlnamespaces" "xmlquery"
|
|
|
|
|
"xmlschema" "xmltable" "xmltext" "xmlvalidate"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Postgres non-reserved words
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-builtin-face nil
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"abort" "absolute" "access" "action" "add" "admin" "after" "aggregate"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"also" "alter" "always" "assertion" "assignment" "at" "attribute" "backward"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"before" "begin" "between" "by" "cache" "called" "cascade" "cascaded"
|
|
|
|
|
"catalog" "chain" "characteristics" "checkpoint" "class" "close"
|
|
|
|
|
"cluster" "coalesce" "comment" "comments" "commit" "committed"
|
|
|
|
|
"configuration" "connection" "constraints" "content" "continue"
|
|
|
|
|
"conversion" "copy" "cost" "createdb" "createrole" "createuser" "csv"
|
|
|
|
|
"current" "cursor" "cycle" "data" "database" "day" "deallocate" "dec"
|
|
|
|
|
"declare" "defaults" "deferred" "definer" "delete" "delimiter"
|
|
|
|
|
"delimiters" "dictionary" "disable" "discard" "document" "domain"
|
|
|
|
|
"drop" "each" "enable" "encoding" "encrypted" "enum" "escape"
|
|
|
|
|
"exclude" "excluding" "exclusive" "execute" "exists" "explain"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"extension" "external" "extract" "family" "first" "float" "following" "force"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"forward" "function" "functions" "global" "granted" "greatest"
|
|
|
|
|
"handler" "header" "hold" "hour" "identity" "if" "immediate"
|
|
|
|
|
"immutable" "implicit" "including" "increment" "index" "indexes"
|
|
|
|
|
"inherit" "inherits" "inline" "inout" "input" "insensitive" "insert"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"instead" "invoker" "isolation" "key" "label" "language" "large" "last"
|
|
|
|
|
"lc_collate" "lc_ctype" "leakproof" "least" "level" "listen" "load" "local"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"location" "lock" "login" "mapping" "match" "maxvalue" "minute"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"minvalue" "mode" "month" "move" "names" "national" "nchar"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"next" "no" "nocreatedb" "nocreaterole" "nocreateuser" "noinherit"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"nologin" "none" "noreplication" "nosuperuser" "nothing" "notify" "nowait" "nullif"
|
|
|
|
|
"nulls" "object" "of" "off" "oids" "operator" "option" "options" "out"
|
|
|
|
|
"overlay" "owned" "owner" "parser" "partial" "partition" "passing" "password"
|
|
|
|
|
"plans" "position" "preceding" "precision" "prepare" "prepared" "preserve" "prior"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"privileges" "procedural" "procedure" "quote" "range" "read"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"reassign" "recheck" "recursive" "ref" "reindex" "relative" "release"
|
|
|
|
|
"rename" "repeatable" "replace" "replica" "replication" "reset" "restart" "restrict"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"returns" "revoke" "role" "rollback" "row" "rows" "rule" "savepoint"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"schema" "scroll" "search" "second" "security" "sequence"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"serializable" "server" "session" "set" "setof" "share" "show"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"simple" "snapshot" "stable" "standalone" "start" "statement" "statistics"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"stdin" "stdout" "storage" "strict" "strip" "substring" "superuser"
|
|
|
|
|
"sysid" "system" "tables" "tablespace" "temp" "template" "temporary"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"transaction" "treat" "trim" "truncate" "trusted" "type" "types"
|
|
|
|
|
"unbounded" "uncommitted" "unencrypted" "unlisten" "unlogged" "until"
|
|
|
|
|
"update" "vacuum" "valid" "validate" "validator" "value" "values" "varying" "version"
|
|
|
|
|
"view" "volatile" "whitespace" "without" "work" "wrapper" "write"
|
|
|
|
|
"xmlattributes" "xmlconcat" "xmlelement" "xmlexists" "xmlforest" "xmlparse"
|
|
|
|
|
"xmlpi" "xmlroot" "xmlserialize" "year" "yes" "zone"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Postgres Reserved
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"all" "analyse" "analyze" "and" "array" "asc" "as" "asymmetric"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"authorization" "binary" "both" "case" "cast" "check" "collate"
|
|
|
|
|
"column" "concurrently" "constraint" "create" "cross"
|
|
|
|
|
"current_catalog" "current_date" "current_role" "current_schema"
|
|
|
|
|
"current_time" "current_timestamp" "current_user" "default"
|
|
|
|
|
"deferrable" "desc" "distinct" "do" "else" "end" "except" "false"
|
|
|
|
|
"fetch" "foreign" "for" "freeze" "from" "full" "grant" "group"
|
|
|
|
|
"having" "ilike" "initially" "inner" "in" "intersect" "into" "isnull"
|
|
|
|
|
"is" "join" "leading" "left" "like" "limit" "localtime"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"localtimestamp" "natural" "notnull" "not" "null" "offset"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"only" "on" "order" "or" "outer" "overlaps" "over" "placing" "primary"
|
|
|
|
|
"references" "returning" "right" "select" "session_user" "similar"
|
|
|
|
|
"some" "symmetric" "table" "then" "to" "trailing" "true" "union"
|
|
|
|
|
"unique" "user" "using" "variadic" "verbose" "when" "where" "window"
|
|
|
|
|
"with"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Postgres PL/pgSQL
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
|
|
|
|
"assign" "if" "case" "loop" "while" "for" "foreach" "exit" "elsif" "return"
|
|
|
|
|
"raise" "execsql" "dynexecute" "perform" "getdiag" "open" "fetch" "move" "close"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Postgres Data Types
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-type-face nil
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"bigint" "bigserial" "bit" "bool" "boolean" "box" "bytea" "char"
|
|
|
|
|
"character" "cidr" "circle" "date" "decimal" "double" "float4"
|
|
|
|
|
"float8" "inet" "int" "int2" "int4" "int8" "integer" "interval" "line"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"lseg" "macaddr" "money" "name" "numeric" "path" "point" "polygon"
|
|
|
|
|
"precision" "real" "serial" "serial4" "serial8" "sequences" "smallint" "text"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"time" "timestamp" "timestamptz" "timetz" "tsquery" "tsvector"
|
2012-12-14 16:31:19 +01:00
|
|
|
|
"txid_snapshot" "unknown" "uuid" "varbit" "varchar" "varying" "without"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
"xml" "zone"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
)))
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"Postgres SQL keywords used by font-lock.
|
2002-11-21 08:32:06 +00:00
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-postgres-font-lock-keywords'.")
|
2002-11-21 08:32:06 +00:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(defvar sql-mode-linter-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(list
|
|
|
|
|
;; Linter Keywords
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
2002-11-21 08:32:06 +00:00
|
|
|
|
"autocommit" "autoinc" "autorowid" "cancel" "cascade" "channel"
|
|
|
|
|
"committed" "count" "countblob" "cross" "current" "data" "database"
|
|
|
|
|
"datafile" "datafiles" "datesplit" "dba" "dbname" "default" "deferred"
|
|
|
|
|
"denied" "description" "device" "difference" "directory" "error"
|
|
|
|
|
"escape" "euc" "exclusive" "external" "extfile" "false" "file"
|
|
|
|
|
"filename" "filesize" "filetime" "filter" "findblob" "first" "foreign"
|
|
|
|
|
"full" "fuzzy" "global" "granted" "ignore" "immediate" "increment"
|
|
|
|
|
"indexes" "indexfile" "indexfiles" "indextime" "initial" "integrity"
|
|
|
|
|
"internal" "key" "last_autoinc" "last_rowid" "limit" "linter"
|
|
|
|
|
"linter_file_device" "linter_file_size" "linter_name_length" "ln"
|
|
|
|
|
"local" "login" "maxisn" "maxrow" "maxrowid" "maxvalue" "message"
|
|
|
|
|
"minvalue" "module" "names" "national" "natural" "new" "new_table"
|
|
|
|
|
"no" "node" "noneuc" "nulliferror" "numbers" "off" "old" "old_table"
|
|
|
|
|
"only" "operation" "optimistic" "option" "page" "partially" "password"
|
|
|
|
|
"phrase" "plan" "precision" "primary" "priority" "privileges"
|
|
|
|
|
"proc_info_size" "proc_par_name_len" "protocol" "quant" "range" "raw"
|
|
|
|
|
"read" "record" "records" "references" "remote" "rename" "replication"
|
|
|
|
|
"restart" "rewrite" "root" "row" "rule" "savepoint" "security"
|
|
|
|
|
"sensitive" "sequence" "serializable" "server" "since" "size" "some"
|
|
|
|
|
"startup" "statement" "station" "success" "sys_guid" "tables" "test"
|
|
|
|
|
"timeout" "trace" "transaction" "translation" "trigger"
|
|
|
|
|
"trigger_info_size" "true" "trunc" "uncommitted" "unicode" "unknown"
|
|
|
|
|
"unlimited" "unlisted" "user" "utf8" "value" "varying" "volumes"
|
|
|
|
|
"wait" "windows_code" "workspace" "write" "xml"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Linter Reserved
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
2002-11-21 08:32:06 +00:00
|
|
|
|
"access" "action" "add" "address" "after" "all" "alter" "always" "and"
|
|
|
|
|
"any" "append" "as" "asc" "ascic" "async" "at_begin" "at_end" "audit"
|
|
|
|
|
"aud_obj_name_len" "backup" "base" "before" "between" "blobfile"
|
|
|
|
|
"blobfiles" "blobpct" "brief" "browse" "by" "case" "cast" "check"
|
|
|
|
|
"clear" "close" "column" "comment" "commit" "connect" "contains"
|
|
|
|
|
"correct" "create" "delete" "desc" "disable" "disconnect" "distinct"
|
|
|
|
|
"drop" "each" "ef" "else" "enable" "end" "event" "except" "exclude"
|
|
|
|
|
"execute" "exists" "extract" "fetch" "finish" "for" "from" "get"
|
|
|
|
|
"grant" "group" "having" "identified" "in" "index" "inner" "insert"
|
|
|
|
|
"instead" "intersect" "into" "is" "isolation" "join" "left" "level"
|
|
|
|
|
"like" "lock" "mode" "modify" "not" "nowait" "null" "of" "on" "open"
|
|
|
|
|
"or" "order" "outer" "owner" "press" "prior" "procedure" "public"
|
|
|
|
|
"purge" "rebuild" "resource" "restrict" "revoke" "right" "role"
|
|
|
|
|
"rollback" "rownum" "select" "session" "set" "share" "shutdown"
|
|
|
|
|
"start" "stop" "sync" "synchronize" "synonym" "sysdate" "table" "then"
|
|
|
|
|
"to" "union" "unique" "unlock" "until" "update" "using" "values"
|
|
|
|
|
"view" "when" "where" "with" "without"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Linter Functions
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-builtin-face nil
|
2002-11-21 08:32:06 +00:00
|
|
|
|
"abs" "acos" "asin" "atan" "atan2" "avg" "ceil" "cos" "cosh" "divtime"
|
|
|
|
|
"exp" "floor" "getbits" "getblob" "getbyte" "getlong" "getraw"
|
|
|
|
|
"getstr" "gettext" "getword" "hextoraw" "lenblob" "length" "log"
|
|
|
|
|
"lower" "lpad" "ltrim" "max" "min" "mod" "monthname" "nvl"
|
|
|
|
|
"octet_length" "power" "rand" "rawtohex" "repeat_string"
|
|
|
|
|
"right_substr" "round" "rpad" "rtrim" "sign" "sin" "sinh" "soundex"
|
|
|
|
|
"sqrt" "sum" "tan" "tanh" "timeint_to_days" "to_char" "to_date"
|
|
|
|
|
"to_gmtime" "to_localtime" "to_number" "trim" "upper" "decode"
|
|
|
|
|
"substr" "substring" "chr" "dayname" "days" "greatest" "hex" "initcap"
|
|
|
|
|
"instr" "least" "multime" "replace" "width"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Linter Data Types
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-type-face nil
|
|
|
|
|
"bigint" "bitmap" "blob" "boolean" "char" "character" "date"
|
|
|
|
|
"datetime" "dec" "decimal" "double" "float" "int" "integer" "nchar"
|
|
|
|
|
"number" "numeric" "real" "smallint" "varbyte" "varchar" "byte"
|
|
|
|
|
"cursor" "long"
|
|
|
|
|
)))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
|
|
|
|
"Linter SQL keywords used by font-lock.
|
2002-11-21 08:32:06 +00:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'.")
|
|
|
|
|
|
|
|
|
|
(defvar sql-mode-ms-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(list
|
|
|
|
|
;; MS isql/osql Commands
|
|
|
|
|
(cons
|
|
|
|
|
(concat
|
|
|
|
|
"^\\(?:\\(?:set\\s-+\\(?:"
|
|
|
|
|
(regexp-opt '(
|
|
|
|
|
"datefirst" "dateformat" "deadlock_priority" "lock_timeout"
|
|
|
|
|
"concat_null_yields_null" "cursor_close_on_commit"
|
|
|
|
|
"disable_def_cnst_chk" "fips_flagger" "identity_insert" "language"
|
|
|
|
|
"offsets" "quoted_identifier" "arithabort" "arithignore" "fmtonly"
|
|
|
|
|
"nocount" "noexec" "numeric_roundabort" "parseonly"
|
|
|
|
|
"query_governor_cost_limit" "rowcount" "textsize" "ansi_defaults"
|
|
|
|
|
"ansi_null_dflt_off" "ansi_null_dflt_on" "ansi_nulls" "ansi_padding"
|
|
|
|
|
"ansi_warnings" "forceplan" "showplan_all" "showplan_text"
|
|
|
|
|
"statistics" "implicit_transactions" "remote_proc_transactions"
|
|
|
|
|
"transaction" "xact_abort"
|
2020-03-14 15:39:31 -04:00
|
|
|
|
)
|
|
|
|
|
t)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"\\)\\)\\|go\\s-*\\|use\\s-+\\|setuser\\s-+\\|dbcc\\s-+\\).*$")
|
|
|
|
|
'font-lock-doc-face)
|
|
|
|
|
|
|
|
|
|
;; MS Reserved
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"absolute" "add" "all" "alter" "and" "any" "as" "asc" "authorization"
|
|
|
|
|
"avg" "backup" "begin" "between" "break" "browse" "bulk" "by"
|
|
|
|
|
"cascade" "case" "check" "checkpoint" "close" "clustered" "coalesce"
|
|
|
|
|
"column" "commit" "committed" "compute" "confirm" "constraint"
|
|
|
|
|
"contains" "containstable" "continue" "controlrow" "convert" "count"
|
|
|
|
|
"create" "cross" "current" "current_date" "current_time"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"current_timestamp" "current_user" "database" "deallocate" "declare"
|
|
|
|
|
"default" "delete" "deny" "desc" "disk" "distinct" "distributed"
|
|
|
|
|
"double" "drop" "dummy" "dump" "else" "end" "errlvl" "errorexit"
|
|
|
|
|
"escape" "except" "exec" "execute" "exists" "exit" "fetch" "file"
|
|
|
|
|
"fillfactor" "first" "floppy" "for" "foreign" "freetext"
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"freetexttable" "from" "full" "goto" "grant" "group" "having"
|
|
|
|
|
"holdlock" "identity" "identity_insert" "identitycol" "if" "in"
|
|
|
|
|
"index" "inner" "insert" "intersect" "into" "is" "isolation" "join"
|
|
|
|
|
"key" "kill" "last" "left" "level" "like" "lineno" "load" "max" "min"
|
|
|
|
|
"mirrorexit" "national" "next" "nocheck" "nolock" "nonclustered" "not"
|
|
|
|
|
"null" "nullif" "of" "off" "offsets" "on" "once" "only" "open"
|
|
|
|
|
"opendatasource" "openquery" "openrowset" "option" "or" "order"
|
|
|
|
|
"outer" "output" "over" "paglock" "percent" "perm" "permanent" "pipe"
|
|
|
|
|
"plan" "precision" "prepare" "primary" "print" "prior" "privileges"
|
|
|
|
|
"proc" "procedure" "processexit" "public" "raiserror" "read"
|
|
|
|
|
"readcommitted" "readpast" "readtext" "readuncommitted" "reconfigure"
|
|
|
|
|
"references" "relative" "repeatable" "repeatableread" "replication"
|
|
|
|
|
"restore" "restrict" "return" "revoke" "right" "rollback" "rowcount"
|
|
|
|
|
"rowguidcol" "rowlock" "rule" "save" "schema" "select" "serializable"
|
|
|
|
|
"session_user" "set" "shutdown" "some" "statistics" "sum"
|
|
|
|
|
"system_user" "table" "tablock" "tablockx" "tape" "temp" "temporary"
|
|
|
|
|
"textsize" "then" "to" "top" "tran" "transaction" "trigger" "truncate"
|
|
|
|
|
"tsequal" "uncommitted" "union" "unique" "update" "updatetext"
|
|
|
|
|
"updlock" "use" "user" "values" "view" "waitfor" "when" "where"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"while" "with" "work" "writetext" "collate" "function" "openxml"
|
|
|
|
|
"returns"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; MS Functions
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-builtin-face nil
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"@@connections" "@@cpu_busy" "@@cursor_rows" "@@datefirst" "@@dbts"
|
|
|
|
|
"@@error" "@@fetch_status" "@@identity" "@@idle" "@@io_busy"
|
|
|
|
|
"@@langid" "@@language" "@@lock_timeout" "@@max_connections"
|
|
|
|
|
"@@max_precision" "@@nestlevel" "@@options" "@@pack_received"
|
|
|
|
|
"@@pack_sent" "@@packet_errors" "@@procid" "@@remserver" "@@rowcount"
|
|
|
|
|
"@@servername" "@@servicename" "@@spid" "@@textsize" "@@timeticks"
|
|
|
|
|
"@@total_errors" "@@total_read" "@@total_write" "@@trancount"
|
|
|
|
|
"@@version" "abs" "acos" "and" "app_name" "ascii" "asin" "atan" "atn2"
|
|
|
|
|
"avg" "case" "cast" "ceiling" "char" "charindex" "coalesce"
|
|
|
|
|
"col_length" "col_name" "columnproperty" "containstable" "convert"
|
|
|
|
|
"cos" "cot" "count" "current_timestamp" "current_user" "cursor_status"
|
|
|
|
|
"databaseproperty" "datalength" "dateadd" "datediff" "datename"
|
|
|
|
|
"datepart" "day" "db_id" "db_name" "degrees" "difference" "exp"
|
|
|
|
|
"file_id" "file_name" "filegroup_id" "filegroup_name"
|
|
|
|
|
"filegroupproperty" "fileproperty" "floor" "formatmessage"
|
|
|
|
|
"freetexttable" "fulltextcatalogproperty" "fulltextserviceproperty"
|
|
|
|
|
"getansinull" "getdate" "grouping" "host_id" "host_name" "ident_incr"
|
|
|
|
|
"ident_seed" "identity" "index_col" "indexproperty" "is_member"
|
|
|
|
|
"is_srvrolemember" "isdate" "isnull" "isnumeric" "left" "len" "log"
|
|
|
|
|
"log10" "lower" "ltrim" "max" "min" "month" "nchar" "newid" "nullif"
|
|
|
|
|
"object_id" "object_name" "objectproperty" "openquery" "openrowset"
|
|
|
|
|
"parsename" "patindex" "patindex" "permissions" "pi" "power"
|
|
|
|
|
"quotename" "radians" "rand" "replace" "replicate" "reverse" "right"
|
|
|
|
|
"round" "rtrim" "session_user" "sign" "sin" "soundex" "space" "sqrt"
|
|
|
|
|
"square" "stats_date" "stdev" "stdevp" "str" "stuff" "substring" "sum"
|
|
|
|
|
"suser_id" "suser_name" "suser_sid" "suser_sname" "system_user" "tan"
|
|
|
|
|
"textptr" "textvalid" "typeproperty" "unicode" "upper" "user"
|
|
|
|
|
"user_id" "user_name" "var" "varp" "year"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; MS Variables
|
|
|
|
|
'("\\b@[a-zA-Z0-9_]*\\b" . font-lock-variable-name-face)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; MS Types
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-type-face nil
|
|
|
|
|
"binary" "bit" "char" "character" "cursor" "datetime" "dec" "decimal"
|
|
|
|
|
"double" "float" "image" "int" "integer" "money" "national" "nchar"
|
|
|
|
|
"ntext" "numeric" "numeric" "nvarchar" "precision" "real"
|
|
|
|
|
"smalldatetime" "smallint" "smallmoney" "text" "timestamp" "tinyint"
|
|
|
|
|
"uniqueidentifier" "varbinary" "varchar" "varying"
|
|
|
|
|
)))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
|
|
|
|
"Microsoft SQLServer SQL keywords used by font-lock.
|
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-ms-font-lock-keywords'.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(defvar sql-mode-sybase-font-lock-keywords nil
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"Sybase SQL keywords used by font-lock.
|
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-sybase-font-lock-keywords'.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(defvar sql-mode-informix-font-lock-keywords nil
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"Informix SQL keywords used by font-lock.
|
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-informix-font-lock-keywords'.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(defvar sql-mode-interbase-font-lock-keywords nil
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"Interbase SQL keywords used by font-lock.
|
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-interbase-font-lock-keywords'.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(defvar sql-mode-ingres-font-lock-keywords nil
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"Ingres SQL keywords used by font-lock.
|
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-interbase-font-lock-keywords'.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(defvar sql-mode-solid-font-lock-keywords nil
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"Solid SQL keywords used by font-lock.
|
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-solid-font-lock-keywords'.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2018-06-10 20:01:36 -04:00
|
|
|
|
(defvaralias 'sql-mode-mariadb-font-lock-keywords 'sql-mode-mysql-font-lock-keywords
|
|
|
|
|
"MariaDB is SQL compatible with MySQL.")
|
|
|
|
|
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(defvar sql-mode-mysql-font-lock-keywords
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(list
|
|
|
|
|
;; MySQL Functions
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-builtin-face nil
|
2018-06-10 20:01:36 -04:00
|
|
|
|
"acos" "adddate" "addtime" "aes_decrypt" "aes_encrypt" "area"
|
|
|
|
|
"asbinary" "ascii" "asin" "astext" "aswkb" "aswkt" "atan" "atan2"
|
|
|
|
|
"avg" "bdmpolyfromtext" "bdmpolyfromwkb" "bdpolyfromtext"
|
|
|
|
|
"bdpolyfromwkb" "benchmark" "bin" "binlog_gtid_pos" "bit_and"
|
|
|
|
|
"bit_count" "bit_length" "bit_or" "bit_xor" "both" "boundary" "buffer"
|
|
|
|
|
"cast" "ceil" "ceiling" "centroid" "character_length" "char_length"
|
|
|
|
|
"charset" "coalesce" "coercibility" "column_add" "column_check"
|
|
|
|
|
"column_create" "column_delete" "column_exists" "column_get"
|
|
|
|
|
"column_json" "column_list" "compress" "concat" "concat_ws"
|
|
|
|
|
"connection_id" "conv" "convert" "convert_tz" "convexhull" "cos" "cot"
|
|
|
|
|
"count" "crc32" "crosses" "cume_dist" "cume_dist" "curdate"
|
|
|
|
|
"current_date" "current_time" "current_timestamp" "curtime" "date_add"
|
|
|
|
|
"datediff" "date_format" "date_sub" "dayname" "dayofmonth" "dayofweek"
|
|
|
|
|
"dayofyear" "decode" "decode_histogram" "degrees" "dense_rank"
|
|
|
|
|
"dense_rank" "des_decrypt" "des_encrypt" "dimension" "disjoint" "div"
|
|
|
|
|
"elt" "encode" "encrypt" "endpoint" "envelope" "exp" "export_set"
|
|
|
|
|
"exteriorring" "extractvalue" "field" "find_in_set" "floor" "format"
|
|
|
|
|
"found_rows" "from" "from_base64" "from_days" "from_unixtime"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"geomcollfromtext" "geomcollfromwkb" "geometrycollectionfromtext"
|
|
|
|
|
"geometrycollectionfromwkb" "geometryfromtext" "geometryfromwkb"
|
2018-06-10 20:01:36 -04:00
|
|
|
|
"geometryn" "geometrytype" "geomfromtext" "geomfromwkb" "get_format"
|
|
|
|
|
"get_lock" "glength" "greatest" "group_concat" "hex" "ifnull"
|
|
|
|
|
"inet6_aton" "inet6_ntoa" "inet_aton" "inet_ntoa" "instr"
|
|
|
|
|
"interiorringn" "intersects" "interval" "isclosed" "isempty"
|
|
|
|
|
"is_free_lock" "is_ipv4" "is_ipv4_compat" "is_ipv4_mapped" "is_ipv6"
|
|
|
|
|
"isnull" "isring" "issimple" "is_used_lock" "json_array"
|
|
|
|
|
"json_array_append" "json_array_insert" "json_compact" "json_contains"
|
|
|
|
|
"json_contains_path" "json_depth" "json_detailed" "json_exists"
|
|
|
|
|
"json_extract" "json_insert" "json_keys" "json_length" "json_loose"
|
|
|
|
|
"json_merge" "json_object" "json_query" "json_quote" "json_remove"
|
|
|
|
|
"json_replace" "json_search" "json_set" "json_type" "json_unquote"
|
|
|
|
|
"json_valid" "json_value" "lag" "last_day" "last_insert_id" "lastval"
|
|
|
|
|
"last_value" "last_value" "lcase" "lead" "leading" "least" "length"
|
|
|
|
|
"linefromtext" "linefromwkb" "linestringfromtext" "linestringfromwkb"
|
|
|
|
|
"ln" "load_file" "locate" "log" "log10" "log2" "lower" "lpad" "ltrim"
|
|
|
|
|
"makedate" "make_set" "maketime" "master_gtid_wait" "master_pos_wait"
|
|
|
|
|
"max" "mbrcontains" "mbrdisjoint" "mbrequal" "mbrintersects"
|
|
|
|
|
"mbroverlaps" "mbrtouches" "mbrwithin" "md5" "median"
|
|
|
|
|
"mid" "min" "mlinefromtext" "mlinefromwkb" "monthname"
|
|
|
|
|
"mpointfromtext" "mpointfromwkb" "mpolyfromtext" "mpolyfromwkb"
|
|
|
|
|
"multilinestringfromtext" "multilinestringfromwkb"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"multipointfromtext" "multipointfromwkb" "multipolygonfromtext"
|
2018-06-10 20:01:36 -04:00
|
|
|
|
"multipolygonfromwkb" "name_const" "nextval" "now" "nth_value" "ntile"
|
|
|
|
|
"ntile" "nullif" "numgeometries" "numinteriorrings" "numpoints" "oct"
|
|
|
|
|
"octet_length" "old_password" "ord" "percentile_cont"
|
|
|
|
|
"percentile_disc" "percent_rank" "percent_rank" "period_add"
|
|
|
|
|
"period_diff" "pi" "pointfromtext" "pointfromwkb" "pointn"
|
|
|
|
|
"pointonsurface" "polyfromtext" "polyfromwkb" "polygonfromtext"
|
|
|
|
|
"polygonfromwkb" "position" "pow" "power" "quote" "radians"
|
|
|
|
|
"rand" "rank" "rank" "regexp" "regexp_instr" "regexp_replace"
|
|
|
|
|
"regexp_substr" "release_lock" "repeat" "replace" "reverse" "rlike"
|
|
|
|
|
"row_number" "row_number" "rpad" "rtrim" "sec_to_time" "setval" "sha"
|
|
|
|
|
"sha1" "sha2" "sign" "sin" "sleep" "soundex" "space"
|
|
|
|
|
"spider_bg_direct_sql" "spider_copy_tables" "spider_direct_sql"
|
|
|
|
|
"spider_flush_table_mon_cache" "sqrt" "srid" "st_area" "startpoint"
|
|
|
|
|
"st_asbinary" "st_astext" "st_aswkb" "st_aswkt" "st_boundary"
|
|
|
|
|
"st_buffer" "st_centroid" "st_contains" "st_convexhull" "st_crosses"
|
|
|
|
|
"std" "stddev" "stddev_pop" "stddev_samp" "st_difference"
|
|
|
|
|
"st_dimension" "st_disjoint" "st_distance" "st_endpoint" "st_envelope"
|
|
|
|
|
"st_equals" "st_exteriorring" "st_geomcollfromtext"
|
|
|
|
|
"st_geomcollfromwkb" "st_geometrycollectionfromtext"
|
|
|
|
|
"st_geometrycollectionfromwkb" "st_geometryfromtext"
|
|
|
|
|
"st_geometryfromwkb" "st_geometryn" "st_geometrytype"
|
|
|
|
|
"st_geomfromtext" "st_geomfromwkb" "st_interiorringn"
|
|
|
|
|
"st_intersection" "st_intersects" "st_isclosed" "st_isempty"
|
|
|
|
|
"st_isring" "st_issimple" "st_length" "st_linefromtext"
|
|
|
|
|
"st_linefromwkb" "st_linestringfromtext" "st_linestringfromwkb"
|
|
|
|
|
"st_numgeometries" "st_numinteriorrings" "st_numpoints" "st_overlaps"
|
|
|
|
|
"st_pointfromtext" "st_pointfromwkb" "st_pointn" "st_pointonsurface"
|
|
|
|
|
"st_polyfromtext" "st_polyfromwkb" "st_polygonfromtext"
|
|
|
|
|
"st_polygonfromwkb" "strcmp" "st_relate" "str_to_date" "st_srid"
|
|
|
|
|
"st_startpoint" "st_symdifference" "st_touches" "st_union" "st_within"
|
|
|
|
|
"st_x" "st_y" "subdate" "substr" "substring" "substring_index"
|
|
|
|
|
"subtime" "sum" "sysdate" "tan" "timediff" "time_format"
|
|
|
|
|
"timestampadd" "timestampdiff" "time_to_sec" "to_base64" "to_days"
|
|
|
|
|
"to_seconds" "touches" "trailing" "trim" "ucase" "uncompress"
|
|
|
|
|
"uncompressed_length" "unhex" "unix_timestamp" "updatexml" "upper"
|
|
|
|
|
"user" "utc_date" "utc_time" "utc_timestamp" "uuid" "uuid_short"
|
|
|
|
|
"variance" "var_pop" "var_samp" "version" "weekday"
|
|
|
|
|
"weekofyear" "weight_string" "within"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; MySQL Keywords
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
2018-06-10 20:01:36 -04:00
|
|
|
|
"accessible" "action" "add" "after" "against" "all" "alter" "analyze"
|
|
|
|
|
"and" "as" "asc" "auto_increment" "avg_row_length" "bdb" "between"
|
|
|
|
|
"body" "by" "cascade" "case" "change" "character" "check" "checksum"
|
|
|
|
|
"close" "collate" "collation" "column" "columns" "comment" "committed"
|
|
|
|
|
"concurrent" "condition" "constraint" "create" "cross" "data"
|
|
|
|
|
"database" "databases" "default" "delayed" "delay_key_write" "delete"
|
|
|
|
|
"desc" "directory" "disable" "distinct" "distinctrow" "do" "drop"
|
|
|
|
|
"dual" "dumpfile" "duplicate" "else" "elseif" "elsif" "enable"
|
|
|
|
|
"enclosed" "end" "escaped" "exists" "exit" "explain" "fields" "first"
|
|
|
|
|
"for" "force" "foreign" "from" "full" "fulltext" "global" "group"
|
|
|
|
|
"handler" "having" "heap" "high_priority" "history" "if" "ignore"
|
|
|
|
|
"ignore_server_ids" "in" "index" "infile" "inner" "insert"
|
|
|
|
|
"insert_method" "into" "is" "isam" "isolation" "join" "key" "keys"
|
|
|
|
|
"kill" "last" "leave" "left" "level" "like" "limit" "linear" "lines"
|
|
|
|
|
"load" "local" "lock" "long" "loop" "low_priority"
|
|
|
|
|
"master_heartbeat_period" "master_ssl_verify_server_cert" "match"
|
|
|
|
|
"max_rows" "maxvalue" "merge" "min_rows" "mode" "modify" "mrg_myisam"
|
|
|
|
|
"myisam" "natural" "next" "no" "not" "no_write_to_binlog" "null"
|
|
|
|
|
"offset" "oj" "on" "open" "optimize" "optionally" "or" "order" "outer"
|
|
|
|
|
"outfile" "over" "package" "pack_keys" "partial" "partition"
|
|
|
|
|
"password" "period" "prev" "primary" "procedure" "purge" "quick"
|
|
|
|
|
"raid0" "raid_type" "raise" "range" "read" "read_write" "references"
|
|
|
|
|
"release" "rename" "repeatable" "require" "resignal" "restrict"
|
|
|
|
|
"returning" "right" "rollback" "rollup" "row_format" "rowtype"
|
|
|
|
|
"savepoint" "schemas" "select" "separator" "serializable" "session"
|
|
|
|
|
"set" "share" "show" "signal" "slow" "spatial" "sql_big_result"
|
|
|
|
|
"sql_buffer_result" "sql_cache" "sql_calc_found_rows" "sql_no_cache"
|
|
|
|
|
"sql_small_result" "ssl" "starting" "straight_join" "striped"
|
|
|
|
|
"system_time" "table" "tables" "temporary" "terminated" "then" "to"
|
|
|
|
|
"transaction" "truncate" "type" "uncommitted" "undo" "union" "unique"
|
|
|
|
|
"unlock" "update" "use" "using" "values" "versioning" "when" "where"
|
|
|
|
|
"while" "window" "with" "write" "xor"
|
2010-05-09 22:07:58 -04:00
|
|
|
|
)
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; MySQL Data Types
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-type-face nil
|
2018-06-10 20:01:36 -04:00
|
|
|
|
"bigint" "binary" "bit" "blob" "bool" "boolean" "byte" "char" "curve"
|
|
|
|
|
"date" "datetime" "day" "day_hour" "day_microsecond" "day_minute"
|
|
|
|
|
"day_second" "dec" "decimal" "double" "enum" "fixed" "float" "float4"
|
|
|
|
|
"float8" "geometry" "geometrycollection" "hour" "hour_microsecond"
|
|
|
|
|
"hour_minute" "hour_second" "int" "int1" "int2" "int3" "int4" "int8"
|
|
|
|
|
"integer" "json" "line" "linearring" "linestring" "longblob"
|
|
|
|
|
"longtext" "mediumblob" "mediumint" "mediumtext" "microsecond"
|
|
|
|
|
"middleint" "minute" "minute_microsecond" "minute_second" "month"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
"multicurve" "multilinestring" "multipoint" "multipolygon"
|
|
|
|
|
"multisurface" "national" "numeric" "point" "polygon" "precision"
|
2018-06-10 20:01:36 -04:00
|
|
|
|
"quarter" "real" "second" "second_microsecond" "signed" "smallint"
|
|
|
|
|
"surface" "text" "time" "timestamp" "tinyblob" "tinyint" "tinytext"
|
|
|
|
|
"unsigned" "varbinary" "varchar" "varcharacter" "week" "year" "year2"
|
|
|
|
|
"year4" "year_month" "zerofill"
|
2004-04-29 21:55:28 +00:00
|
|
|
|
)))
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"MySQL SQL keywords used by font-lock.
|
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-mysql-font-lock-keywords'.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-08-07 19:57:07 -04:00
|
|
|
|
(defvar sql-mode-sqlite-font-lock-keywords
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(list
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
;; SQLite commands
|
|
|
|
|
'("^[.].*$" . font-lock-doc-face)
|
|
|
|
|
|
2010-08-07 19:57:07 -04:00
|
|
|
|
;; SQLite Keyword
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-keyword-face nil
|
|
|
|
|
"abort" "action" "add" "after" "all" "alter" "analyze" "and" "as"
|
|
|
|
|
"asc" "attach" "autoincrement" "before" "begin" "between" "by"
|
|
|
|
|
"cascade" "case" "cast" "check" "collate" "column" "commit" "conflict"
|
2010-08-10 19:04:32 -04:00
|
|
|
|
"constraint" "create" "cross" "database" "default" "deferrable"
|
|
|
|
|
"deferred" "delete" "desc" "detach" "distinct" "drop" "each" "else"
|
|
|
|
|
"end" "escape" "except" "exclusive" "exists" "explain" "fail" "for"
|
2010-08-07 19:57:07 -04:00
|
|
|
|
"foreign" "from" "full" "glob" "group" "having" "if" "ignore"
|
|
|
|
|
"immediate" "in" "index" "indexed" "initially" "inner" "insert"
|
|
|
|
|
"instead" "intersect" "into" "is" "isnull" "join" "key" "left" "like"
|
|
|
|
|
"limit" "match" "natural" "no" "not" "notnull" "null" "of" "offset"
|
|
|
|
|
"on" "or" "order" "outer" "plan" "pragma" "primary" "query" "raise"
|
|
|
|
|
"references" "regexp" "reindex" "release" "rename" "replace"
|
|
|
|
|
"restrict" "right" "rollback" "row" "savepoint" "select" "set" "table"
|
|
|
|
|
"temp" "temporary" "then" "to" "transaction" "trigger" "union"
|
|
|
|
|
"unique" "update" "using" "vacuum" "values" "view" "virtual" "when"
|
|
|
|
|
"where"
|
|
|
|
|
)
|
|
|
|
|
;; SQLite Data types
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-type-face nil
|
|
|
|
|
"int" "integer" "tinyint" "smallint" "mediumint" "bigint" "unsigned"
|
2010-08-10 19:04:32 -04:00
|
|
|
|
"big" "int2" "int8" "character" "varchar" "varying" "nchar" "native"
|
2010-08-07 19:57:07 -04:00
|
|
|
|
"nvarchar" "text" "clob" "blob" "real" "double" "precision" "float"
|
2010-08-10 19:04:32 -04:00
|
|
|
|
"numeric" "number" "decimal" "boolean" "date" "datetime"
|
2010-08-07 19:57:07 -04:00
|
|
|
|
)
|
|
|
|
|
;; SQLite Functions
|
|
|
|
|
(sql-font-lock-keywords-builder 'font-lock-builtin-face nil
|
|
|
|
|
;; Core functions
|
|
|
|
|
"abs" "changes" "coalesce" "glob" "ifnull" "hex" "last_insert_rowid"
|
|
|
|
|
"length" "like" "load_extension" "lower" "ltrim" "max" "min" "nullif"
|
|
|
|
|
"quote" "random" "randomblob" "replace" "round" "rtrim" "soundex"
|
|
|
|
|
"sqlite_compileoption_get" "sqlite_compileoption_used"
|
|
|
|
|
"sqlite_source_id" "sqlite_version" "substr" "total_changes" "trim"
|
|
|
|
|
"typeof" "upper" "zeroblob"
|
|
|
|
|
;; Date/time functions
|
|
|
|
|
"time" "julianday" "strftime"
|
2010-08-10 19:04:32 -04:00
|
|
|
|
"current_date" "current_time" "current_timestamp"
|
2010-08-07 19:57:07 -04:00
|
|
|
|
;; Aggregate functions
|
|
|
|
|
"avg" "count" "group_concat" "max" "min" "sum" "total"
|
|
|
|
|
)))
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"SQLite SQL keywords used by font-lock.
|
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-sqlite-font-lock-keywords'.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(defvar sql-mode-db2-font-lock-keywords nil
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"DB2 SQL keywords used by font-lock.
|
|
|
|
|
|
|
|
|
|
This variable is used by `sql-mode' and `sql-interactive-mode'. The
|
|
|
|
|
regular expressions are created during compilation by calling the
|
|
|
|
|
function `regexp-opt'. Therefore, take a look at the source before
|
2010-04-24 04:59:23 +02:00
|
|
|
|
you define your own `sql-mode-db2-font-lock-keywords'.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
|
|
|
|
(defvar sql-mode-font-lock-keywords nil
|
1999-01-11 15:26:36 +00:00
|
|
|
|
"SQL keywords used by font-lock.
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
Setting this variable directly no longer has any affect. Use
|
|
|
|
|
`sql-product' and `sql-add-product-keywords' to control the
|
2010-04-24 04:59:23 +02:00
|
|
|
|
highlighting rules in SQL mode.")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; SQL Product support functions
|
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(defun sql-read-product (prompt &optional initial)
|
|
|
|
|
"Read a valid SQL product."
|
|
|
|
|
(let ((init (or (and initial (symbol-name initial)) "ansi")))
|
|
|
|
|
(intern (completing-read
|
|
|
|
|
prompt
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(mapcar (lambda (info) (symbol-name (car info)))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
sql-product-alist)
|
|
|
|
|
nil 'require-match
|
|
|
|
|
init 'sql-product-history init))))
|
|
|
|
|
|
2020-03-29 20:52:10 -04:00
|
|
|
|
(defun sql-add-product (product display &rest plist)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Add support for a database product in `sql-mode'.
|
|
|
|
|
|
|
|
|
|
Add PRODUCT to `sql-product-alist' which enables `sql-mode' to
|
|
|
|
|
properly support syntax highlighting and interactive interaction.
|
|
|
|
|
DISPLAY is the name of the SQL product that will appear in the
|
|
|
|
|
menu bar and in messages. PLIST initializes the product
|
|
|
|
|
configuration."
|
|
|
|
|
|
|
|
|
|
;; Don't do anything if the product is already supported
|
|
|
|
|
(if (assoc product sql-product-alist)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "Product `%s' is already defined" product)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
;; Add product to the alist
|
2013-10-12 22:23:42 -07:00
|
|
|
|
(add-to-list 'sql-product-alist `(,product :name ,display . ,plist))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Add a menu item to the SQL->Product menu
|
|
|
|
|
(easy-menu-add-item sql-mode-menu '("Product")
|
|
|
|
|
;; Each product is represented by a radio
|
|
|
|
|
;; button with it's display name.
|
|
|
|
|
`[,display
|
2010-07-20 21:56:55 -04:00
|
|
|
|
(sql-set-product ',product)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
:style radio
|
|
|
|
|
:selected (eq sql-product ',product)]
|
|
|
|
|
;; Maintain the product list in
|
|
|
|
|
;; (case-insensitive) alphabetic order of the
|
|
|
|
|
;; display names. Loop thru each keymap item
|
|
|
|
|
;; looking for an item whose display name is
|
|
|
|
|
;; after this product's name.
|
|
|
|
|
(let ((next-item)
|
|
|
|
|
(down-display (downcase display)))
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(map-keymap (lambda (k b)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(when (and (not next-item)
|
|
|
|
|
(string-lessp down-display
|
|
|
|
|
(downcase (cadr b))))
|
|
|
|
|
(setq next-item k)))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(easy-menu-get-map sql-mode-menu '("Product")))
|
|
|
|
|
next-item))
|
|
|
|
|
product))
|
|
|
|
|
|
|
|
|
|
(defun sql-del-product (product)
|
|
|
|
|
"Remove support for PRODUCT in `sql-mode'."
|
|
|
|
|
|
|
|
|
|
;; Remove the menu item based on the display name
|
|
|
|
|
(easy-menu-remove-item sql-mode-menu '("Product") (sql-get-product-feature product :name))
|
|
|
|
|
;; Remove the product alist item
|
|
|
|
|
(setq sql-product-alist (assq-delete-all product sql-product-alist))
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defun sql-set-product-feature (product feature newvalue)
|
|
|
|
|
"Set FEATURE of database PRODUCT to NEWVALUE.
|
|
|
|
|
|
|
|
|
|
The PRODUCT must be a symbol which identifies the database
|
|
|
|
|
product. The product must have already exist on the product
|
|
|
|
|
list. See `sql-add-product' to add new products. The FEATURE
|
|
|
|
|
argument must be a plist keyword accepted by
|
|
|
|
|
`sql-product-alist'."
|
|
|
|
|
|
2019-02-20 22:13:51 -05:00
|
|
|
|
(let* ((p (assoc product sql-product-alist)) ;; (PRODUCT :f v ...)
|
|
|
|
|
(v (plist-member (cdr p) feature))) ;; (:FEATURE value ...) or null
|
|
|
|
|
|
|
|
|
|
(if p
|
|
|
|
|
(if (member feature sql-indirect-features) ; is indirect
|
|
|
|
|
(if v
|
|
|
|
|
(if (car (cdr v))
|
|
|
|
|
(if (symbolp (car (cdr v)))
|
|
|
|
|
;; Indirect reference
|
|
|
|
|
(set (car (cdr v)) newvalue)
|
|
|
|
|
;; indirect is not a symbol
|
|
|
|
|
(error "The value of `%s' for `%s' is not a symbol" feature product))
|
|
|
|
|
;; keyword present, set the indirect variable name
|
|
|
|
|
(if (symbolp newvalue)
|
|
|
|
|
(if (cdr v)
|
|
|
|
|
(setf (car (cdr v)) newvalue)
|
|
|
|
|
(setf (cdr v) (list newvalue)))
|
|
|
|
|
(error "The indirect variable of `%s' for `%s' must be a symbol" feature product)))
|
|
|
|
|
;; not present; insert list
|
|
|
|
|
(setq v (list feature newvalue))
|
|
|
|
|
(setf (cdr (cdr v)) (cdr p))
|
|
|
|
|
(setf (cdr p) v))
|
|
|
|
|
;; Not an indirect feature
|
|
|
|
|
(if v
|
|
|
|
|
(if (cdr v)
|
|
|
|
|
(setf (car (cdr v)) newvalue)
|
|
|
|
|
(setf (cdr v) (list newvalue)))
|
|
|
|
|
;; no value; insert into the list
|
|
|
|
|
(setq v (list feature newvalue))
|
|
|
|
|
(setf (cdr (cdr v)) (cdr p))
|
|
|
|
|
(setf (cdr p) v)))
|
|
|
|
|
(error "`%s' is not a known product; use `sql-add-product' to add it first" product))))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2010-07-18 14:44:32 -04:00
|
|
|
|
(defun sql-get-product-feature (product feature &optional fallback not-indirect)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Lookup FEATURE associated with a SQL PRODUCT.
|
|
|
|
|
|
|
|
|
|
If the FEATURE is nil for PRODUCT, and FALLBACK is specified,
|
|
|
|
|
then the FEATURE associated with the FALLBACK product is
|
|
|
|
|
returned.
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-07-18 14:44:32 -04:00
|
|
|
|
If the FEATURE is in the list `sql-indirect-features', and the
|
|
|
|
|
NOT-INDIRECT parameter is not set, then the value of the symbol
|
|
|
|
|
stored in the connect alist is returned.
|
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
See `sql-product-alist' for a list of products and supported features."
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(let* ((p (assoc product sql-product-alist))
|
|
|
|
|
(v (plist-get (cdr p) feature)))
|
|
|
|
|
|
|
|
|
|
(if p
|
|
|
|
|
;; If no value and fallback, lookup feature for fallback
|
|
|
|
|
(if (and (not v)
|
|
|
|
|
fallback
|
|
|
|
|
(not (eq product fallback)))
|
|
|
|
|
(sql-get-product-feature fallback feature)
|
|
|
|
|
|
|
|
|
|
(if (and
|
|
|
|
|
(member feature sql-indirect-features)
|
2010-07-18 14:44:32 -04:00
|
|
|
|
(not not-indirect)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(symbolp v))
|
2020-03-14 15:39:31 -04:00
|
|
|
|
(symbol-value v)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
v))
|
2021-09-14 08:43:18 +02:00
|
|
|
|
(error "`%s' is not a known product; use `sql-add-product' to add it first" product)
|
2010-07-20 21:56:55 -04:00
|
|
|
|
nil)))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
|
|
|
|
(defun sql-product-font-lock (keywords-only imenu)
|
2010-05-14 15:31:36 +02:00
|
|
|
|
"Configure font-lock and imenu with product-specific settings.
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
The KEYWORDS-ONLY flag is passed to font-lock to specify whether
|
2011-11-26 20:43:11 -08:00
|
|
|
|
only keywords should be highlighted and syntactic highlighting
|
2020-09-23 13:35:55 +02:00
|
|
|
|
skipped. The IMENU flag indicates whether `imenu' should also be
|
|
|
|
|
configured."
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(let
|
|
|
|
|
;; Get the product-specific syntax-alist.
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
((syntax-alist (sql-product-font-lock-syntax-alist)))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
|
|
|
|
;; Get the product-specific keywords.
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-mode-font-lock-keywords
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
(append
|
|
|
|
|
(unless (eq sql-product 'ansi)
|
|
|
|
|
(sql-get-product-feature sql-product :font-lock))
|
|
|
|
|
;; Always highlight ANSI keywords
|
|
|
|
|
(sql-get-product-feature 'ansi :font-lock)
|
|
|
|
|
;; Fontify object names in CREATE, DROP and ALTER DDL
|
|
|
|
|
;; statements
|
|
|
|
|
(list sql-mode-font-lock-object-name)))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2004-05-04 21:59:40 +00:00
|
|
|
|
;; Setup font-lock. Force re-parsing of `font-lock-defaults'.
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(kill-local-variable 'font-lock-set-defaults)
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local font-lock-defaults
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
(list 'sql-mode-font-lock-keywords
|
|
|
|
|
keywords-only t syntax-alist))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2004-05-04 21:59:40 +00:00
|
|
|
|
;; Force font lock to reinitialize if it is already on
|
|
|
|
|
;; Otherwise, we can wait until it can be started.
|
2021-02-05 01:14:17 +01:00
|
|
|
|
(when font-lock-mode
|
2004-05-04 21:59:40 +00:00
|
|
|
|
(font-lock-mode-internal nil)
|
|
|
|
|
(font-lock-mode-internal t))
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Setup imenu; it needs the same syntax-alist.
|
|
|
|
|
(when imenu
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(setq imenu-syntax-alist syntax-alist))))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(defun sql-add-product-keywords (product keywords &optional append)
|
|
|
|
|
"Add highlighting KEYWORDS for SQL PRODUCT.
|
|
|
|
|
|
2010-05-14 15:31:36 +02:00
|
|
|
|
PRODUCT should be a symbol, the name of a SQL product, such as
|
2004-04-29 21:55:28 +00:00
|
|
|
|
`oracle'. KEYWORDS should be a list; see the variable
|
|
|
|
|
`font-lock-keywords'. By default they are added at the beginning
|
|
|
|
|
of the current highlighting list. If optional argument APPEND is
|
|
|
|
|
`set', they are used to replace the current highlighting list.
|
|
|
|
|
If APPEND is any other non-nil value, they are added at the end
|
|
|
|
|
of the current highlighting list.
|
|
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
2015-09-01 18:21:42 -07:00
|
|
|
|
(sql-add-product-keywords \\='ms
|
|
|
|
|
\\='((\"\\\\b\\\\w+_t\\\\b\" . font-lock-type-face)))
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
|
|
|
|
adds a fontification pattern to fontify identifiers ending in
|
|
|
|
|
`_t' as data types."
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(let* ((sql-indirect-features nil)
|
|
|
|
|
(font-lock-var (sql-get-product-feature product :font-lock))
|
|
|
|
|
(old-val))
|
|
|
|
|
|
|
|
|
|
(setq old-val (symbol-value font-lock-var))
|
|
|
|
|
(set font-lock-var
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(if (eq append 'set)
|
|
|
|
|
keywords
|
|
|
|
|
(if append
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(append old-val keywords)
|
|
|
|
|
(append keywords old-val))))))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-07-22 20:59:43 -04:00
|
|
|
|
(defun sql-for-each-login (login-params body)
|
2012-12-06 12:29:30 -05:00
|
|
|
|
"Iterate through login parameters and return a list of results."
|
2010-07-22 20:59:43 -04:00
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(lambda (param)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(let ((token (or (car-safe param) param))
|
|
|
|
|
(plist (cdr-safe param)))
|
|
|
|
|
(funcall body token plist)))
|
2010-07-22 20:59:43 -04:00
|
|
|
|
login-params)))
|
|
|
|
|
|
2000-08-16 02:34:28 +00:00
|
|
|
|
|
2000-08-17 11:20:50 +00:00
|
|
|
|
|
2001-04-20 10:03:48 +00:00
|
|
|
|
;;; Functions to switch highlighting
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(defun sql-product-syntax-table ()
|
|
|
|
|
(let ((table (copy-syntax-table sql-mode-syntax-table)))
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(mapc (lambda (entry)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(modify-syntax-entry (car entry) (cdr entry) table))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-get-product-feature sql-product :syntax-alist))
|
|
|
|
|
table))
|
|
|
|
|
|
|
|
|
|
(defun sql-product-font-lock-syntax-alist ()
|
|
|
|
|
(append
|
|
|
|
|
;; Change all symbol character to word characters
|
|
|
|
|
(mapcar
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(lambda (entry) (if (string= (substring (cdr entry) 0 1) "_")
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(cons (car entry)
|
|
|
|
|
(concat "w" (substring (cdr entry) 1)))
|
|
|
|
|
entry))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-get-product-feature sql-product :syntax-alist))
|
|
|
|
|
'((?_ . "w"))))
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(defun sql-highlight-product ()
|
2010-05-14 15:31:36 +02:00
|
|
|
|
"Turn on the font highlighting for the SQL product selected."
|
2009-08-16 15:48:15 +00:00
|
|
|
|
(when (derived-mode-p 'sql-mode)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Enhance the syntax table for the product
|
|
|
|
|
(set-syntax-table (sql-product-syntax-table))
|
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Setup font-lock
|
|
|
|
|
(sql-product-font-lock nil t)
|
|
|
|
|
|
|
|
|
|
;; Set the mode name to include the product.
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(setq mode-name (concat "SQL[" (or (sql-get-product-feature sql-product :name)
|
|
|
|
|
(symbol-name sql-product)) "]"))))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
|
|
|
|
(defun sql-set-product (product)
|
2010-05-14 15:31:36 +02:00
|
|
|
|
"Set `sql-product' to PRODUCT and enable appropriate highlighting."
|
2009-08-16 15:48:15 +00:00
|
|
|
|
(interactive
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(list (sql-read-product "SQL product: ")))
|
2009-08-16 15:48:15 +00:00
|
|
|
|
(if (stringp product) (setq product (intern product)))
|
2004-04-29 21:55:28 +00:00
|
|
|
|
(when (not (assoc product sql-product-alist))
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "SQL product %s is not supported; treated as ANSI" product)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(setq product 'ansi))
|
|
|
|
|
|
|
|
|
|
;; Save product setting and fontify.
|
|
|
|
|
(setq sql-product product)
|
|
|
|
|
(sql-highlight-product))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(defalias 'sql-set-dialect 'sql-set-product)
|
2001-04-20 10:03:48 +00:00
|
|
|
|
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(defun sql-buffer-hidden-p (buf)
|
|
|
|
|
"Is the buffer hidden?"
|
|
|
|
|
(string-prefix-p " "
|
|
|
|
|
(cond
|
|
|
|
|
((stringp buf)
|
|
|
|
|
(when (get-buffer buf)
|
|
|
|
|
buf))
|
|
|
|
|
((bufferp buf)
|
|
|
|
|
(buffer-name buf))
|
|
|
|
|
(t nil))))
|
|
|
|
|
|
|
|
|
|
(defun sql-display-buffer (buf)
|
|
|
|
|
"Display a SQLi buffer based on `sql-display-sqli-buffer-function'.
|
|
|
|
|
|
|
|
|
|
If BUF is hidden or `sql-display-sqli-buffer-function' is nil,
|
2021-09-14 08:43:18 +02:00
|
|
|
|
then the buffer will not be displayed. Otherwise the BUF is
|
2018-06-02 19:21:31 -04:00
|
|
|
|
displayed."
|
|
|
|
|
(unless (sql-buffer-hidden-p buf)
|
|
|
|
|
(cond
|
|
|
|
|
((eq sql-display-sqli-buffer-function t)
|
|
|
|
|
(pop-to-buffer buf))
|
|
|
|
|
((not sql-display-sqli-buffer-function)
|
|
|
|
|
nil)
|
|
|
|
|
((functionp sql-display-sqli-buffer-function)
|
|
|
|
|
(funcall sql-display-sqli-buffer-function buf))
|
|
|
|
|
(t
|
|
|
|
|
(message "Invalid setting of `sql-display-sqli-buffer-function'")
|
|
|
|
|
(pop-to-buffer buf)))))
|
|
|
|
|
|
|
|
|
|
(defun sql-make-progress-reporter (buf message &optional min-value max-value current-value min-change min-time)
|
|
|
|
|
"Make a progress reporter if BUF is not hidden."
|
|
|
|
|
(unless (or (sql-buffer-hidden-p buf)
|
|
|
|
|
(not sql-display-sqli-buffer-function))
|
|
|
|
|
(make-progress-reporter message min-value max-value current-value min-change min-time)))
|
|
|
|
|
|
|
|
|
|
(defun sql-progress-reporter-update (reporter &optional value)
|
|
|
|
|
"Report progress of an operation in the echo area."
|
|
|
|
|
(when reporter
|
|
|
|
|
(progress-reporter-update reporter value)))
|
|
|
|
|
|
|
|
|
|
(defun sql-progress-reporter-done (reporter)
|
|
|
|
|
"Print reporter’s message followed by word \"done\" in echo area."
|
|
|
|
|
(when reporter
|
|
|
|
|
(progress-reporter-done reporter)))
|
2001-04-20 10:03:48 +00:00
|
|
|
|
|
2012-12-06 12:29:30 -05:00
|
|
|
|
;;; SMIE support
|
|
|
|
|
|
|
|
|
|
;; Needs a lot more love than I can provide. --Stef
|
|
|
|
|
|
|
|
|
|
;; (require 'smie)
|
|
|
|
|
|
|
|
|
|
;; (defconst sql-smie-grammar
|
|
|
|
|
;; (smie-prec2->grammar
|
|
|
|
|
;; (smie-bnf->prec2
|
2021-03-24 09:28:32 +01:00
|
|
|
|
;; ;; Partly based on https://www.h2database.com/html/grammar.html
|
2012-12-06 12:29:30 -05:00
|
|
|
|
;; '((cmd ("SELECT" select-exp "FROM" select-table-exp)
|
|
|
|
|
;; )
|
|
|
|
|
;; (select-exp ("*") (exp) (exp "AS" column-alias))
|
|
|
|
|
;; (column-alias)
|
|
|
|
|
;; (select-table-exp (table-exp "WHERE" exp) (table-exp))
|
|
|
|
|
;; (table-exp)
|
|
|
|
|
;; (exp ("CASE" exp "WHEN" exp "THEN" exp "ELSE" exp "END")
|
|
|
|
|
;; ("CASE" exp "WHEN" exp "THEN" exp "END"))
|
|
|
|
|
;; ;; Random ad-hoc additions.
|
|
|
|
|
;; (foo (foo "," foo))
|
|
|
|
|
;; )
|
|
|
|
|
;; '((assoc ",")))))
|
|
|
|
|
|
|
|
|
|
;; (defun sql-smie-rules (kind token)
|
|
|
|
|
;; (pcase (cons kind token)
|
|
|
|
|
;; (`(:list-intro . ,_) t)
|
|
|
|
|
;; (`(:before . "(") (smie-rule-parent))))
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;;; Motion Functions
|
|
|
|
|
|
|
|
|
|
(defun sql-statement-regexp (prod)
|
2019-02-18 21:51:09 -05:00
|
|
|
|
(let* ((ansi-stmt (or (sql-get-product-feature 'ansi :statement) "select"))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(prod-stmt (sql-get-product-feature prod :statement)))
|
|
|
|
|
(concat "^\\<"
|
|
|
|
|
(if prod-stmt
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(concat "\\(" ansi-stmt "\\|" prod-stmt "\\)")
|
|
|
|
|
ansi-stmt)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"\\>")))
|
|
|
|
|
|
|
|
|
|
(defun sql-beginning-of-statement (arg)
|
2012-12-06 12:29:30 -05:00
|
|
|
|
"Move to the beginning of the current SQL statement."
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(interactive "p")
|
|
|
|
|
|
|
|
|
|
(let ((here (point))
|
|
|
|
|
(regexp (sql-statement-regexp sql-product))
|
|
|
|
|
last next)
|
|
|
|
|
|
|
|
|
|
;; Go to the end of the statement before the start we desire
|
|
|
|
|
(setq last (or (sql-end-of-statement (- arg))
|
|
|
|
|
(point-min)))
|
|
|
|
|
;; And find the end after that
|
|
|
|
|
(setq next (or (sql-end-of-statement 1)
|
|
|
|
|
(point-max)))
|
|
|
|
|
|
|
|
|
|
;; Our start must be between them
|
|
|
|
|
(goto-char last)
|
2018-02-16 17:33:57 -05:00
|
|
|
|
;; Find a beginning-of-stmt that's not in a comment
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(while (and (re-search-forward regexp next t 1)
|
|
|
|
|
(nth 7 (syntax-ppss)))
|
|
|
|
|
(goto-char (match-end 0)))
|
|
|
|
|
(goto-char
|
|
|
|
|
(if (match-data)
|
|
|
|
|
(match-beginning 0)
|
|
|
|
|
last))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
;; If we didn't move, try again
|
|
|
|
|
(when (= here (point))
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(sql-beginning-of-statement (* 2 (cl-signum arg))))))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-end-of-statement (arg)
|
2012-12-06 12:29:30 -05:00
|
|
|
|
"Move to the end of the current SQL statement."
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(interactive "p")
|
2019-03-22 22:28:01 -04:00
|
|
|
|
(let ((term (or (sql-get-product-feature sql-product :terminator) ";"))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(re-search (if (> 0 arg) 're-search-backward 're-search-forward))
|
|
|
|
|
(here (point))
|
|
|
|
|
(n 0))
|
|
|
|
|
(when (consp term)
|
|
|
|
|
(setq term (car term)))
|
|
|
|
|
;; Iterate until we've moved the desired number of stmt ends
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(while (not (= (cl-signum arg) 0))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; if we're looking at the terminator, jump by 2
|
2017-01-29 19:34:35 +01:00
|
|
|
|
(if (or (and (> 0 arg) (looking-back term nil))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(and (< 0 arg) (looking-at term)))
|
|
|
|
|
(setq n 2)
|
|
|
|
|
(setq n 1))
|
|
|
|
|
;; If we found another end-of-stmt
|
|
|
|
|
(if (not (apply re-search term nil t n nil))
|
|
|
|
|
(setq arg 0)
|
|
|
|
|
;; count it if we're not in a comment
|
|
|
|
|
(unless (nth 7 (syntax-ppss))
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(setq arg (- arg (cl-signum arg))))))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(goto-char (if (match-data)
|
|
|
|
|
(match-end 0)
|
|
|
|
|
here))))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
;;; Small functions
|
|
|
|
|
|
2000-06-26 13:09:49 +00:00
|
|
|
|
(defun sql-magic-go (arg)
|
|
|
|
|
"Insert \"o\" and call `comint-send-input'.
|
|
|
|
|
`sql-electric-stuff' must be the symbol `go'."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(self-insert-command (prefix-numeric-value arg))
|
|
|
|
|
(if (and (equal sql-electric-stuff 'go)
|
|
|
|
|
(save-excursion
|
2000-08-07 14:52:52 +00:00
|
|
|
|
(comint-bol nil)
|
|
|
|
|
(looking-at "go\\b")))
|
2000-06-26 13:09:49 +00:00
|
|
|
|
(comint-send-input)))
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(put 'sql-magic-go 'delete-selection t)
|
2000-06-26 13:09:49 +00:00
|
|
|
|
|
|
|
|
|
(defun sql-magic-semicolon (arg)
|
|
|
|
|
"Insert semicolon and call `comint-send-input'.
|
|
|
|
|
`sql-electric-stuff' must be the symbol `semicolon'."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(self-insert-command (prefix-numeric-value arg))
|
|
|
|
|
(if (equal sql-electric-stuff 'semicolon)
|
|
|
|
|
(comint-send-input)))
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(put 'sql-magic-semicolon 'delete-selection t)
|
2000-06-26 13:09:49 +00:00
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(defun sql-accumulate-and-indent ()
|
|
|
|
|
"Continue SQL statement on the next line."
|
|
|
|
|
(interactive)
|
2002-11-21 08:32:06 +00:00
|
|
|
|
(if (fboundp 'comint-accumulate)
|
2000-06-26 13:09:49 +00:00
|
|
|
|
(comint-accumulate)
|
|
|
|
|
(newline))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(indent-according-to-mode))
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defun sql-help-list-products (indent freep)
|
|
|
|
|
"Generate listing of products available for use under SQLi.
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
List products with :free-software attribute set to FREEP. Indent
|
2010-05-09 22:07:58 -04:00
|
|
|
|
each line with INDENT."
|
|
|
|
|
|
|
|
|
|
(let (sqli-func doc)
|
|
|
|
|
(setq doc "")
|
|
|
|
|
(dolist (p sql-product-alist)
|
|
|
|
|
(setq sqli-func (intern (concat "sql-" (symbol-name (car p)))))
|
|
|
|
|
|
|
|
|
|
(if (and (fboundp sqli-func)
|
|
|
|
|
(eq (sql-get-product-feature (car p) :free-software) freep))
|
|
|
|
|
(setq doc
|
|
|
|
|
(concat doc
|
|
|
|
|
indent
|
|
|
|
|
(or (sql-get-product-feature (car p) :name)
|
|
|
|
|
(symbol-name (car p)))
|
|
|
|
|
":\t"
|
|
|
|
|
"\\["
|
|
|
|
|
(symbol-name sqli-func)
|
|
|
|
|
"]\n"))))
|
|
|
|
|
doc))
|
|
|
|
|
|
2014-01-03 13:37:58 +08:00
|
|
|
|
(defun sql-help ()
|
|
|
|
|
"Show short help for the SQL modes."
|
|
|
|
|
(interactive)
|
|
|
|
|
(describe-function 'sql-help))
|
|
|
|
|
(put 'sql-help 'function-documentation '(sql--make-help-docstring))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2014-01-03 13:37:58 +08:00
|
|
|
|
(defvar sql--help-docstring
|
|
|
|
|
"Show short help for the SQL modes.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
Use an entry function to open an interactive SQL buffer. This buffer is
|
1999-02-13 12:04:00 +00:00
|
|
|
|
usually named `*SQL*'. The name of the major mode is SQLi.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
Use the following commands to start a specific SQL interpreter:
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
\\\\FREE
|
1999-02-06 05:12:54 +00:00
|
|
|
|
|
|
|
|
|
Other non-free SQL implementations are also supported:
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
\\\\NONFREE
|
1999-02-06 05:12:54 +00:00
|
|
|
|
|
|
|
|
|
But we urge you to choose a free implementation instead of these.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
You can also use \\[sql-product-interactive] to invoke the
|
|
|
|
|
interpreter for the current `sql-product'.
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
Once you have the SQLi buffer, you can enter SQL statements in the
|
|
|
|
|
buffer. The output generated is appended to the buffer and a new prompt
|
|
|
|
|
is generated. See the In/Out menu in the SQLi buffer for some functions
|
|
|
|
|
that help you navigate through the buffer, the input history, etc.
|
|
|
|
|
|
|
|
|
|
If you have a really complex SQL statement or if you are writing a
|
|
|
|
|
procedure, you can do this in a separate buffer. Put the new buffer in
|
|
|
|
|
`sql-mode' by calling \\[sql-mode]. The name of this buffer can be
|
|
|
|
|
anything. The name of the major mode is SQL.
|
|
|
|
|
|
|
|
|
|
In this SQL buffer (SQL mode), you can send the region or the entire
|
|
|
|
|
buffer to the interactive SQL buffer (SQLi mode). The results are
|
2014-01-03 13:37:58 +08:00
|
|
|
|
appended to the SQLi buffer without disturbing your SQL buffer.")
|
|
|
|
|
|
|
|
|
|
(defun sql--make-help-docstring ()
|
|
|
|
|
"Return a docstring for `sql-help' listing loaded SQL products."
|
|
|
|
|
(let ((doc sql--help-docstring))
|
|
|
|
|
;; Insert FREE software list
|
Fix regular-expression glitches and typos
Problems reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00085.html
* admin/admin.el (set-version):
* lisp/allout.el (allout-latexify-one-item):
* lisp/arc-mode.el (archive-arc-rename-entry)
(archive-rar-summarize):
* lisp/calc/calc-graph.el (calc-graph-set-styles)
(calc-graph-hide):
* lisp/calc/calc-help.el (calc-describe-key):
* lisp/calc/calc-lang.el (math-compose-tex-func, eqn):
* lisp/calc/calc.el (calcDigit-key):
* lisp/cedet/ede/makefile-edit.el (makefile-macro-file-list):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/comint.el (comint-substitute-in-file-name):
* lisp/dired.el (dired-actual-switches):
* lisp/emacs-lisp/chart.el (chart-rmail-from):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/rx.el (rx-not, rx-atomic-p):
* lisp/emulation/viper-ex.el (viper-get-ex-token)
(viper-get-ex-pat, ex-set-read-variable):
* lisp/epg.el (epg--status-SIG_CREATED):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-user):
(erc-speedbar-expand-channel, erc-speedbar-expand-server)
* lisp/erc/erc.el (erc-is-message-ctcp-and-not-action-p)
(erc-banlist-update):
* lisp/eshell/em-dirs.el (eshell-parse-drive-letter, eshell/pwd):
* lisp/find-dired.el (find-dired):
* lisp/frame.el (frame-set-background-mode):
* lisp/generic-x.el (apache-log-generic-mode):
* lisp/gnus/gnus-art.el (gnus-button-valid-localpart-regexp):
* lisp/gnus/gnus.el (gnus-short-group-name):
* lisp/gnus/message.el (message-mailer-swallows-blank-line):
* lisp/ibuffer.el (ibuffer-fontification-alist):
* lisp/ido.el (ido-set-matches-1):
* lisp/info-xref.el (info-xref-lock-file-p):
* lisp/info.el (Info-dir-remove-duplicates)
(Info-unescape-quotes, Info-split-parameter-string)
(Info-speedbar-expand-node):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/language/ethio-util.el (ethio-fidel-to-tex-buffer):
* lisp/mail/rmail.el (rmail-collect-deleted):
* lisp/mh-e/mh-alias.el (mh-alias-suggest-alias):
* lisp/mh-e/mh-comp.el (mh-forward):
* lisp/mh-e/mh-search.el (mh-index-next-folder)
(mh-index-create-imenu-index):
* lisp/mh-e/mh-xface.el (mh-picon-get-image):
* lisp/minibuffer.el (completion--embedded-envvar-re):
* lisp/net/ange-ftp.el (ange-ftp-ls-parser):
* lisp/net/goto-addr.el (goto-address-mail-regexp)
(goto-address-find-address-at-point):
* lisp/net/pop3.el (pop3-read-response, pop3-user)
(pop3-pass, pop3-apop):
* lisp/net/tramp.el (tramp-ipv6-regexp)
(tramp-replace-environment-variables):
* lisp/nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set):
* lisp/nxml/rng-uri.el (rng-uri-escape-multibyte):
* lisp/nxml/rng-xsd.el (rng-xsd-convert-any-uri):
* lisp/obsolete/pgg.el (pgg-fetch-key):
* lisp/obsolete/vip.el (vip-get-ex-token):
* lisp/org/ob-core.el (org-babel-string-read):
* lisp/org/org-agenda.el:
(org-agenda-add-entry-to-org-agenda-diary-file):
* lisp/org/org-element.el (org-element-keyword-parser):
* lisp/org/org-list.el (org-list-indent-item-generic):
* lisp/org/org-mhe.el (org-mhe-get-message-folder-from-index):
* lisp/org/org-mobile.el (org-mobile-apply):
* lisp/org/org-mouse.el (org-mouse-context-menu):
* lisp/org/org-plot.el (org-plot/gnuplot):
* lisp/org/org-protocol.el (org-protocol-flatten-greedy):
* lisp/org/org-table.el (org-table-copy-down)
(org-table-formula-make-cmp-string)
(org-table-get-stored-formulas, org-table-recalculate)
(org-table-edit-formulas):
* lisp/org/org.el (org-translate-link-from-planner)
(org-fill-line-break-nobreak-p):
* lisp/org/ox-ascii.el (org-ascii-item):
* lisp/org/ox-latex.el (org-latex-clean-invalid-line-breaks):
* lisp/org/ox.el (org-export-expand-include-keyword):
* lisp/progmodes/ada-xref.el (ada-treat-cmd-string):
* lisp/progmodes/cfengine.el (cfengine2-font-lock-keywords):
* lisp/progmodes/cperl-mode.el (cperl-to-comment-or-eol)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-have-help-regexp, cperl-word-at-point-hard)
(cperl-make-regexp-x):
* lisp/progmodes/dcl-mode.el (dcl-option-value-offset):
* lisp/progmodes/etags.el (tag-implicit-name-match-p):
* lisp/progmodes/fortran.el (fortran-fill):
* lisp/progmodes/gdb-mi.el (gdb-speedbar-expand-node)
(gdb-locals-handler-custom):
* lisp/progmodes/grep.el (grep-mode-font-lock-keywords):
* lisp/progmodes/gud.el (gud-jdb-find-source-using-classpath):
* lisp/progmodes/js.el (js--continued-expression-p):
* lisp/progmodes/m4-mode.el (m4-font-lock-keywords):
* lisp/progmodes/meta-mode.el (meta-indent-level-count):
* lisp/progmodes/mixal-mode.el (mixal-font-lock-keywords):
* lisp/progmodes/opascal.el (opascal-find-unit-in-directory):
* lisp/progmodes/pascal.el (pascal-progbeg-re):
* lisp/progmodes/ruby-mode.el (ruby-expression-expansion-re)
(ruby-expr-beg, ruby-parse-partial)
(ruby-toggle-string-quotes, ruby-font-lock-keywords):
* lisp/progmodes/sql.el (sql--make-help-docstring):
* lisp/progmodes/verilog-mode.el (verilog-coverpoint-re)
(verilog-skip-forward-comment-p)
(verilog-read-sub-decls-gate)
(verilog-read-auto-template-middle):
* lisp/progmodes/vhdl-mode.el (vhdl-resolve-env-variable)
(vhdl-speedbar-expand-project, vhdl-speedbar-expand-entity)
(vhdl-speedbar-expand-architecture)
(vhdl-speedbar-expand-config, vhdl-speedbar-expand-package)
(vhdl-speedbar-dired):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/textmodes/dns-mode.el (dns-mode-font-lock-keywords):
* lisp/textmodes/flyspell.el (flyspell-debug-signal-word-checked):
* lisp/textmodes/ispell.el (ispell-process-line):
* lisp/textmodes/reftex-cite.el (reftex-end-of-bib-entry):
* lisp/textmodes/reftex-ref.el (reftex-replace-prefix-escapes):
* lisp/url/url-parse.el (url-generic-parse-url):
* lisp/url/url-util.el (url-truncate-url-for-viewing):
* lisp/vc/diff-mode.el (diff-unified->context):
* lisp/vc/vc-bzr.el (vc-bzr-error-regexp-alist):
* lisp/vc/vc-cvs.el (vc-cvs-parse-status):
* lisp/woman.el (woman0-el, woman-if-ignore)
(woman-change-fonts):
* lisp/xdg.el (xdg--substitute-home-env):
Fix regular-expression infelicities and typos.
Fix regular expression typos
Fix typos reported by Mattias Engdegård in:
that occurred in preloaded modules.
* lisp/frame.el (frame-set-background-mode):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/minibuffer.el (completion--embedded-envvar-re):
2019-03-04 18:00:00 -08:00
|
|
|
|
(when (string-match "^\\(\\s-*\\)[\\][\\]FREE\\s-*$" doc 0)
|
2014-01-03 13:37:58 +08:00
|
|
|
|
(setq doc (replace-match (sql-help-list-products (match-string 1 doc) t)
|
|
|
|
|
t t doc 0)))
|
|
|
|
|
;; Insert non-FREE software list
|
Fix regular-expression glitches and typos
Problems reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00085.html
* admin/admin.el (set-version):
* lisp/allout.el (allout-latexify-one-item):
* lisp/arc-mode.el (archive-arc-rename-entry)
(archive-rar-summarize):
* lisp/calc/calc-graph.el (calc-graph-set-styles)
(calc-graph-hide):
* lisp/calc/calc-help.el (calc-describe-key):
* lisp/calc/calc-lang.el (math-compose-tex-func, eqn):
* lisp/calc/calc.el (calcDigit-key):
* lisp/cedet/ede/makefile-edit.el (makefile-macro-file-list):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/comint.el (comint-substitute-in-file-name):
* lisp/dired.el (dired-actual-switches):
* lisp/emacs-lisp/chart.el (chart-rmail-from):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/rx.el (rx-not, rx-atomic-p):
* lisp/emulation/viper-ex.el (viper-get-ex-token)
(viper-get-ex-pat, ex-set-read-variable):
* lisp/epg.el (epg--status-SIG_CREATED):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-user):
(erc-speedbar-expand-channel, erc-speedbar-expand-server)
* lisp/erc/erc.el (erc-is-message-ctcp-and-not-action-p)
(erc-banlist-update):
* lisp/eshell/em-dirs.el (eshell-parse-drive-letter, eshell/pwd):
* lisp/find-dired.el (find-dired):
* lisp/frame.el (frame-set-background-mode):
* lisp/generic-x.el (apache-log-generic-mode):
* lisp/gnus/gnus-art.el (gnus-button-valid-localpart-regexp):
* lisp/gnus/gnus.el (gnus-short-group-name):
* lisp/gnus/message.el (message-mailer-swallows-blank-line):
* lisp/ibuffer.el (ibuffer-fontification-alist):
* lisp/ido.el (ido-set-matches-1):
* lisp/info-xref.el (info-xref-lock-file-p):
* lisp/info.el (Info-dir-remove-duplicates)
(Info-unescape-quotes, Info-split-parameter-string)
(Info-speedbar-expand-node):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/language/ethio-util.el (ethio-fidel-to-tex-buffer):
* lisp/mail/rmail.el (rmail-collect-deleted):
* lisp/mh-e/mh-alias.el (mh-alias-suggest-alias):
* lisp/mh-e/mh-comp.el (mh-forward):
* lisp/mh-e/mh-search.el (mh-index-next-folder)
(mh-index-create-imenu-index):
* lisp/mh-e/mh-xface.el (mh-picon-get-image):
* lisp/minibuffer.el (completion--embedded-envvar-re):
* lisp/net/ange-ftp.el (ange-ftp-ls-parser):
* lisp/net/goto-addr.el (goto-address-mail-regexp)
(goto-address-find-address-at-point):
* lisp/net/pop3.el (pop3-read-response, pop3-user)
(pop3-pass, pop3-apop):
* lisp/net/tramp.el (tramp-ipv6-regexp)
(tramp-replace-environment-variables):
* lisp/nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set):
* lisp/nxml/rng-uri.el (rng-uri-escape-multibyte):
* lisp/nxml/rng-xsd.el (rng-xsd-convert-any-uri):
* lisp/obsolete/pgg.el (pgg-fetch-key):
* lisp/obsolete/vip.el (vip-get-ex-token):
* lisp/org/ob-core.el (org-babel-string-read):
* lisp/org/org-agenda.el:
(org-agenda-add-entry-to-org-agenda-diary-file):
* lisp/org/org-element.el (org-element-keyword-parser):
* lisp/org/org-list.el (org-list-indent-item-generic):
* lisp/org/org-mhe.el (org-mhe-get-message-folder-from-index):
* lisp/org/org-mobile.el (org-mobile-apply):
* lisp/org/org-mouse.el (org-mouse-context-menu):
* lisp/org/org-plot.el (org-plot/gnuplot):
* lisp/org/org-protocol.el (org-protocol-flatten-greedy):
* lisp/org/org-table.el (org-table-copy-down)
(org-table-formula-make-cmp-string)
(org-table-get-stored-formulas, org-table-recalculate)
(org-table-edit-formulas):
* lisp/org/org.el (org-translate-link-from-planner)
(org-fill-line-break-nobreak-p):
* lisp/org/ox-ascii.el (org-ascii-item):
* lisp/org/ox-latex.el (org-latex-clean-invalid-line-breaks):
* lisp/org/ox.el (org-export-expand-include-keyword):
* lisp/progmodes/ada-xref.el (ada-treat-cmd-string):
* lisp/progmodes/cfengine.el (cfengine2-font-lock-keywords):
* lisp/progmodes/cperl-mode.el (cperl-to-comment-or-eol)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-have-help-regexp, cperl-word-at-point-hard)
(cperl-make-regexp-x):
* lisp/progmodes/dcl-mode.el (dcl-option-value-offset):
* lisp/progmodes/etags.el (tag-implicit-name-match-p):
* lisp/progmodes/fortran.el (fortran-fill):
* lisp/progmodes/gdb-mi.el (gdb-speedbar-expand-node)
(gdb-locals-handler-custom):
* lisp/progmodes/grep.el (grep-mode-font-lock-keywords):
* lisp/progmodes/gud.el (gud-jdb-find-source-using-classpath):
* lisp/progmodes/js.el (js--continued-expression-p):
* lisp/progmodes/m4-mode.el (m4-font-lock-keywords):
* lisp/progmodes/meta-mode.el (meta-indent-level-count):
* lisp/progmodes/mixal-mode.el (mixal-font-lock-keywords):
* lisp/progmodes/opascal.el (opascal-find-unit-in-directory):
* lisp/progmodes/pascal.el (pascal-progbeg-re):
* lisp/progmodes/ruby-mode.el (ruby-expression-expansion-re)
(ruby-expr-beg, ruby-parse-partial)
(ruby-toggle-string-quotes, ruby-font-lock-keywords):
* lisp/progmodes/sql.el (sql--make-help-docstring):
* lisp/progmodes/verilog-mode.el (verilog-coverpoint-re)
(verilog-skip-forward-comment-p)
(verilog-read-sub-decls-gate)
(verilog-read-auto-template-middle):
* lisp/progmodes/vhdl-mode.el (vhdl-resolve-env-variable)
(vhdl-speedbar-expand-project, vhdl-speedbar-expand-entity)
(vhdl-speedbar-expand-architecture)
(vhdl-speedbar-expand-config, vhdl-speedbar-expand-package)
(vhdl-speedbar-dired):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/textmodes/dns-mode.el (dns-mode-font-lock-keywords):
* lisp/textmodes/flyspell.el (flyspell-debug-signal-word-checked):
* lisp/textmodes/ispell.el (ispell-process-line):
* lisp/textmodes/reftex-cite.el (reftex-end-of-bib-entry):
* lisp/textmodes/reftex-ref.el (reftex-replace-prefix-escapes):
* lisp/url/url-parse.el (url-generic-parse-url):
* lisp/url/url-util.el (url-truncate-url-for-viewing):
* lisp/vc/diff-mode.el (diff-unified->context):
* lisp/vc/vc-bzr.el (vc-bzr-error-regexp-alist):
* lisp/vc/vc-cvs.el (vc-cvs-parse-status):
* lisp/woman.el (woman0-el, woman-if-ignore)
(woman-change-fonts):
* lisp/xdg.el (xdg--substitute-home-env):
Fix regular-expression infelicities and typos.
Fix regular expression typos
Fix typos reported by Mattias Engdegård in:
that occurred in preloaded modules.
* lisp/frame.el (frame-set-background-mode):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/minibuffer.el (completion--embedded-envvar-re):
2019-03-04 18:00:00 -08:00
|
|
|
|
(when (string-match "^\\(\\s-*\\)[\\][\\]NONFREE\\s-*$" doc 0)
|
2014-01-03 13:37:58 +08:00
|
|
|
|
(setq doc (replace-match (sql-help-list-products (match-string 1 doc) nil)
|
|
|
|
|
t t doc 0)))
|
|
|
|
|
doc))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(defun sql-default-value (var)
|
|
|
|
|
"Fetch the value of a variable.
|
|
|
|
|
|
|
|
|
|
If the current buffer is in `sql-interactive-mode', then fetch
|
|
|
|
|
the global value, otherwise use the buffer local value."
|
|
|
|
|
(if (derived-mode-p 'sql-interactive-mode)
|
|
|
|
|
(default-value var)
|
|
|
|
|
(buffer-local-value var (current-buffer))))
|
|
|
|
|
|
2012-03-01 00:01:22 -05:00
|
|
|
|
(defun sql-get-login-ext (symbol prompt history-var plist)
|
2010-07-22 20:59:43 -04:00
|
|
|
|
"Prompt user with extended login parameters.
|
|
|
|
|
|
2012-07-13 16:58:12 +02:00
|
|
|
|
The global value of SYMBOL is the last value and the global value
|
2012-03-01 00:01:22 -05:00
|
|
|
|
of the SYMBOL is set based on the user's input.
|
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
If PLIST is nil, then the user is simply prompted for a string
|
2010-07-22 20:59:43 -04:00
|
|
|
|
value.
|
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
The property `:default' specifies the default value. If the
|
|
|
|
|
`:number' property is non-nil then ask for a number.
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
The `:file' property prompts for a file name that must match the
|
|
|
|
|
regexp pattern specified in its value.
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
The `:completion' property prompts for a string specified by its
|
|
|
|
|
value. (The property value is used as the PREDICATE argument to
|
2018-06-02 19:21:31 -04:00
|
|
|
|
`completing-read'.)
|
|
|
|
|
|
|
|
|
|
For both `:file' and `:completion', there can also be a
|
|
|
|
|
`:must-match' property that controls REQUIRE-MATCH parameter to
|
|
|
|
|
`completing-read'."
|
|
|
|
|
|
2012-07-13 16:58:12 +02:00
|
|
|
|
(set-default
|
2012-03-01 00:01:22 -05:00
|
|
|
|
symbol
|
|
|
|
|
(let* ((default (plist-get plist :default))
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(last-value (sql-default-value symbol))
|
2021-10-05 03:34:08 +02:00
|
|
|
|
(prompt-def (format-prompt prompt default))
|
2012-03-01 00:01:22 -05:00
|
|
|
|
(use-dialog-box nil))
|
|
|
|
|
(cond
|
|
|
|
|
((plist-member plist :file)
|
2017-02-05 19:46:24 +01:00
|
|
|
|
(let ((file-name
|
|
|
|
|
(read-file-name prompt
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(file-name-directory last-value)
|
|
|
|
|
default
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(if (plist-member plist :must-match)
|
|
|
|
|
(plist-get plist :must-match)
|
|
|
|
|
t)
|
2017-02-05 19:46:24 +01:00
|
|
|
|
(file-name-nondirectory last-value)
|
|
|
|
|
(when (plist-get plist :file)
|
|
|
|
|
`(lambda (f)
|
|
|
|
|
(if (not (file-regular-p f))
|
|
|
|
|
t
|
|
|
|
|
(string-match
|
|
|
|
|
(concat "\\<" ,(plist-get plist :file) "\\>")
|
|
|
|
|
(file-name-nondirectory f))))))))
|
|
|
|
|
(if (string= file-name "")
|
|
|
|
|
""
|
|
|
|
|
(expand-file-name file-name))))
|
2012-03-01 00:01:22 -05:00
|
|
|
|
|
|
|
|
|
((plist-member plist :completion)
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(completing-read prompt-def
|
|
|
|
|
(plist-get plist :completion)
|
|
|
|
|
nil
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(if (plist-member plist :must-match)
|
|
|
|
|
(plist-get plist :must-match)
|
|
|
|
|
t)
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
last-value
|
|
|
|
|
history-var
|
|
|
|
|
default))
|
2012-03-01 00:01:22 -05:00
|
|
|
|
|
|
|
|
|
((plist-get plist :number)
|
|
|
|
|
(read-number prompt (or default last-value 0)))
|
|
|
|
|
|
|
|
|
|
(t
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(read-string prompt-def last-value history-var default))))))
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(defun sql-get-login (&rest what)
|
|
|
|
|
"Get username, password and database from the user.
|
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
The variables `sql-user', `sql-password', `sql-server', and
|
2001-03-06 12:26:35 +00:00
|
|
|
|
`sql-database' can be customized. They are used as the default values.
|
1999-02-13 12:04:00 +00:00
|
|
|
|
Usernames, servers and databases are stored in `sql-user-history',
|
|
|
|
|
`sql-server-history' and `database-history'. Passwords are not stored
|
|
|
|
|
in a history.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
Parameter WHAT is a list of tokens passed as arguments in the
|
|
|
|
|
function call. The function asks for the username if WHAT
|
|
|
|
|
contains the symbol `user', for the password if it contains the
|
|
|
|
|
symbol `password', for the server if it contains the symbol
|
|
|
|
|
`server', and for the database if it contains the symbol
|
|
|
|
|
`database'. The members of WHAT are processed in the order in
|
|
|
|
|
which they are provided.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2019-02-18 23:15:54 -05:00
|
|
|
|
If the `sql-password-wallet' is non-nil and WHAT contains the
|
|
|
|
|
`password' token, then the `password' token will be pushed to the
|
|
|
|
|
end to be sure that all of the values can be fed to the wallet.
|
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
Each token may also be a list with the token in the car and a
|
|
|
|
|
plist of options as the cdr. The following properties are
|
|
|
|
|
supported:
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
:file <filename-regexp>
|
|
|
|
|
:completion <list-of-strings-or-function>
|
|
|
|
|
:default <default-value>
|
|
|
|
|
:number t
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
In order to ask the user for username, password and database, call the
|
2015-11-17 15:28:50 -08:00
|
|
|
|
function like this: (sql-get-login \\='user \\='password \\='database)."
|
2019-02-18 23:15:54 -05:00
|
|
|
|
|
|
|
|
|
;; Push the password to the end if we have a wallet
|
|
|
|
|
(when (and sql-password-wallet
|
|
|
|
|
(fboundp sql-password-search-wallet-function)
|
|
|
|
|
(member 'password what))
|
|
|
|
|
(setq what (append (cl-delete 'password what)
|
|
|
|
|
'(password))))
|
|
|
|
|
|
|
|
|
|
;; Prompt for each parameter
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(dolist (w what)
|
|
|
|
|
(let ((plist (cdr-safe w)))
|
|
|
|
|
(pcase (or (car-safe w) w)
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('user
|
2021-10-05 03:34:08 +02:00
|
|
|
|
(sql-get-login-ext 'sql-user "User" 'sql-user-history plist))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('password
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(setq-default sql-password
|
2019-02-18 23:15:54 -05:00
|
|
|
|
(if (and sql-password-wallet
|
|
|
|
|
(fboundp sql-password-search-wallet-function))
|
|
|
|
|
(let ((password (funcall sql-password-search-wallet-function
|
|
|
|
|
sql-password-wallet
|
|
|
|
|
sql-product
|
|
|
|
|
sql-user
|
|
|
|
|
sql-server
|
|
|
|
|
sql-database
|
|
|
|
|
sql-port)))
|
|
|
|
|
(if password
|
|
|
|
|
password
|
|
|
|
|
(read-passwd "Password: " nil (sql-default-value 'sql-password))))
|
|
|
|
|
(read-passwd "Password: " nil (sql-default-value 'sql-password)))))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('server
|
2021-10-05 03:34:08 +02:00
|
|
|
|
(sql-get-login-ext 'sql-server "Server" 'sql-server-history plist))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('database
|
2021-10-05 03:34:08 +02:00
|
|
|
|
(sql-get-login-ext 'sql-database "Database"
|
2012-12-06 12:29:30 -05:00
|
|
|
|
'sql-database-history plist))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('port
|
2021-10-05 03:34:08 +02:00
|
|
|
|
(sql-get-login-ext 'sql-port "Port"
|
2012-12-06 12:29:30 -05:00
|
|
|
|
nil (append '(:number t) plist)))))))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(defun sql-find-sqli-buffer (&optional product connection)
|
2012-12-06 12:29:30 -05:00
|
|
|
|
"Return the name of the current default SQLi buffer or nil.
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
In order to qualify, the SQLi buffer must be alive, be in
|
|
|
|
|
`sql-interactive-mode' and have a process."
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(let ((buf sql-buffer)
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(prod (or product sql-product)))
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(or
|
|
|
|
|
;; Current sql-buffer, if there is one.
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(and (sql-buffer-live-p buf prod connection)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
buf)
|
|
|
|
|
;; Global sql-buffer
|
|
|
|
|
(and (setq buf (default-value 'sql-buffer))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-buffer-live-p buf prod connection)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
buf)
|
|
|
|
|
;; Look thru each buffer
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(car (apply #'append
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(mapcar (lambda (b)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(and (sql-buffer-live-p b prod connection)
|
|
|
|
|
(list (buffer-name b))))
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(buffer-list)))))))
|
1999-11-24 14:59:03 +00:00
|
|
|
|
|
|
|
|
|
(defun sql-set-sqli-buffer-generally ()
|
2002-11-21 08:32:06 +00:00
|
|
|
|
"Set SQLi buffer for all SQL buffers that have none.
|
1999-11-24 14:59:03 +00:00
|
|
|
|
This function checks all SQL buffers for their SQLi buffer. If their
|
|
|
|
|
SQLi buffer is nonexistent or has no process, it is set to the current
|
|
|
|
|
default SQLi buffer. The current default SQLi buffer is determined
|
|
|
|
|
using `sql-find-sqli-buffer'. If `sql-buffer' is set,
|
|
|
|
|
`sql-set-sqli-hook' is run."
|
|
|
|
|
(interactive)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(let ((buflist (buffer-list))
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(default-buffer (sql-find-sqli-buffer)))
|
|
|
|
|
(setq-default sql-buffer default-buffer)
|
1999-11-24 14:59:03 +00:00
|
|
|
|
(while (not (null buflist))
|
|
|
|
|
(let ((candidate (car buflist)))
|
|
|
|
|
(set-buffer candidate)
|
2009-08-16 15:48:15 +00:00
|
|
|
|
(if (and (derived-mode-p 'sql-mode)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(not (sql-buffer-live-p sql-buffer)))
|
1999-11-24 14:59:03 +00:00
|
|
|
|
(progn
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(setq sql-buffer default-buffer)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(when default-buffer
|
|
|
|
|
(run-hooks 'sql-set-sqli-hook)))))
|
1999-11-24 14:59:03 +00:00
|
|
|
|
(setq buflist (cdr buflist))))))
|
|
|
|
|
|
1999-02-19 04:24:12 +00:00
|
|
|
|
(defun sql-set-sqli-buffer ()
|
|
|
|
|
"Set the SQLi buffer SQL strings are sent to.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-02-19 04:24:12 +00:00
|
|
|
|
Call this function in a SQL buffer in order to set the SQLi buffer SQL
|
|
|
|
|
strings are sent to. Calling this function sets `sql-buffer' and runs
|
|
|
|
|
`sql-set-sqli-hook'.
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
1999-02-19 04:24:12 +00:00
|
|
|
|
If you call it from a SQL buffer, this sets the local copy of
|
1999-09-29 09:51:59 +00:00
|
|
|
|
`sql-buffer'.
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
1999-02-19 04:24:12 +00:00
|
|
|
|
If you call it from anywhere else, it sets the global copy of
|
1999-02-13 12:04:00 +00:00
|
|
|
|
`sql-buffer'."
|
|
|
|
|
(interactive)
|
1999-11-24 14:59:03 +00:00
|
|
|
|
(let ((default-buffer (sql-find-sqli-buffer)))
|
|
|
|
|
(if (null default-buffer)
|
2014-09-08 09:57:19 -04:00
|
|
|
|
(sql-product-interactive)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(let ((new-buffer (read-buffer "New SQLi buffer: " default-buffer t)))
|
|
|
|
|
(if (null (sql-buffer-live-p new-buffer))
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "Buffer %s is not a working SQLi buffer" new-buffer)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(when new-buffer
|
|
|
|
|
(setq sql-buffer new-buffer)
|
|
|
|
|
(run-hooks 'sql-set-sqli-hook)))))))
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
|
|
|
|
(defun sql-show-sqli-buffer ()
|
2014-09-08 08:31:54 -04:00
|
|
|
|
"Display the current SQLi buffer.
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
2014-09-08 08:31:54 -04:00
|
|
|
|
This is the buffer SQL strings are sent to.
|
|
|
|
|
It is stored in the variable `sql-buffer'.
|
|
|
|
|
I
|
|
|
|
|
See also `sql-help' on how to create such a buffer."
|
1999-02-13 12:04:00 +00:00
|
|
|
|
(interactive)
|
2014-09-08 09:57:19 -04:00
|
|
|
|
(unless (and sql-buffer (buffer-live-p (get-buffer sql-buffer))
|
|
|
|
|
(get-buffer-process sql-buffer))
|
2014-09-08 08:31:54 -04:00
|
|
|
|
(sql-set-sqli-buffer))
|
|
|
|
|
(display-buffer sql-buffer))
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(defun sql-make-alternate-buffer-name (&optional product)
|
2010-05-14 15:31:36 +02:00
|
|
|
|
"Return a string that can be used to rename a SQLi buffer.
|
1999-02-19 04:24:12 +00:00
|
|
|
|
This is used to set `sql-alternate-buffer-name' within
|
2010-07-18 14:44:32 -04:00
|
|
|
|
`sql-interactive-mode'.
|
|
|
|
|
|
|
|
|
|
If the session was started with `sql-connect' then the alternate
|
|
|
|
|
name would be the name of the connection.
|
|
|
|
|
|
|
|
|
|
Otherwise, it uses the parameters identified by the :sqlilogin
|
|
|
|
|
parameter.
|
|
|
|
|
|
|
|
|
|
If all else fails, the alternate name would be the user and
|
|
|
|
|
server/database name."
|
|
|
|
|
|
2010-07-20 21:56:55 -04:00
|
|
|
|
(let ((name ""))
|
|
|
|
|
|
2010-07-22 20:59:43 -04:00
|
|
|
|
;; Build a name using the :sqli-login setting
|
|
|
|
|
(setq name
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(apply #'concat
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(cdr
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(apply #'append nil
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(sql-for-each-login
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(sql-get-product-feature (or product sql-product) :sqli-login)
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(lambda (token plist)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(pcase token
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('user
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(unless (string= "" sql-user)
|
|
|
|
|
(list "/" sql-user)))
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('port
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(unless (or (not (numberp sql-port))
|
|
|
|
|
(= 0 sql-port))
|
|
|
|
|
(list ":" (number-to-string sql-port))))
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('server
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(unless (string= "" sql-server)
|
|
|
|
|
(list "."
|
|
|
|
|
(if (plist-member plist :file)
|
|
|
|
|
(file-name-nondirectory sql-server)
|
|
|
|
|
sql-server))))
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('database
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(unless (string= "" sql-database)
|
|
|
|
|
(list "@"
|
|
|
|
|
(if (plist-member plist :file)
|
|
|
|
|
(file-name-nondirectory sql-database)
|
|
|
|
|
sql-database))))
|
|
|
|
|
|
|
|
|
|
;; (`password nil)
|
|
|
|
|
(_ nil))))))))
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
|
|
|
|
;; If there's a connection, use it and the name thus far
|
2010-07-20 21:56:55 -04:00
|
|
|
|
(if sql-connection
|
|
|
|
|
(format "<%s>%s" sql-connection (or name ""))
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
|
|
|
|
;; If there is no name, try to create something meaningful
|
|
|
|
|
(if (string= "" (or name ""))
|
|
|
|
|
(concat
|
|
|
|
|
(if (string= "" sql-user)
|
|
|
|
|
(if (string= "" (user-login-name))
|
|
|
|
|
()
|
|
|
|
|
(concat (user-login-name) "/"))
|
|
|
|
|
(concat sql-user "/"))
|
|
|
|
|
(if (string= "" sql-database)
|
|
|
|
|
(if (string= "" sql-server)
|
|
|
|
|
(system-name)
|
|
|
|
|
sql-server)
|
|
|
|
|
sql-database))
|
|
|
|
|
|
2010-08-10 19:04:32 -04:00
|
|
|
|
;; Use the name we've got
|
|
|
|
|
name))))
|
1999-02-19 04:24:12 +00:00
|
|
|
|
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(defun sql-generate-unique-sqli-buffer-name (product base)
|
|
|
|
|
"Generate a new, unique buffer name for a SQLi buffer.
|
|
|
|
|
|
|
|
|
|
Append a sequence number until a unique name is found."
|
2019-04-24 20:59:25 -04:00
|
|
|
|
(let ((base-name (substring-no-properties
|
|
|
|
|
(if base
|
|
|
|
|
(if (stringp base)
|
|
|
|
|
base
|
|
|
|
|
(format "%S" base))
|
|
|
|
|
(or (sql-get-product-feature product :name)
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(symbol-name product)))))
|
2019-04-24 20:59:25 -04:00
|
|
|
|
buf-fmt-1st
|
|
|
|
|
buf-fmt-rest)
|
2018-06-02 19:21:31 -04:00
|
|
|
|
|
|
|
|
|
;; Calculate buffer format
|
2019-04-24 20:59:25 -04:00
|
|
|
|
(if (string-blank-p base-name)
|
|
|
|
|
(setq buf-fmt-1st "*SQL*"
|
|
|
|
|
buf-fmt-rest "*SQL-%d*")
|
|
|
|
|
(setq buf-fmt-1st (format "*SQL: %s*" base-name)
|
|
|
|
|
buf-fmt-rest (format "*SQL: %s-%%d*" base-name)))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
|
|
|
|
|
;; See if we can find an unused buffer
|
|
|
|
|
(let ((buf-name buf-fmt-1st)
|
|
|
|
|
(i 1))
|
2019-04-24 20:59:25 -04:00
|
|
|
|
(while (if (sql-is-sqli-buffer-p buf-name)
|
|
|
|
|
(comint-check-proc buf-name)
|
|
|
|
|
(buffer-live-p (get-buffer buf-name)))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
;; Check a sequence number on the BASE
|
|
|
|
|
(setq buf-name (format buf-fmt-rest i)
|
|
|
|
|
i (1+ i)))
|
|
|
|
|
|
|
|
|
|
buf-name)))
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-rename-buffer (&optional new-name)
|
|
|
|
|
"Rename a SQL interactive buffer.
|
|
|
|
|
|
2011-02-22 23:27:09 -08:00
|
|
|
|
Prompts for the new name if command is preceded by
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
\\[universal-argument]. If no buffer name is provided, then the
|
|
|
|
|
`sql-alternate-buffer-name' is used.
|
|
|
|
|
|
|
|
|
|
The actual buffer name set will be \"*SQL: NEW-NAME*\". If
|
|
|
|
|
NEW-NAME is empty, then the buffer name will be \"*SQL*\"."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
|
|
|
|
|
(if (not (derived-mode-p 'sql-interactive-mode))
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "Current buffer is not a SQL interactive buffer")
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(setq sql-alternate-buffer-name
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(substring-no-properties
|
|
|
|
|
(cond
|
|
|
|
|
((stringp new-name)
|
|
|
|
|
new-name)
|
|
|
|
|
((consp new-name)
|
|
|
|
|
(read-string "Buffer name (\"*SQL: XXX*\"; enter `XXX'): "
|
|
|
|
|
sql-alternate-buffer-name))
|
|
|
|
|
(t
|
|
|
|
|
sql-alternate-buffer-name))))
|
|
|
|
|
|
|
|
|
|
(rename-buffer
|
|
|
|
|
(sql-generate-unique-sqli-buffer-name sql-product
|
|
|
|
|
sql-alternate-buffer-name)
|
|
|
|
|
t)))
|
1999-02-19 04:24:12 +00:00
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(defun sql-copy-column ()
|
|
|
|
|
"Copy current column to the end of buffer.
|
|
|
|
|
Inserts SELECT or commas if appropriate."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((column))
|
|
|
|
|
(save-excursion
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(setq column (buffer-substring-no-properties
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(progn (forward-char 1) (backward-sexp 1) (point))
|
|
|
|
|
(progn (forward-sexp 1) (point))))
|
|
|
|
|
(goto-char (point-max))
|
2000-08-07 14:52:52 +00:00
|
|
|
|
(let ((bol (comint-line-beginning-position)))
|
|
|
|
|
(cond
|
|
|
|
|
;; if empty command line, insert SELECT
|
|
|
|
|
((= bol (point))
|
|
|
|
|
(insert "SELECT "))
|
|
|
|
|
;; else if appending to INTO .* (, SELECT or ORDER BY, insert a comma
|
|
|
|
|
((save-excursion
|
|
|
|
|
(re-search-backward "\\b\\(\\(into\\s-+\\S-+\\s-+(\\)\\|select\\|order by\\) .+"
|
|
|
|
|
bol t))
|
|
|
|
|
(insert ", "))
|
|
|
|
|
;; else insert a space
|
|
|
|
|
(t
|
2005-07-04 03:25:26 +00:00
|
|
|
|
(if (eq (preceding-char) ?\s)
|
2000-08-07 14:52:52 +00:00
|
|
|
|
nil
|
|
|
|
|
(insert " ")))))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
;; in any case, insert the column
|
|
|
|
|
(insert column)
|
|
|
|
|
(message "%s" column))))
|
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
;; On Windows, SQL*Plus for Oracle turns on full buffering for stdout
|
|
|
|
|
;; if it is not attached to a character device; therefore placeholder
|
2000-07-27 20:06:37 +00:00
|
|
|
|
;; replacement by SQL*Plus is fully buffered. The workaround lets
|
|
|
|
|
;; Emacs query for the placeholders.
|
|
|
|
|
|
|
|
|
|
(defvar sql-placeholder-history nil
|
|
|
|
|
"History of placeholder values used.")
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defun sql-placeholders-filter (string)
|
|
|
|
|
"Replace placeholders in STRING.
|
2010-05-14 15:31:36 +02:00
|
|
|
|
Placeholders are words starting with an ampersand like &this."
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
(when sql-oracle-scan-on
|
2019-04-20 20:13:56 -04:00
|
|
|
|
(let ((start 0)
|
|
|
|
|
(replacement ""))
|
|
|
|
|
(while (string-match "&?&\\(\\(?:\\sw\\|\\s_\\)+\\)[.]?" string start)
|
|
|
|
|
(setq replacement (read-from-minibuffer
|
|
|
|
|
(format "Enter value for %s: "
|
|
|
|
|
(propertize (match-string 1 string)
|
|
|
|
|
'face 'font-lock-variable-name-face))
|
|
|
|
|
nil nil nil 'sql-placeholder-history)
|
|
|
|
|
string (replace-match replacement t t string)
|
|
|
|
|
start (+ (match-beginning 1) (length replacement))))))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
string)
|
2000-07-27 20:06:37 +00:00
|
|
|
|
|
2001-04-20 10:03:48 +00:00
|
|
|
|
;; Using DB2 interactively, newlines must be escaped with " \".
|
|
|
|
|
;; The space before the backslash is relevant.
|
2012-09-10 15:22:53 -04:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defun sql-escape-newlines-filter (string)
|
2010-05-14 15:31:36 +02:00
|
|
|
|
"Escape newlines in STRING.
|
2001-04-20 10:03:48 +00:00
|
|
|
|
Every newline in STRING will be preceded with a space and a backslash."
|
2012-09-10 15:22:53 -04:00
|
|
|
|
(if (not sql-db2-escape-newlines)
|
|
|
|
|
string
|
|
|
|
|
(let ((result "") (start 0) mb me)
|
|
|
|
|
(while (string-match "\n" string start)
|
|
|
|
|
(setq mb (match-beginning 0)
|
|
|
|
|
me (match-end 0)
|
|
|
|
|
result (concat result
|
|
|
|
|
(substring string start mb)
|
|
|
|
|
(if (and (> mb 1)
|
|
|
|
|
(string-equal " \\" (substring string (- mb 2) mb)))
|
|
|
|
|
"" " \\\n"))
|
|
|
|
|
start me))
|
|
|
|
|
(concat result (substring string start)))))
|
2001-04-20 10:03:48 +00:00
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;;; Input sender for SQLi buffers
|
|
|
|
|
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(defvar sql-output-newline-count 0
|
|
|
|
|
"Number of newlines in the input string.
|
|
|
|
|
|
|
|
|
|
Allows the suppression of continuation prompts.")
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defun sql-input-sender (proc string)
|
2010-05-14 15:31:36 +02:00
|
|
|
|
"Send STRING to PROC after applying filters."
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(let* ((product (buffer-local-value 'sql-product (process-buffer proc)))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(filter (sql-get-product-feature product :input-filter)))
|
|
|
|
|
|
2010-08-10 19:04:32 -04:00
|
|
|
|
;; Apply filter(s)
|
|
|
|
|
(cond
|
|
|
|
|
((not filter)
|
|
|
|
|
nil)
|
|
|
|
|
((functionp filter)
|
|
|
|
|
(setq string (funcall filter string)))
|
|
|
|
|
((listp filter)
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(mapc (lambda (f) (setq string (funcall f string))) filter))
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(t nil))
|
|
|
|
|
|
|
|
|
|
;; Count how many newlines in the string
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(setq sql-output-newline-count
|
2019-02-20 09:25:54 -05:00
|
|
|
|
(apply #'+ (mapcar (lambda (ch) (if (eq ch ?\n) 1 0))
|
|
|
|
|
string)))
|
2010-08-10 19:04:32 -04:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Send the string
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(comint-simple-send proc string)))
|
|
|
|
|
|
|
|
|
|
;;; Strip out continuation prompts
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(defvar sql-preoutput-hold nil)
|
|
|
|
|
|
2013-07-23 20:25:53 -04:00
|
|
|
|
(defun sql-starts-with-prompt-re ()
|
|
|
|
|
"Anchor the prompt expression at the beginning of the output line.
|
|
|
|
|
Remove the start of line regexp."
|
2015-03-14 23:05:28 -04:00
|
|
|
|
(concat "\\`" comint-prompt-regexp))
|
2013-07-23 20:25:53 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-ends-with-prompt-re ()
|
|
|
|
|
"Anchor the prompt expression at the end of the output line.
|
2015-03-14 23:05:28 -04:00
|
|
|
|
Match a SQL prompt or a password prompt."
|
|
|
|
|
(concat "\\(?:\\(?:" sql-prompt-regexp "\\)\\|"
|
|
|
|
|
"\\(?:" comint-password-prompt-regexp "\\)\\)\\'"))
|
2013-07-23 20:25:53 -04:00
|
|
|
|
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(defun sql-interactive-remove-continuation-prompt (oline)
|
|
|
|
|
"Strip out continuation prompts out of the OLINE.
|
|
|
|
|
|
|
|
|
|
Added to the `comint-preoutput-filter-functions' hook in a SQL
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
interactive buffer. If `sql-output-newline-count' is greater than
|
2010-08-10 19:04:32 -04:00
|
|
|
|
zero, then an output line matching the continuation prompt is filtered
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
out. If the count is zero, then a newline is inserted into the output
|
|
|
|
|
to force the output from the query to appear on a new line.
|
|
|
|
|
|
|
|
|
|
The complication to this filter is that the continuation prompts
|
|
|
|
|
may arrive in multiple chunks. If they do, then the function
|
|
|
|
|
saves any unfiltered output in a buffer and prepends that buffer
|
|
|
|
|
to the next chunk to properly match the broken-up prompt.
|
|
|
|
|
|
|
|
|
|
If the filter gets confused, it should reset and stop filtering
|
|
|
|
|
to avoid deleting non-prompt output."
|
|
|
|
|
|
2015-03-14 23:05:28 -04:00
|
|
|
|
;; continue gathering lines of text iff
|
|
|
|
|
;; + we know what a prompt looks like, and
|
|
|
|
|
;; + there is held text, or
|
|
|
|
|
;; + there are continuation prompt yet to come, or
|
|
|
|
|
;; + not just a prompt string
|
|
|
|
|
(when (and comint-prompt-regexp
|
|
|
|
|
(or (> (length (or sql-preoutput-hold "")) 0)
|
|
|
|
|
(> (or sql-output-newline-count 0) 0)
|
|
|
|
|
(not (or (string-match sql-prompt-regexp oline)
|
2019-04-21 00:19:56 -04:00
|
|
|
|
(and sql-prompt-cont-regexp
|
|
|
|
|
(string-match sql-prompt-cont-regexp oline))))))
|
2015-03-14 23:05:28 -04:00
|
|
|
|
|
2013-07-23 20:25:53 -04:00
|
|
|
|
(save-match-data
|
|
|
|
|
(let (prompt-found last-nl)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
2013-07-23 20:25:53 -04:00
|
|
|
|
;; Add this text to what's left from the last pass
|
|
|
|
|
(setq oline (concat sql-preoutput-hold oline)
|
|
|
|
|
sql-preoutput-hold "")
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
2013-07-23 20:25:53 -04:00
|
|
|
|
;; If we are looking for multiple prompts
|
|
|
|
|
(when (and (integerp sql-output-newline-count)
|
|
|
|
|
(>= sql-output-newline-count 1))
|
|
|
|
|
;; Loop thru each starting prompt and remove it
|
|
|
|
|
(let ((start-re (sql-starts-with-prompt-re)))
|
|
|
|
|
(while (and (not (string= oline ""))
|
|
|
|
|
(> sql-output-newline-count 0)
|
|
|
|
|
(string-match start-re oline))
|
|
|
|
|
(setq oline (replace-match "" nil nil oline)
|
|
|
|
|
sql-output-newline-count (1- sql-output-newline-count)
|
|
|
|
|
prompt-found t)))
|
2014-09-08 08:27:19 -04:00
|
|
|
|
|
2013-07-23 20:25:53 -04:00
|
|
|
|
;; If we've found all the expected prompts, stop looking
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(if (= sql-output-newline-count 0)
|
2021-05-16 16:32:10 +02:00
|
|
|
|
(setq sql-output-newline-count nil)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
2013-07-23 20:25:53 -04:00
|
|
|
|
;; Still more possible prompts, leave them for the next pass
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(setq sql-preoutput-hold oline
|
2013-07-23 20:25:53 -04:00
|
|
|
|
oline "")))
|
|
|
|
|
|
|
|
|
|
;; If no prompts were found, stop looking
|
|
|
|
|
(unless prompt-found
|
|
|
|
|
(setq sql-output-newline-count nil
|
|
|
|
|
oline (concat oline sql-preoutput-hold)
|
|
|
|
|
sql-preoutput-hold ""))
|
|
|
|
|
|
|
|
|
|
;; Break up output by physical lines if we haven't hit the final prompt
|
2015-03-14 23:05:28 -04:00
|
|
|
|
(let ((end-re (sql-ends-with-prompt-re)))
|
|
|
|
|
(unless (and (not (string= oline ""))
|
|
|
|
|
(string-match end-re oline)
|
|
|
|
|
(>= (match-end 0) (length oline)))
|
|
|
|
|
;; Find everything upto the last nl
|
|
|
|
|
(setq last-nl 0)
|
|
|
|
|
(while (string-match "\n" oline last-nl)
|
|
|
|
|
(setq last-nl (match-end 0)))
|
|
|
|
|
;; Hold after the last nl, return upto last nl
|
|
|
|
|
(setq sql-preoutput-hold (concat (substring oline last-nl)
|
|
|
|
|
sql-preoutput-hold)
|
|
|
|
|
oline (substring oline 0 last-nl)))))))
|
|
|
|
|
oline)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
;;; Sending the region to the SQLi buffer.
|
2019-04-20 20:13:56 -04:00
|
|
|
|
(defvar sql-debug-send nil
|
|
|
|
|
"Display text sent to SQL process pragmatically.")
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defun sql-send-string (str)
|
|
|
|
|
"Send the string STR to the SQL process."
|
|
|
|
|
(interactive "sSQL Text: ")
|
|
|
|
|
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(let ((comint-input-sender-no-newline nil)
|
|
|
|
|
(s (replace-regexp-in-string "[[:space:]\n\r]+\\'" "" str)))
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(if (sql-buffer-live-p sql-buffer)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(progn
|
|
|
|
|
;; Ignore the hoping around...
|
|
|
|
|
(save-excursion
|
|
|
|
|
;; Set product context
|
|
|
|
|
(with-current-buffer sql-buffer
|
2019-04-20 20:13:56 -04:00
|
|
|
|
(when sql-debug-send
|
|
|
|
|
(message ">>SQL> %S" s))
|
2021-05-16 16:32:10 +02:00
|
|
|
|
(insert "\n")
|
|
|
|
|
(comint-set-process-mark)
|
2019-04-20 20:13:56 -04:00
|
|
|
|
|
2010-08-10 19:04:32 -04:00
|
|
|
|
;; Send the string (trim the trailing whitespace)
|
2019-04-20 20:13:56 -04:00
|
|
|
|
(sql-input-sender (get-buffer-process (current-buffer)) s)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
;; Send a command terminator if we must
|
2019-04-20 20:13:56 -04:00
|
|
|
|
(sql-send-magic-terminator sql-buffer s sql-send-terminator)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(when sql-pop-to-buffer-after-send-region
|
|
|
|
|
(message "Sent string to buffer %s" sql-buffer))))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
;; Display the sql buffer
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(sql-display-buffer sql-buffer))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
;; We don't have no stinkin' sql
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "No SQL process started"))))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(defun sql-send-region (start end)
|
|
|
|
|
"Send a region to the SQL process."
|
|
|
|
|
(interactive "r")
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(sql-send-string (buffer-substring-no-properties start end)))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
(defun sql-send-paragraph ()
|
|
|
|
|
"Send the current paragraph to the SQL process."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((start (save-excursion
|
|
|
|
|
(backward-paragraph)
|
|
|
|
|
(point)))
|
|
|
|
|
(end (save-excursion
|
|
|
|
|
(forward-paragraph)
|
|
|
|
|
(point))))
|
|
|
|
|
(sql-send-region start end)))
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(defun sql-send-buffer ()
|
|
|
|
|
"Send the buffer contents to the SQL process."
|
|
|
|
|
(interactive)
|
|
|
|
|
(sql-send-region (point-min) (point-max)))
|
|
|
|
|
|
2014-09-08 08:27:19 -04:00
|
|
|
|
(defun sql-send-line-and-next ()
|
|
|
|
|
"Send the current line to the SQL process and go to the next line."
|
|
|
|
|
(interactive)
|
|
|
|
|
(sql-send-region (line-beginning-position 1) (line-beginning-position 2))
|
|
|
|
|
(beginning-of-line 2)
|
|
|
|
|
(while (forward-comment 1))) ; skip all comments and whitespace
|
|
|
|
|
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(defun sql-send-magic-terminator (buf str terminator)
|
2010-05-14 15:31:36 +02:00
|
|
|
|
"Send TERMINATOR to buffer BUF if its not present in STR."
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(let (comint-input-sender-no-newline pat term)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; If flag is merely on(t), get product-specific terminator
|
|
|
|
|
(if (eq terminator t)
|
|
|
|
|
(setq terminator (sql-get-product-feature sql-product :terminator)))
|
|
|
|
|
|
|
|
|
|
;; If there is no terminator specified, use default ";"
|
|
|
|
|
(unless terminator
|
|
|
|
|
(setq terminator ";"))
|
|
|
|
|
|
|
|
|
|
;; Parse the setting into the pattern and the terminator string
|
|
|
|
|
(cond ((stringp terminator)
|
|
|
|
|
(setq pat (regexp-quote terminator)
|
|
|
|
|
term terminator))
|
|
|
|
|
((consp terminator)
|
|
|
|
|
(setq pat (car terminator)
|
|
|
|
|
term (cdr terminator)))
|
|
|
|
|
(t
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
;; Check to see if the pattern is present in the str already sent
|
|
|
|
|
(unless (and pat term
|
2019-04-20 20:13:56 -04:00
|
|
|
|
(string-match-p (concat pat "\\'") str))
|
|
|
|
|
(sql-input-sender (get-buffer-process buf) term))))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-remove-tabs-filter (str)
|
|
|
|
|
"Replace tab characters with spaces."
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 18:58:46 +02:00
|
|
|
|
(string-replace "\t" " " str))
|
2004-04-29 21:55:28 +00:00
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(defun sql-toggle-pop-to-buffer-after-send-region (&optional value)
|
|
|
|
|
"Toggle `sql-pop-to-buffer-after-send-region'.
|
|
|
|
|
|
|
|
|
|
If given the optional parameter VALUE, sets
|
2010-04-24 04:59:23 +02:00
|
|
|
|
`sql-toggle-pop-to-buffer-after-send-region' to VALUE."
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(if value
|
|
|
|
|
(setq sql-pop-to-buffer-after-send-region value)
|
1999-09-29 09:51:59 +00:00
|
|
|
|
(setq sql-pop-to-buffer-after-send-region
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(null sql-pop-to-buffer-after-send-region))))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-13 16:05:23 -04:00
|
|
|
|
;;; Redirect output functions
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(defvar sql-debug-redirect nil
|
|
|
|
|
"If non-nil, display messages related to the use of redirection.")
|
|
|
|
|
|
|
|
|
|
(defun sql-str-literal (s)
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 18:58:46 +02:00
|
|
|
|
(concat "'" (string-replace "[']" "''" s) "'"))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-redirect (sqlbuf command &optional outbuf save-prior)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
"Execute the SQL command and send output to OUTBUF.
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
SQLBUF must be an active SQL interactive buffer. OUTBUF may be
|
2010-09-13 16:05:23 -04:00
|
|
|
|
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
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
of commands accepted by the SQLi program. COMMAND may also be a
|
|
|
|
|
list of SQLi command strings."
|
|
|
|
|
|
|
|
|
|
(let* ((visible (and outbuf
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(not (sql-buffer-hidden-p outbuf))))
|
|
|
|
|
(this-save save-prior)
|
|
|
|
|
(next-save t))
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(when visible
|
|
|
|
|
(message "Executing SQL command..."))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(if (consp command)
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(dolist (onecmd command)
|
|
|
|
|
(sql-redirect-one sqlbuf onecmd outbuf this-save)
|
|
|
|
|
(setq this-save next-save))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-redirect-one sqlbuf command outbuf save-prior))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(when visible
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(message "Executing SQL command...done"))
|
|
|
|
|
nil))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-redirect-one (sqlbuf command outbuf save-prior)
|
2014-11-01 22:04:26 -04:00
|
|
|
|
(when command
|
|
|
|
|
(with-current-buffer sqlbuf
|
|
|
|
|
(let ((buf (get-buffer-create (or outbuf " *SQL-Redirect*")))
|
|
|
|
|
(proc (get-buffer-process (current-buffer)))
|
|
|
|
|
(comint-prompt-regexp (sql-get-product-feature sql-product
|
|
|
|
|
:prompt-regexp))
|
|
|
|
|
(start nil))
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(setq-local view-no-disable-on-exit t)
|
|
|
|
|
(read-only-mode -1)
|
|
|
|
|
(unless save-prior
|
|
|
|
|
(erase-buffer))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(unless (zerop (buffer-size))
|
|
|
|
|
(insert "\n"))
|
|
|
|
|
(setq start (point)))
|
|
|
|
|
|
|
|
|
|
(when sql-debug-redirect
|
|
|
|
|
(message ">>SQL> %S" command))
|
|
|
|
|
|
|
|
|
|
;; Run the command
|
|
|
|
|
(let ((inhibit-quit t)
|
|
|
|
|
comint-preoutput-filter-functions)
|
|
|
|
|
(with-local-quit
|
|
|
|
|
(comint-redirect-send-command-to-process command buf proc nil t)
|
|
|
|
|
(while (or quit-flag (null comint-redirect-completed))
|
|
|
|
|
(accept-process-output nil 1)))
|
|
|
|
|
|
|
|
|
|
(if quit-flag
|
|
|
|
|
(comint-redirect-cleanup)
|
|
|
|
|
;; Clean up the output results
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
;; Remove trailing whitespace
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(when (looking-back "[ \t\f\n\r]*" start)
|
|
|
|
|
(delete-region (match-beginning 0) (match-end 0)))
|
|
|
|
|
;; Remove echo if there was one
|
|
|
|
|
(goto-char start)
|
|
|
|
|
(when (looking-at (concat "^" (regexp-quote command) "[\\n]"))
|
|
|
|
|
(delete-region (match-beginning 0) (match-end 0)))
|
|
|
|
|
;; Remove Ctrl-Ms
|
|
|
|
|
(goto-char start)
|
|
|
|
|
(while (re-search-forward "\r+$" nil t)
|
|
|
|
|
(replace-match "" t t))
|
|
|
|
|
(goto-char start))))))))
|
2010-09-13 16:05:23 -04:00
|
|
|
|
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(defun sql-redirect-value (sqlbuf command &optional regexp regexp-groups)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
"Execute the SQL command and return part of result.
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
SQLBUF must be an active SQL interactive buffer. COMMAND should
|
2010-09-13 16:05:23 -04:00
|
|
|
|
be a string of commands accepted by the SQLi program. From the
|
|
|
|
|
output, the REGEXP is repeatedly matched and the list of
|
|
|
|
|
REGEXP-GROUPS submatches is returned. This behaves much like
|
|
|
|
|
\\[comint-redirect-results-list-from-process] but instead of
|
|
|
|
|
returning a single submatch it returns a list of each submatch
|
|
|
|
|
for each match."
|
|
|
|
|
|
|
|
|
|
(let ((outbuf " *SQL-Redirect-values*")
|
|
|
|
|
(results nil))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-redirect sqlbuf command outbuf nil)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(with-current-buffer outbuf
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(while (re-search-forward (or regexp "^.+$") nil t)
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(push
|
|
|
|
|
(cond
|
|
|
|
|
;; no groups-return all of them
|
|
|
|
|
((null regexp-groups)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(let ((i (/ (length (match-data)) 2))
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(r nil))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(while (> i 0)
|
|
|
|
|
(setq i (1- i))
|
2010-09-13 16:05:23 -04:00
|
|
|
|
(push (match-string i) r))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
r))
|
2010-09-13 16:05:23 -04:00
|
|
|
|
;; one group specified
|
|
|
|
|
((numberp regexp-groups)
|
|
|
|
|
(match-string regexp-groups))
|
|
|
|
|
;; list of numbers; return the specified matches only
|
|
|
|
|
((consp regexp-groups)
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(mapcar (lambda (c)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(cond
|
|
|
|
|
((numberp c) (match-string c))
|
|
|
|
|
((stringp c) (match-substitute-replacement c))
|
2021-09-27 23:56:55 +02:00
|
|
|
|
(t (error "sql-redirect-value: Unknown REGEXP-GROUPS value - %s" c))))
|
2010-09-13 16:05:23 -04:00
|
|
|
|
regexp-groups))
|
|
|
|
|
;; String is specified; return replacement string
|
|
|
|
|
((stringp regexp-groups)
|
|
|
|
|
(match-substitute-replacement regexp-groups))
|
|
|
|
|
(t
|
2021-09-27 23:56:55 +02:00
|
|
|
|
(error "sql-redirect-value: Unknown REGEXP-GROUPS value - %s"
|
2010-09-13 16:05:23 -04:00
|
|
|
|
regexp-groups)))
|
|
|
|
|
results)))
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(when sql-debug-redirect
|
|
|
|
|
(message ">>SQL> = %S" (reverse results)))
|
|
|
|
|
|
|
|
|
|
(nreverse results)))
|
|
|
|
|
|
|
|
|
|
(defun sql-execute (sqlbuf outbuf command enhanced arg)
|
2012-12-06 12:29:30 -05:00
|
|
|
|
"Execute a command in a SQL interactive buffer and capture the output.
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
|
|
|
|
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
|
2012-12-06 12:29:30 -05:00
|
|
|
|
buffer is popped into a view window."
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(mapc
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(lambda (c)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(cond
|
|
|
|
|
((stringp c)
|
|
|
|
|
(sql-redirect sqlbuf (if arg (format c arg) c) outbuf) t)
|
|
|
|
|
((functionp c)
|
|
|
|
|
(apply c sqlbuf outbuf enhanced arg nil))
|
|
|
|
|
(t (error "Unknown sql-execute item %s" c))))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(if (consp command) command (cons command nil)))
|
2014-09-08 08:27:19 -04:00
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(setq outbuf (get-buffer outbuf))
|
|
|
|
|
(if (zerop (buffer-size outbuf))
|
|
|
|
|
(kill-buffer outbuf)
|
|
|
|
|
(let ((one-win (eq (selected-window)
|
|
|
|
|
(get-lru-window))))
|
|
|
|
|
(with-current-buffer outbuf
|
|
|
|
|
(set-buffer-modified-p nil)
|
2014-09-22 15:18:29 -04:00
|
|
|
|
(setq-local revert-buffer-function
|
|
|
|
|
(lambda (_ignore-auto _noconfirm)
|
|
|
|
|
(sql-execute sqlbuf (buffer-name outbuf)
|
|
|
|
|
command enhanced arg)))
|
|
|
|
|
(special-mode))
|
2013-07-23 20:25:53 -04:00
|
|
|
|
(pop-to-buffer outbuf)
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(when one-win
|
|
|
|
|
(shrink-window-if-larger-than-buffer)))))
|
|
|
|
|
|
|
|
|
|
(defun sql-execute-feature (sqlbuf outbuf feature enhanced arg)
|
|
|
|
|
"List objects or details in a separate display buffer."
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(let (command
|
|
|
|
|
(product (buffer-local-value 'sql-product (get-buffer sqlbuf))))
|
|
|
|
|
(setq command (sql-get-product-feature product feature))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(unless command
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(error "%s does not support %s" product feature))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(when (consp command)
|
|
|
|
|
(setq command (if enhanced
|
|
|
|
|
(cdr command)
|
|
|
|
|
(car command))))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-execute sqlbuf outbuf command enhanced arg)))
|
|
|
|
|
|
|
|
|
|
(defvar sql-completion-object nil
|
|
|
|
|
"A list of database objects used for completion.
|
|
|
|
|
|
|
|
|
|
The list is maintained in SQL interactive buffers.")
|
|
|
|
|
|
|
|
|
|
(defvar sql-completion-column nil
|
|
|
|
|
"A list of column names used for completion.
|
|
|
|
|
|
|
|
|
|
The list is maintained in SQL interactive buffers.")
|
|
|
|
|
|
|
|
|
|
(defun sql-build-completions-1 (schema completion-list feature)
|
|
|
|
|
"Generate a list of objects in the database for use as completions."
|
|
|
|
|
(let ((f (sql-get-product-feature sql-product feature)))
|
|
|
|
|
(when f
|
|
|
|
|
(set completion-list
|
|
|
|
|
(let (cl)
|
|
|
|
|
(dolist (e (append (symbol-value completion-list)
|
|
|
|
|
(apply f (current-buffer) (cons schema nil)))
|
|
|
|
|
cl)
|
|
|
|
|
(unless (member e cl) (setq cl (cons e cl))))
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(sort cl #'string<))))))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-build-completions (schema)
|
|
|
|
|
"Generate a list of names in the database for use as completions."
|
|
|
|
|
(sql-build-completions-1 schema 'sql-completion-object :completion-object)
|
|
|
|
|
(sql-build-completions-1 schema 'sql-completion-column :completion-column))
|
|
|
|
|
|
|
|
|
|
(defvar sql-completion-sqlbuf nil)
|
|
|
|
|
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(defun sql--completion-table (string pred action)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(when sql-completion-sqlbuf
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(with-current-buffer sql-completion-sqlbuf
|
|
|
|
|
(let ((schema (and (string-match "\\`\\(\\sw\\(:?\\sw\\|\\s_\\)*\\)[.]" string)
|
|
|
|
|
(downcase (match-string 1 string)))))
|
|
|
|
|
|
|
|
|
|
;; If we haven't loaded any object name yet, load local schema
|
|
|
|
|
(unless sql-completion-object
|
|
|
|
|
(sql-build-completions nil))
|
|
|
|
|
|
|
|
|
|
;; If they want another schema, load it if we haven't yet
|
|
|
|
|
(when schema
|
|
|
|
|
(let ((schema-dot (concat schema "."))
|
|
|
|
|
(schema-len (1+ (length schema)))
|
|
|
|
|
(names sql-completion-object)
|
|
|
|
|
has-schema)
|
|
|
|
|
|
|
|
|
|
(while (and (not has-schema) names)
|
|
|
|
|
(setq has-schema (and
|
|
|
|
|
(>= (length (car names)) schema-len)
|
|
|
|
|
(string= schema-dot
|
|
|
|
|
(downcase (substring (car names)
|
|
|
|
|
0 schema-len))))
|
|
|
|
|
names (cdr names)))
|
|
|
|
|
(unless has-schema
|
|
|
|
|
(sql-build-completions schema)))))
|
|
|
|
|
|
|
|
|
|
;; Try to find the completion
|
|
|
|
|
(complete-with-action action sql-completion-object string pred))))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-read-table-name (prompt)
|
|
|
|
|
"Read the name of a database table."
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(let* ((tname
|
|
|
|
|
(and (buffer-local-value 'sql-contains-names (current-buffer))
|
|
|
|
|
(thing-at-point-looking-at
|
|
|
|
|
(concat "\\_<\\sw\\(:?\\sw\\|\\s_\\)*"
|
|
|
|
|
"\\(?:[.]+\\sw\\(?:\\sw\\|\\s_\\)*\\)*\\_>"))
|
|
|
|
|
(buffer-substring-no-properties (match-beginning 0)
|
|
|
|
|
(match-end 0))))
|
|
|
|
|
(sql-completion-sqlbuf (sql-find-sqli-buffer))
|
2014-02-15 17:50:45 -05:00
|
|
|
|
(product (when sql-completion-sqlbuf
|
|
|
|
|
(with-current-buffer sql-completion-sqlbuf sql-product)))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(completion-ignore-case t))
|
|
|
|
|
|
2014-02-15 17:50:45 -05:00
|
|
|
|
(if product
|
|
|
|
|
(if (sql-get-product-feature product :completion-object)
|
|
|
|
|
(completing-read prompt #'sql--completion-table
|
|
|
|
|
nil nil tname)
|
|
|
|
|
(read-from-minibuffer prompt tname))
|
|
|
|
|
(user-error "There is no active SQLi buffer"))))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-list-all (&optional enhanced)
|
2012-02-07 23:54:09 -08:00
|
|
|
|
"List all database objects.
|
|
|
|
|
With optional prefix argument ENHANCED, displays additional
|
|
|
|
|
details or extends the listing to include other schemas objects."
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((sqlbuf (sql-find-sqli-buffer)))
|
|
|
|
|
(unless sqlbuf
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "No SQL interactive buffer found"))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-execute-feature sqlbuf "*List All*" :list-all enhanced nil)
|
|
|
|
|
(with-current-buffer sqlbuf
|
|
|
|
|
;; Contains the name of database objects
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-contains-names t)
|
|
|
|
|
(setq-local sql-buffer sqlbuf))))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-list-table (name &optional enhanced)
|
2012-02-07 23:54:09 -08:00
|
|
|
|
"List the details of a database table named NAME.
|
|
|
|
|
Displays the columns in the relation. With optional prefix argument
|
|
|
|
|
ENHANCED, displays additional details about each column."
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(interactive
|
|
|
|
|
(list (sql-read-table-name "Table name: ")
|
|
|
|
|
current-prefix-arg))
|
|
|
|
|
(let ((sqlbuf (sql-find-sqli-buffer)))
|
|
|
|
|
(unless sqlbuf
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "No SQL interactive buffer found"))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(unless name
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "No table name specified"))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(sql-execute-feature sqlbuf (format "*List %s*" name)
|
|
|
|
|
:list-table enhanced name)))
|
2010-09-13 16:05:23 -04:00
|
|
|
|
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
;;; SQL mode -- uses SQL interactive mode
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
(define-derived-mode sql-mode prog-mode "SQL"
|
1999-01-11 15:26:36 +00:00
|
|
|
|
"Major mode to edit SQL.
|
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
You can send SQL statements to the SQLi buffer using
|
1999-01-11 15:26:36 +00:00
|
|
|
|
\\[sql-send-region]. Such a buffer must exist before you can do this.
|
1999-02-13 12:04:00 +00:00
|
|
|
|
See `sql-help' on how to create SQLi buffers.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-09-29 09:51:59 +00:00
|
|
|
|
\\{sql-mode-map}
|
1999-01-11 15:26:36 +00:00
|
|
|
|
Customization: Entry to this mode runs the `sql-mode-hook'.
|
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
When you put a buffer in SQL mode, the buffer stores the last SQLi
|
|
|
|
|
buffer created as its destination in the variable `sql-buffer'. This
|
|
|
|
|
will be the buffer \\[sql-send-region] sends the region to. If this
|
|
|
|
|
SQLi buffer is killed, \\[sql-send-region] is no longer able to
|
1999-02-19 04:24:12 +00:00
|
|
|
|
determine where the strings should be sent to. You can set the
|
|
|
|
|
value of `sql-buffer' using \\[sql-set-sqli-buffer].
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
For information on how to create multiple SQLi buffers, see
|
2001-11-13 02:22:40 +00:00
|
|
|
|
`sql-interactive-mode'.
|
|
|
|
|
|
|
|
|
|
Note that SQL doesn't have an escape character unless you specify
|
2012-09-17 13:41:04 +08:00
|
|
|
|
one. If you specify backslash as escape character in SQL, you
|
|
|
|
|
must tell Emacs. Here's how to do that in your init file:
|
2001-11-13 02:22:40 +00:00
|
|
|
|
|
Prefer directed to neutral quotes
Prefer directed to neutral quotes in docstings and diagnostics.
In docstrings, escape apostrophes that would otherwise be translated
to curved quotes using the newer, simpler rules.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-lang.el (math-read-giac-subscr)
(math-read-math-subscr):
* lisp/calc/calc-misc.el (report-calc-bug):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/dabbrev.el (dabbrev-expand):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/elint.el (elint-get-top-forms):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emulation/viper-cmd.el (viper-toggle-search-style):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-arg.el (eshell-parse-arguments):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/files-x.el (modify-file-local-variable):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer)
(filesets-update-pre010505):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/gnus/auth-source.el (auth-source-netrc-parse-entries):
* lisp/gnus/gnus-agent.el (gnus-agent-check-overview-buffer)
(gnus-agent-fetch-headers):
* lisp/gnus/gnus-int.el (gnus-start-news-server):
* lisp/gnus/gnus-registry.el:
(gnus-registry--split-fancy-with-parent-internal):
* lisp/gnus/gnus-score.el (gnus-summary-increase-score):
* lisp/gnus/gnus-start.el (gnus-convert-old-newsrc):
* lisp/gnus/gnus-topic.el (gnus-topic-rename):
* lisp/gnus/legacy-gnus-agent.el (gnus-agent-unlist-expire-days):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/gnus/spam.el (spam-check-blackholes):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/tramp-cache.el:
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-bibtex.el (org-bibtex-fields):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/play/dunnet.el (dun-score, dun-help, dun-endgame-question)
(dun-rooms, dun-endgame-questions):
* lisp/progmodes/ada-mode.el (ada-goto-matching-start):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/antlr-mode.el (antlr-options-alists):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/server.el (server-get-auth-key):
* lisp/subr.el (version-to-list):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/vc/ediff-diff.el (ediff-same-contents):
* lisp/vc/vc-cvs.el (vc-cvs-mode-line-string):
* test/automated/tramp-tests.el (tramp-test33-asynchronous-requests):
Use directed rather than neutral quotes in diagnostics.
2015-08-24 23:39:33 -07:00
|
|
|
|
\(add-hook \\='sql-mode-hook
|
2001-11-13 02:22:40 +00:00
|
|
|
|
(lambda ()
|
2020-08-09 20:55:52 +02:00
|
|
|
|
(modify-syntax-entry ?\\\\ \"\\\\\" sql-mode-syntax-table)))"
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
:abbrev-table sql-mode-abbrev-table
|
2014-11-01 22:04:26 -04:00
|
|
|
|
|
2012-12-06 12:29:30 -05:00
|
|
|
|
;; (smie-setup sql-smie-grammar #'sql-smie-rules)
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local comment-start "--")
|
1999-09-29 09:51:59 +00:00
|
|
|
|
;; Make each buffer in sql-mode remember the "current" SQLi buffer.
|
1999-02-13 12:04:00 +00:00
|
|
|
|
(make-local-variable 'sql-buffer)
|
1999-09-29 09:51:59 +00:00
|
|
|
|
;; Add imenu support for sql-mode. Note that imenu-generic-expression
|
|
|
|
|
;; is buffer-local, so we don't need a local-variable for it. SQL is
|
|
|
|
|
;; case-insensitive, that's why we have to set imenu-case-fold-search.
|
|
|
|
|
(setq imenu-generic-expression sql-imenu-generic-expression
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
imenu-case-fold-search t)
|
1999-02-19 04:24:12 +00:00
|
|
|
|
;; Make `sql-send-paragraph' work on paragraphs that contain indented
|
|
|
|
|
;; lines.
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local paragraph-separate "[\f]*$")
|
|
|
|
|
(setq-local paragraph-start "[\n\f]")
|
1999-09-29 09:51:59 +00:00
|
|
|
|
;; Abbrevs
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(setq-local abbrev-all-caps 1)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Contains the name of database objects
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-contains-names t)
|
2020-08-08 15:33:58 +02:00
|
|
|
|
(setq-local syntax-propertize-function
|
2020-08-10 13:24:19 +02:00
|
|
|
|
(syntax-propertize-rules
|
|
|
|
|
;; Handle escaped apostrophes within strings.
|
|
|
|
|
("''"
|
|
|
|
|
(0
|
|
|
|
|
(if (save-excursion (nth 3 (syntax-ppss (match-beginning 0))))
|
|
|
|
|
(string-to-syntax ".")
|
|
|
|
|
(forward-char -1)
|
|
|
|
|
nil)))
|
|
|
|
|
;; Propertize rules to not have /- and -* start comments.
|
|
|
|
|
("\\(/-\\)" (1 "."))
|
|
|
|
|
("\\(-\\*\\)" (1 "."))))
|
2013-07-23 20:25:53 -04:00
|
|
|
|
;; Set syntax and font-face highlighting
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Catch changes to sql-product and highlight accordingly
|
2013-07-23 20:25:53 -04:00
|
|
|
|
(sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591
|
2019-02-20 09:25:54 -05:00
|
|
|
|
(add-hook 'hack-local-variables-hook #'sql-highlight-product t t))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; SQL interactive mode
|
|
|
|
|
|
|
|
|
|
(put 'sql-interactive-mode 'mode-class 'special)
|
2014-11-01 22:04:26 -04:00
|
|
|
|
(put 'sql-interactive-mode 'custom-mode-group 'SQL)
|
2019-02-20 09:25:54 -05:00
|
|
|
|
;; FIXME: Why not use `define-derived-mode'?
|
2020-03-14 15:39:31 -04:00
|
|
|
|
(define-derived-mode sql-interactive-mode comint-mode "SQLi[?]"
|
1999-01-11 15:26:36 +00:00
|
|
|
|
"Major mode to use a SQL interpreter interactively.
|
|
|
|
|
|
|
|
|
|
Do not call this function by yourself. The environment must be
|
2010-04-24 04:59:23 +02:00
|
|
|
|
initialized by an entry function specific for the SQL interpreter.
|
|
|
|
|
See `sql-help' for a list of available entry functions.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
\\[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.
|
|
|
|
|
\\[comint-send-input] before end of process output copies the current
|
|
|
|
|
line minus the prompt to the end of the buffer and sends it.
|
|
|
|
|
\\[comint-copy-old-input] just copies the current line.
|
|
|
|
|
Use \\[sql-accumulate-and-indent] to enter multi-line statements.
|
|
|
|
|
|
|
|
|
|
If you want to make multiple SQL buffers, rename the `*SQL*' buffer
|
|
|
|
|
using \\[rename-buffer] or \\[rename-uniquely] and start a new process.
|
1999-02-13 12:04:00 +00:00
|
|
|
|
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 \\[sql-send-region] in buffer \"test1.sql\" will send the region to
|
|
|
|
|
buffer \"*Connection 1*\", \\[sql-send-region] in buffer \"test2.sql\"
|
|
|
|
|
will send the region to buffer \"*Connection 2*\".
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
If you accidentally suspend your process, use \\[comint-continue-subjob]
|
1999-02-13 12:04:00 +00:00
|
|
|
|
to continue it. On some operating systems, this will not work because
|
|
|
|
|
the signals are not supported.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
\\{sql-interactive-mode-map}
|
|
|
|
|
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.
|
|
|
|
|
|
2005-08-29 11:02:42 +00:00
|
|
|
|
Variable `sql-input-ring-file-name' controls the initialization of the
|
2000-07-27 20:06:37 +00:00
|
|
|
|
input ring history.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
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'.
|
|
|
|
|
|
2012-09-17 13:41:04 +08:00
|
|
|
|
Here is an example for your init file. It keeps the SQLi buffer a
|
1999-02-19 04:24:12 +00:00
|
|
|
|
certain length.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
Prefer directed to neutral quotes
Prefer directed to neutral quotes in docstings and diagnostics.
In docstrings, escape apostrophes that would otherwise be translated
to curved quotes using the newer, simpler rules.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-lang.el (math-read-giac-subscr)
(math-read-math-subscr):
* lisp/calc/calc-misc.el (report-calc-bug):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/dabbrev.el (dabbrev-expand):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/elint.el (elint-get-top-forms):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emulation/viper-cmd.el (viper-toggle-search-style):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-arg.el (eshell-parse-arguments):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/files-x.el (modify-file-local-variable):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer)
(filesets-update-pre010505):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/gnus/auth-source.el (auth-source-netrc-parse-entries):
* lisp/gnus/gnus-agent.el (gnus-agent-check-overview-buffer)
(gnus-agent-fetch-headers):
* lisp/gnus/gnus-int.el (gnus-start-news-server):
* lisp/gnus/gnus-registry.el:
(gnus-registry--split-fancy-with-parent-internal):
* lisp/gnus/gnus-score.el (gnus-summary-increase-score):
* lisp/gnus/gnus-start.el (gnus-convert-old-newsrc):
* lisp/gnus/gnus-topic.el (gnus-topic-rename):
* lisp/gnus/legacy-gnus-agent.el (gnus-agent-unlist-expire-days):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/gnus/spam.el (spam-check-blackholes):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/tramp-cache.el:
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-bibtex.el (org-bibtex-fields):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/play/dunnet.el (dun-score, dun-help, dun-endgame-question)
(dun-rooms, dun-endgame-questions):
* lisp/progmodes/ada-mode.el (ada-goto-matching-start):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/antlr-mode.el (antlr-options-alists):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/server.el (server-get-auth-key):
* lisp/subr.el (version-to-list):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/vc/ediff-diff.el (ediff-same-contents):
* lisp/vc/vc-cvs.el (vc-cvs-mode-line-string):
* test/automated/tramp-tests.el (tramp-test33-asynchronous-requests):
Use directed rather than neutral quotes in diagnostics.
2015-08-24 23:39:33 -07:00
|
|
|
|
\(add-hook \\='sql-interactive-mode-hook
|
2020-09-30 16:02:22 +02:00
|
|
|
|
(lambda ()
|
|
|
|
|
(setq comint-output-filter-functions #\\='comint-truncate-buffer)))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
Here is another example. It will always put point back to the statement
|
|
|
|
|
you entered, right above the output it created.
|
|
|
|
|
|
1999-09-29 09:51:59 +00:00
|
|
|
|
\(setq comint-output-filter-functions
|
2020-09-30 16:02:22 +02:00
|
|
|
|
(lambda (STR) (comint-show-output)))"
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:syntax-table sql-mode-syntax-table
|
2019-02-20 09:25:54 -05:00
|
|
|
|
;; FIXME: The doc above uses `setq' on `comint-output-filter-functions',
|
|
|
|
|
;; whereas hooks should be manipulated with things like `add/remove-hook'.
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:after-hook (sql--adjust-interactive-setup)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Get the `sql-product' for this interactive session.
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-product (or sql-interactive-product
|
|
|
|
|
sql-product))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Setup the mode.
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
(setq mode-name
|
|
|
|
|
(concat "SQLi[" (or (sql-get-product-feature sql-product :name)
|
|
|
|
|
(symbol-name sql-product)) "]"))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
1999-02-06 05:09:31 +00:00
|
|
|
|
;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
|
1999-09-29 09:51:59 +00:00
|
|
|
|
;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column
|
2011-11-26 20:43:11 -08:00
|
|
|
|
;; will have just one quote. Therefore syntactic highlighting is
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; disabled for interactive buffers. No imenu support.
|
|
|
|
|
(sql-product-font-lock t nil)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
|
1999-02-19 04:24:12 +00:00
|
|
|
|
;; Enable commenting and uncommenting of the region.
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local comment-start "--")
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Abbreviation table init and case-insensitive. It is not activated
|
1999-02-19 04:24:12 +00:00
|
|
|
|
;; by default.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(setq local-abbrev-table sql-mode-abbrev-table)
|
|
|
|
|
(setq abbrev-all-caps 1)
|
1999-02-19 04:24:12 +00:00
|
|
|
|
;; Exiting the process will call sql-stop.
|
2019-02-18 21:51:09 -05:00
|
|
|
|
(let ((proc (get-buffer-process (current-buffer))))
|
2019-02-20 09:25:54 -05:00
|
|
|
|
(when proc (set-process-sentinel proc #'sql-stop)))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Save the connection and login params
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-user sql-user)
|
|
|
|
|
(setq-local sql-database sql-database)
|
|
|
|
|
(setq-local sql-server sql-server)
|
|
|
|
|
(setq-local sql-port sql-port)
|
|
|
|
|
(setq-local sql-connection sql-connection)
|
2012-03-01 00:01:22 -05:00
|
|
|
|
(setq-default sql-connection nil)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Contains the name of database objects
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-contains-names t)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Keep track of existing object names
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-completion-object nil)
|
|
|
|
|
(setq-local sql-completion-column nil)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Create a useful name for renaming this buffer later.
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-alternate-buffer-name
|
|
|
|
|
(sql-make-alternate-buffer-name))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; User stuff. Initialize before the hook.
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-prompt-regexp
|
|
|
|
|
(or (sql-get-product-feature sql-product :prompt-regexp) "^"))
|
|
|
|
|
(setq-local sql-prompt-length
|
|
|
|
|
(sql-get-product-feature sql-product :prompt-length))
|
|
|
|
|
(setq-local sql-prompt-cont-regexp
|
|
|
|
|
(sql-get-product-feature sql-product :prompt-cont-regexp))
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(make-local-variable 'sql-output-newline-count)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(make-local-variable 'sql-preoutput-hold)
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(add-hook 'comint-preoutput-filter-functions
|
2019-02-20 09:25:54 -05:00
|
|
|
|
#'sql-interactive-remove-continuation-prompt nil t)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(make-local-variable 'sql-input-ring-separator)
|
2020-03-14 15:39:31 -04:00
|
|
|
|
(make-local-variable 'sql-input-ring-file-name))
|
|
|
|
|
|
|
|
|
|
(defun sql--adjust-interactive-setup ()
|
|
|
|
|
"Finish the mode's setup after running the mode hook."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Set comint based on user overrides.
|
2010-08-10 19:04:32 -04:00
|
|
|
|
(setq comint-prompt-regexp
|
|
|
|
|
(if sql-prompt-cont-regexp
|
2019-04-21 00:19:56 -04:00
|
|
|
|
(concat "\\(?:\\(?:" sql-prompt-regexp "\\)"
|
|
|
|
|
"\\|\\(?:" sql-prompt-cont-regexp "\\)\\)")
|
2010-08-10 19:04:32 -04:00
|
|
|
|
sql-prompt-regexp))
|
2019-02-18 21:51:09 -05:00
|
|
|
|
(setq left-margin (or sql-prompt-length 0))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
;; Install input sender
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local comint-input-sender #'sql-input-sender)
|
2000-07-27 20:06:37 +00:00
|
|
|
|
;; People wanting a different history file for each
|
|
|
|
|
;; buffer/process/client/whatever can change separator and file-name
|
|
|
|
|
;; on the sql-interactive-mode-hook.
|
2014-11-01 18:14:01 -04:00
|
|
|
|
(let
|
|
|
|
|
((comint-input-ring-separator sql-input-ring-separator)
|
|
|
|
|
(comint-input-ring-file-name sql-input-ring-file-name))
|
|
|
|
|
(comint-read-input-ring t)))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
(defun sql-stop (process event)
|
|
|
|
|
"Called when the SQL process is stopped.
|
|
|
|
|
|
1999-02-19 04:24:12 +00:00
|
|
|
|
Writes the input history to a history file using
|
|
|
|
|
`comint-write-input-ring' and inserts a short message in the SQL buffer.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
This function is a sentinel watching the SQL interpreter process.
|
|
|
|
|
Sentinels will always get the two parameters PROCESS and EVENT."
|
2018-04-18 01:22:49 +02:00
|
|
|
|
(when (buffer-live-p (process-buffer process))
|
|
|
|
|
(with-current-buffer (process-buffer process)
|
|
|
|
|
(let
|
|
|
|
|
((comint-input-ring-separator sql-input-ring-separator)
|
|
|
|
|
(comint-input-ring-file-name sql-input-ring-file-name))
|
|
|
|
|
(comint-write-input-ring))
|
|
|
|
|
|
|
|
|
|
(if (not buffer-read-only)
|
|
|
|
|
(insert (format "\nProcess %s %s\n" process event))
|
|
|
|
|
(message "Process %s %s" process event)))))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-22 20:59:43 -04:00
|
|
|
|
;;; Connection handling
|
2010-07-18 14:44:32 -04:00
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(defun sql-read-connection (prompt &optional initial default)
|
|
|
|
|
"Read a connection name."
|
|
|
|
|
(let ((completion-ignore-case t))
|
|
|
|
|
(completing-read prompt
|
2019-02-20 09:25:54 -05:00
|
|
|
|
(mapcar #'car sql-connection-alist)
|
2010-09-18 22:11:18 -04:00
|
|
|
|
nil t initial 'sql-connection-history default)))
|
|
|
|
|
|
2010-07-18 14:44:32 -04:00
|
|
|
|
;;;###autoload
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-connect (connection &optional buf-name)
|
2010-07-18 14:44:32 -04:00
|
|
|
|
"Connect to an interactive session using CONNECTION settings.
|
|
|
|
|
|
|
|
|
|
See `sql-connection-alist' to see how to define connections and
|
|
|
|
|
their settings.
|
|
|
|
|
|
|
|
|
|
The user will not be prompted for any login parameters if a value
|
|
|
|
|
is specified in the connection settings."
|
|
|
|
|
|
|
|
|
|
;; Prompt for the connection from those defined in the alist
|
|
|
|
|
(interactive
|
|
|
|
|
(if sql-connection-alist
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(list (sql-read-connection "Connection: ")
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
current-prefix-arg)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "No SQL Connections defined")))
|
2010-07-18 14:44:32 -04:00
|
|
|
|
|
|
|
|
|
;; Are there connections defined
|
|
|
|
|
(if sql-connection-alist
|
|
|
|
|
;; Was one selected
|
|
|
|
|
(when connection
|
|
|
|
|
;; Get connection settings
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(let ((connect-set (cdr (assoc-string connection sql-connection-alist t))))
|
2010-07-18 14:44:32 -04:00
|
|
|
|
;; Settings are defined
|
|
|
|
|
(if connect-set
|
|
|
|
|
;; Set the desired parameters
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(let (param-var login-params set-vars rem-vars)
|
2016-12-02 11:53:33 +02:00
|
|
|
|
;; Set the parameters and start the interactive session
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(dolist (vv connect-set)
|
|
|
|
|
(let ((var (car vv))
|
|
|
|
|
(val (cadr vv)))
|
2020-03-14 15:39:31 -04:00
|
|
|
|
(set-default var (eval val)))) ;FIXME: Why `eval'?
|
2016-12-02 11:53:33 +02:00
|
|
|
|
(setq-default sql-connection connection)
|
2012-03-01 00:01:22 -05:00
|
|
|
|
|
|
|
|
|
;; :sqli-login params variable
|
|
|
|
|
(setq param-var
|
|
|
|
|
(sql-get-product-feature sql-product :sqli-login nil t))
|
|
|
|
|
|
|
|
|
|
;; :sqli-login params value
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(setq login-params (symbol-value param-var))
|
2012-03-01 00:01:22 -05:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
;; Params set in the connection
|
|
|
|
|
(setq set-vars
|
2012-03-01 00:01:22 -05:00
|
|
|
|
(mapcar
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(lambda (v)
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(pcase (car v)
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('sql-user 'user)
|
|
|
|
|
('sql-password 'password)
|
|
|
|
|
('sql-server 'server)
|
|
|
|
|
('sql-database 'database)
|
|
|
|
|
('sql-port 'port)
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(s s)))
|
|
|
|
|
connect-set))
|
2012-03-01 00:01:22 -05:00
|
|
|
|
|
|
|
|
|
;; the remaining params (w/o the connection params)
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(setq rem-vars
|
2012-03-01 00:01:22 -05:00
|
|
|
|
(sql-for-each-login login-params
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(lambda (var vals)
|
|
|
|
|
(unless (member var set-vars)
|
|
|
|
|
(if vals (cons var vals) var)))))
|
2012-03-01 00:01:22 -05:00
|
|
|
|
|
|
|
|
|
;; Start the SQLi session with revised list of login parameters
|
2020-03-14 15:39:31 -04:00
|
|
|
|
(cl-progv (list param-var) (list rem-vars)
|
|
|
|
|
(sql-product-interactive
|
|
|
|
|
sql-product
|
|
|
|
|
(or buf-name (format "<%s>" connection)))))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "SQL Connection <%s> does not exist" connection)
|
2010-07-18 14:44:32 -04:00
|
|
|
|
nil)))
|
2012-03-01 00:01:22 -05:00
|
|
|
|
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "No SQL Connections defined")
|
2010-07-18 14:44:32 -04:00
|
|
|
|
nil))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
2010-07-20 21:56:55 -04:00
|
|
|
|
(defun sql-save-connection (name)
|
|
|
|
|
"Captures the connection information of the current SQLi session.
|
|
|
|
|
|
|
|
|
|
The information is appended to `sql-connection-alist' and
|
|
|
|
|
optionally is saved to the user's init file."
|
|
|
|
|
|
|
|
|
|
(interactive "sNew connection name: ")
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(unless (derived-mode-p 'sql-interactive-mode)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "Not in a SQL interactive mode!"))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
|
|
|
|
;; Capture the buffer local settings
|
|
|
|
|
(let* ((buf (current-buffer))
|
|
|
|
|
(connection (buffer-local-value 'sql-connection buf))
|
|
|
|
|
(product (buffer-local-value 'sql-product buf))
|
|
|
|
|
(user (buffer-local-value 'sql-user buf))
|
|
|
|
|
(database (buffer-local-value 'sql-database buf))
|
|
|
|
|
(server (buffer-local-value 'sql-server buf))
|
|
|
|
|
(port (buffer-local-value 'sql-port buf)))
|
|
|
|
|
|
|
|
|
|
(if connection
|
|
|
|
|
(message "This session was started by a connection; it's already been saved.")
|
2011-11-14 15:59:56 -08:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(let ((login (sql-get-product-feature product :sqli-login))
|
|
|
|
|
(alist sql-connection-alist)
|
|
|
|
|
connect)
|
2011-11-14 15:59:56 -08:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Remove the existing connection if the user says so
|
|
|
|
|
(when (and (assoc name alist)
|
|
|
|
|
(yes-or-no-p (format "Replace connection definition <%s>? " name)))
|
|
|
|
|
(setq alist (assq-delete-all name alist)))
|
2011-11-14 15:59:56 -08:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Add the new connection if it doesn't exist
|
|
|
|
|
(if (assoc name alist)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(user-error "Connection <%s> already exists" name)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(setq connect
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(cons name
|
|
|
|
|
(sql-for-each-login
|
|
|
|
|
`(product ,@login)
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(lambda (token _plist)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(pcase token
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('product `(sql-product ',product))
|
|
|
|
|
('user `(sql-user ,user))
|
|
|
|
|
('database `(sql-database ,database))
|
|
|
|
|
('server `(sql-server ,server))
|
|
|
|
|
('port `(sql-port ,port)))))))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
|
|
|
|
(setq alist (append alist (list connect)))
|
|
|
|
|
|
|
|
|
|
;; confirm whether we want to save the connections
|
|
|
|
|
(if (yes-or-no-p "Save the connections for future sessions? ")
|
|
|
|
|
(customize-save-variable 'sql-connection-alist alist)
|
|
|
|
|
(customize-set-variable 'sql-connection-alist alist)))))))
|
2010-07-20 21:56:55 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-connection-menu-filter (tail)
|
2012-12-06 12:29:30 -05:00
|
|
|
|
"Generate menu entries for using each connection."
|
2010-07-20 21:56:55 -04:00
|
|
|
|
(append
|
|
|
|
|
(mapcar
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(lambda (conn)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(vector
|
|
|
|
|
(format "Connection <%s>\t%s" (car conn)
|
|
|
|
|
(let ((sql-user "") (sql-database "")
|
|
|
|
|
(sql-server "") (sql-port 0))
|
2020-03-14 15:39:31 -04:00
|
|
|
|
(cl-progv
|
|
|
|
|
(mapcar #'car (cdr conn))
|
|
|
|
|
(mapcar #'cadr (cdr conn))
|
|
|
|
|
(sql-make-alternate-buffer-name))))
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(list 'sql-connect (car conn))
|
|
|
|
|
t))
|
2010-07-20 21:56:55 -04:00
|
|
|
|
sql-connection-alist)
|
|
|
|
|
tail))
|
|
|
|
|
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Entry functions for different SQL interpreters.
|
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-product-interactive (&optional product new-name)
|
2010-07-22 20:59:43 -04:00
|
|
|
|
"Run PRODUCT interpreter as an inferior process.
|
|
|
|
|
|
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
|
|
|
|
If buffer exists and a process is running, just switch to buffer `*SQL*'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To specify the SQL product, prefix the call with
|
|
|
|
|
\\[universal-argument]. To set the buffer name as well, prefix
|
|
|
|
|
the call to \\[sql-product-interactive] with
|
|
|
|
|
\\[universal-argument] \\[universal-argument].
|
|
|
|
|
|
2010-07-22 20:59:43 -04:00
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
|
|
|
|
(interactive "P")
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
;; Handle universal arguments if specified
|
|
|
|
|
(when (not (or executing-kbd-macro noninteractive))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(when (>= (prefix-numeric-value product) 16)
|
|
|
|
|
(when (not new-name)
|
|
|
|
|
(setq new-name '(4)))
|
|
|
|
|
(setq product '(4))))
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
|
|
|
|
|
;; Get the value of product that we need
|
2010-07-22 20:59:43 -04:00
|
|
|
|
(setq product
|
|
|
|
|
(cond
|
2010-09-18 22:11:18 -04:00
|
|
|
|
((= (prefix-numeric-value product) 4) ; C-u, prompt for product
|
|
|
|
|
(sql-read-product "SQL product: " sql-product))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
((assoc product sql-product-alist) ; Product specified
|
|
|
|
|
product)
|
2010-07-22 20:59:43 -04:00
|
|
|
|
(t sql-product))) ; Default to sql-product
|
|
|
|
|
|
2018-02-16 15:16:15 -05:00
|
|
|
|
;; If we have a product and it has an interactive mode
|
2010-07-22 20:59:43 -04:00
|
|
|
|
(if product
|
|
|
|
|
(when (sql-get-product-feature product :sqli-comint-func)
|
2018-06-02 19:21:31 -04:00
|
|
|
|
;; If no new name specified or new name in buffer name,
|
|
|
|
|
;; try to pop to an active SQL interactive for the same product
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(let ((buf (sql-find-sqli-buffer product sql-connection)))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(if (and buf (or (not new-name)
|
|
|
|
|
(and (stringp new-name)
|
|
|
|
|
(string-match-p (regexp-quote new-name) buf))))
|
|
|
|
|
(sql-display-buffer buf)
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
|
|
|
|
;; We have a new name or sql-buffer doesn't exist or match
|
|
|
|
|
;; Start by remembering where we start
|
|
|
|
|
(let ((start-buffer (current-buffer))
|
2014-02-15 17:50:45 -05:00
|
|
|
|
new-sqli-buffer rpt)
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
|
|
|
|
;; Get credentials.
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(apply #'sql-get-login
|
|
|
|
|
(sql-get-product-feature product :sqli-login))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
|
|
|
|
;; Connect to database.
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(setq rpt (sql-make-progress-reporter nil "Login"))
|
2014-02-15 17:50:45 -05:00
|
|
|
|
|
2012-03-01 00:01:22 -05:00
|
|
|
|
(let ((sql-user (default-value 'sql-user))
|
|
|
|
|
(sql-password (default-value 'sql-password))
|
|
|
|
|
(sql-server (default-value 'sql-server))
|
|
|
|
|
(sql-database (default-value 'sql-database))
|
2014-09-08 08:38:53 -04:00
|
|
|
|
(sql-port (default-value 'sql-port))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(default-directory
|
|
|
|
|
(or sql-default-directory
|
|
|
|
|
default-directory)))
|
|
|
|
|
|
2019-02-18 23:15:54 -05:00
|
|
|
|
;; The password wallet returns a function which supplies the password.
|
|
|
|
|
(when (functionp sql-password)
|
|
|
|
|
(setq sql-password (funcall sql-password)))
|
|
|
|
|
|
2018-06-02 19:21:31 -04:00
|
|
|
|
;; Call the COMINT service
|
2012-03-01 00:01:22 -05:00
|
|
|
|
(funcall (sql-get-product-feature product :sqli-comint-func)
|
|
|
|
|
product
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-get-product-feature product :sqli-options)
|
2018-06-02 19:21:31 -04:00
|
|
|
|
;; generate a buffer name
|
2018-05-20 10:25:26 +03:00
|
|
|
|
(cond
|
2018-06-02 19:21:31 -04:00
|
|
|
|
((not new-name)
|
|
|
|
|
(sql-generate-unique-sqli-buffer-name product nil))
|
|
|
|
|
((consp new-name)
|
|
|
|
|
(sql-generate-unique-sqli-buffer-name product
|
2018-05-21 18:43:03 +03:00
|
|
|
|
(read-string
|
|
|
|
|
"Buffer name (\"*SQL: XXX*\"; enter `XXX'): "
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(sql-make-alternate-buffer-name product))))
|
|
|
|
|
((stringp new-name)
|
2019-04-24 20:59:25 -04:00
|
|
|
|
(if (or (string-prefix-p " " new-name)
|
|
|
|
|
(string-match-p "\\`[*].*[*]\\'" new-name))
|
|
|
|
|
new-name
|
|
|
|
|
(sql-generate-unique-sqli-buffer-name product new-name)))
|
2018-05-20 10:25:26 +03:00
|
|
|
|
(t
|
2019-04-24 20:59:25 -04:00
|
|
|
|
(sql-generate-unique-sqli-buffer-name product new-name)))))
|
2010-09-18 22:11:18 -04:00
|
|
|
|
|
|
|
|
|
;; Set SQLi mode.
|
|
|
|
|
(let ((sql-interactive-product product))
|
|
|
|
|
(sql-interactive-mode))
|
|
|
|
|
|
|
|
|
|
;; Set the new buffer name
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(setq new-sqli-buffer (current-buffer))
|
2020-12-09 08:13:41 +01:00
|
|
|
|
(setq-local sql-buffer (buffer-name new-sqli-buffer))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
|
|
|
|
;; Set `sql-buffer' in the start buffer
|
2010-09-18 22:11:18 -04:00
|
|
|
|
(with-current-buffer start-buffer
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(when (derived-mode-p 'sql-mode)
|
|
|
|
|
(setq sql-buffer (buffer-name new-sqli-buffer))
|
|
|
|
|
(run-hooks 'sql-set-sqli-hook)))
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
2013-01-14 22:21:56 -05:00
|
|
|
|
;; Make sure the connection is complete
|
|
|
|
|
;; (Sometimes start up can be slow)
|
|
|
|
|
;; and call the login hook
|
2014-02-15 17:50:45 -05:00
|
|
|
|
(let ((proc (get-buffer-process new-sqli-buffer))
|
|
|
|
|
(secs sql-login-delay)
|
|
|
|
|
(step 0.3))
|
2019-02-18 21:51:09 -05:00
|
|
|
|
(while (and proc
|
|
|
|
|
(memq (process-status proc) '(open run))
|
2014-02-15 17:50:45 -05:00
|
|
|
|
(or (accept-process-output proc step)
|
|
|
|
|
(<= 0.0 (setq secs (- secs step))))
|
2013-01-14 22:21:56 -05:00
|
|
|
|
(progn (goto-char (point-max))
|
2014-02-15 17:50:45 -05:00
|
|
|
|
(not (re-search-backward sql-prompt-regexp 0 t))))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(sql-progress-reporter-update rpt)))
|
2014-02-15 17:50:45 -05:00
|
|
|
|
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(when (re-search-backward sql-prompt-regexp nil t)
|
|
|
|
|
(run-hooks 'sql-login-hook))
|
|
|
|
|
|
2010-09-18 22:11:18 -04:00
|
|
|
|
;; All done.
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(sql-progress-reporter-done rpt)
|
2014-02-15 17:50:45 -05:00
|
|
|
|
(goto-char (point-max))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(let ((sql-display-sqli-buffer-function t))
|
|
|
|
|
(sql-display-buffer new-sqli-buffer))
|
|
|
|
|
(get-buffer new-sqli-buffer)))))
|
|
|
|
|
(user-error "No default SQL product defined: set `sql-product'")))
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
2021-10-19 00:18:17 -04:00
|
|
|
|
(defun sql-comint-automatic-password (_)
|
|
|
|
|
"Intercept password prompts when we know the password.
|
|
|
|
|
This must also do the job of detecting password prompts."
|
|
|
|
|
(when (and
|
|
|
|
|
sql-password
|
|
|
|
|
(not (string= "" sql-password)))
|
|
|
|
|
sql-password))
|
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint (product params &optional buf-name)
|
2010-07-22 20:59:43 -04:00
|
|
|
|
"Set up a comint buffer to run the SQL processor.
|
|
|
|
|
|
|
|
|
|
PRODUCT is the SQL product. PARAMS is a list of strings which are
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
passed as command line arguments. BUF-NAME is the name of the new
|
2018-06-02 19:21:31 -04:00
|
|
|
|
buffer. If nil, a name is chosen for it."
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
|
|
|
|
|
(let ((program (sql-get-product-feature product :sqli-program)))
|
2012-07-13 16:58:12 +02:00
|
|
|
|
;; Make sure we can find the program. `executable-find' does not
|
|
|
|
|
;; work for remote hosts; we suppress the check there.
|
|
|
|
|
(unless (or (file-remote-p default-directory)
|
|
|
|
|
(executable-find program))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Unable to locate SQL program `%s'" program))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
|
2012-07-13 16:58:12 +02:00
|
|
|
|
;; Make sure buffer name is unique.
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
;; if not specified, try *SQL* then *SQL-product*, then *SQL-product1*, ...
|
|
|
|
|
;; otherwise, use *buf-name*
|
|
|
|
|
(if buf-name
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(unless (or (string-prefix-p " " buf-name)
|
|
|
|
|
(string-match-p "\\`[*].*[*]\\'" buf-name))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(setq buf-name (concat "*" buf-name "*")))
|
2018-06-02 19:21:31 -04:00
|
|
|
|
(setq buf-name (sql-generate-unique-sqli-buffer-name product nil)))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(set-text-properties 0 (length buf-name) nil buf-name)
|
|
|
|
|
|
2021-10-19 00:18:17 -04:00
|
|
|
|
;; Create the buffer first, because we want to set it up before
|
|
|
|
|
;; comint starts to run.
|
|
|
|
|
(set-buffer (get-buffer-create buf-name))
|
|
|
|
|
;; Set up the automatic population of passwords, if supported.
|
|
|
|
|
(when (sql-get-product-feature product :password-in-comint)
|
|
|
|
|
(setq comint-password-function #'sql-comint-automatic-password))
|
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
;; Start the command interpreter in the buffer
|
|
|
|
|
;; PROC-NAME is BUF-NAME without enclosing asterisks
|
|
|
|
|
(let ((proc-name (replace-regexp-in-string "\\`[*]\\(.*\\)[*]\\'" "\\1" buf-name)))
|
|
|
|
|
(set-buffer
|
|
|
|
|
(apply #'make-comint-in-buffer
|
|
|
|
|
proc-name buf-name program nil params)))))
|
2010-07-22 20:59:43 -04:00
|
|
|
|
|
2000-07-27 20:06:37 +00:00
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-oracle (&optional buffer)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
"Run sqlplus by Oracle as an inferior process.
|
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
Interpreter used comes from variable `sql-oracle-program'. Login uses
|
|
|
|
|
the variables `sql-user', `sql-password', and `sql-database' as
|
2000-06-26 13:09:49 +00:00
|
|
|
|
defaults, if set. Additional command line parameters can be stored in
|
|
|
|
|
the list `sql-oracle-options'.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
1999-01-11 15:26:36 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-oracle]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
|
|
|
|
before \\[sql-oracle]. You can also specify this with \\[set-buffer-process-coding-system]
|
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'oracle buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-oracle (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to Oracle."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Produce user/password@database construct. Password without user
|
|
|
|
|
;; is meaningless; database without user/password is meaningless,
|
|
|
|
|
;; because "@param" will ask sqlplus to interpret the script
|
|
|
|
|
;; "param".
|
2013-01-14 22:21:56 -05:00
|
|
|
|
(let (parameter nlslang coding)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(if (not (string= "" sql-user))
|
|
|
|
|
(if (not (string= "" sql-password))
|
|
|
|
|
(setq parameter (concat sql-user "/" sql-password))
|
|
|
|
|
(setq parameter sql-user)))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
(if (and parameter (not (string= "" sql-database)))
|
|
|
|
|
(setq parameter (concat parameter "@" sql-database)))
|
2014-02-15 17:50:45 -05:00
|
|
|
|
;; options must appear before the logon parameters
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(if parameter
|
2014-02-15 17:50:45 -05:00
|
|
|
|
(setq parameter (append options (list parameter)))
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(setq parameter options))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product parameter buf-name)
|
2013-01-14 22:21:56 -05:00
|
|
|
|
;; Set process coding system to agree with the interpreter
|
|
|
|
|
(setq nlslang (or (getenv "NLS_LANG") "")
|
|
|
|
|
coding (dolist (cs
|
|
|
|
|
;; Are we missing any common NLS character sets
|
|
|
|
|
'(("US8PC437" . cp437)
|
|
|
|
|
("EL8PC737" . cp737)
|
|
|
|
|
("WE8PC850" . cp850)
|
|
|
|
|
("EE8PC852" . cp852)
|
|
|
|
|
("TR8PC857" . cp857)
|
|
|
|
|
("WE8PC858" . cp858)
|
|
|
|
|
("IS8PC861" . cp861)
|
|
|
|
|
("IW8PC1507" . cp862)
|
|
|
|
|
("N8PC865" . cp865)
|
|
|
|
|
("RU8PC866" . cp866)
|
|
|
|
|
("US7ASCII" . us-ascii)
|
|
|
|
|
("UTF8" . utf-8)
|
|
|
|
|
("AL32UTF8" . utf-8)
|
|
|
|
|
("AL16UTF16" . utf-16))
|
|
|
|
|
(or coding 'utf-8))
|
|
|
|
|
(when (string-match (format "\\.%s\\'" (car cs)) nlslang)
|
|
|
|
|
(setq coding (cdr cs)))))
|
2018-03-01 20:29:23 -05:00
|
|
|
|
(set-process-coding-system (get-buffer-process (current-buffer))
|
|
|
|
|
coding coding)))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(defun sql-oracle-save-settings (sqlbuf)
|
2012-12-06 12:29:30 -05:00
|
|
|
|
"Save most SQL*Plus settings so they may be reset by \\[sql-redirect]."
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Note: does not capture the following settings:
|
|
|
|
|
;;
|
|
|
|
|
;; APPINFO
|
|
|
|
|
;; BTITLE
|
|
|
|
|
;; COMPATIBILITY
|
|
|
|
|
;; COPYTYPECHECK
|
|
|
|
|
;; MARKUP
|
|
|
|
|
;; RELEASE
|
|
|
|
|
;; REPFOOTER
|
|
|
|
|
;; REPHEADER
|
|
|
|
|
;; SQLPLUSCOMPATIBILITY
|
|
|
|
|
;; TTITLE
|
|
|
|
|
;; USER
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
(append
|
2013-03-11 00:09:37 -04:00
|
|
|
|
;; (apply #'concat (append
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; '("SET")
|
|
|
|
|
|
|
|
|
|
;; option value...
|
|
|
|
|
(sql-redirect-value
|
|
|
|
|
sqlbuf
|
|
|
|
|
(concat "SHOW ARRAYSIZE AUTOCOMMIT AUTOPRINT AUTORECOVERY AUTOTRACE"
|
|
|
|
|
" CMDSEP COLSEP COPYCOMMIT DESCRIBE ECHO EDITFILE EMBEDDED"
|
|
|
|
|
" ESCAPE FLAGGER FLUSH HEADING INSTANCE LINESIZE LNO LOBOFFSET"
|
|
|
|
|
" LOGSOURCE LONG LONGCHUNKSIZE NEWPAGE NULL NUMFORMAT NUMWIDTH"
|
|
|
|
|
" PAGESIZE PAUSE PNO RECSEP SERVEROUTPUT SHIFTINOUT SHOWMODE"
|
|
|
|
|
" SPOOL SQLBLANKLINES SQLCASE SQLCODE SQLCONTINUE SQLNUMBER"
|
|
|
|
|
" SQLPROMPT SUFFIX TAB TERMOUT TIMING TRIMOUT TRIMSPOOL VERIFY")
|
|
|
|
|
"^.+$"
|
|
|
|
|
"SET \\&")
|
|
|
|
|
|
|
|
|
|
;; option "c" (hex xx)
|
|
|
|
|
(sql-redirect-value
|
|
|
|
|
sqlbuf
|
|
|
|
|
(concat "SHOW BLOCKTERMINATOR CONCAT DEFINE SQLPREFIX SQLTERMINATOR"
|
|
|
|
|
" UNDERLINE HEADSEP RECSEPCHAR")
|
|
|
|
|
"^\\(.+\\) (hex ..)$"
|
|
|
|
|
"SET \\1")
|
|
|
|
|
|
2011-12-18 22:21:24 -08:00
|
|
|
|
;; FEEDBACK ON for 99 or more rows
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; feedback OFF
|
|
|
|
|
(sql-redirect-value
|
|
|
|
|
sqlbuf
|
|
|
|
|
"SHOW FEEDBACK"
|
|
|
|
|
"^\\(?:FEEDBACK ON for \\([[:digit:]]+\\) or more rows\\|feedback \\(OFF\\)\\)"
|
|
|
|
|
"SET FEEDBACK \\1\\2")
|
|
|
|
|
|
|
|
|
|
;; wrap : lines will be wrapped
|
|
|
|
|
;; wrap : lines will be truncated
|
|
|
|
|
(list (concat "SET WRAP "
|
|
|
|
|
(if (string=
|
|
|
|
|
(car (sql-redirect-value
|
|
|
|
|
sqlbuf
|
|
|
|
|
"SHOW WRAP"
|
|
|
|
|
"^wrap : lines will be \\(wrapped\\|truncated\\)" 1))
|
|
|
|
|
"wrapped")
|
|
|
|
|
"ON" "OFF")))))
|
|
|
|
|
|
|
|
|
|
(defun sql-oracle-restore-settings (sqlbuf saved-settings)
|
|
|
|
|
"Restore the SQL*Plus settings in SAVED-SETTINGS."
|
|
|
|
|
|
|
|
|
|
;; Remove any settings that haven't changed
|
|
|
|
|
(mapc
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(lambda (one-cur-setting)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(setq saved-settings (delete one-cur-setting saved-settings)))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-oracle-save-settings sqlbuf))
|
|
|
|
|
|
|
|
|
|
;; Restore the changed settings
|
|
|
|
|
(sql-redirect sqlbuf saved-settings))
|
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-oracle--list-object-name (obj-name)
|
|
|
|
|
(format "CASE WHEN REGEXP_LIKE (%s, q'/^[A-Z0-9_#$]+$/','c') THEN %s ELSE '\"'|| %s ||'\"' END "
|
|
|
|
|
obj-name obj-name obj-name))
|
|
|
|
|
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(defun sql-oracle-list-all (sqlbuf outbuf enhanced _table-name)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
;; Query from USER_OBJECTS or ALL_OBJECTS
|
|
|
|
|
(let ((settings (sql-oracle-save-settings sqlbuf))
|
|
|
|
|
(simple-sql
|
|
|
|
|
(concat
|
|
|
|
|
"SELECT INITCAP(x.object_type) AS SQL_EL_TYPE "
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
", " (sql-oracle--list-object-name "x.object_name") " AS SQL_EL_NAME "
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"FROM user_objects x "
|
|
|
|
|
"WHERE x.object_type NOT LIKE '%% BODY' "
|
|
|
|
|
"ORDER BY 2, 1;"))
|
|
|
|
|
(enhanced-sql
|
|
|
|
|
(concat
|
|
|
|
|
"SELECT INITCAP(x.object_type) AS SQL_EL_TYPE "
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
", " (sql-oracle--list-object-name "x.owner")
|
|
|
|
|
" ||'.'|| " (sql-oracle--list-object-name "x.object_name") " AS SQL_EL_NAME "
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"FROM all_objects x "
|
|
|
|
|
"WHERE x.object_type NOT LIKE '%% BODY' "
|
|
|
|
|
"AND x.owner <> 'SYS' "
|
|
|
|
|
"ORDER BY 2, 1;")))
|
|
|
|
|
|
|
|
|
|
(sql-redirect sqlbuf
|
|
|
|
|
(concat "SET LINESIZE 80 PAGESIZE 50000 TRIMOUT ON"
|
|
|
|
|
" TAB OFF TIMING OFF FEEDBACK OFF"))
|
|
|
|
|
|
|
|
|
|
(sql-redirect sqlbuf
|
|
|
|
|
(list "COLUMN SQL_EL_TYPE HEADING \"Type\" FORMAT A19"
|
|
|
|
|
"COLUMN SQL_EL_NAME HEADING \"Name\""
|
|
|
|
|
(format "COLUMN SQL_EL_NAME FORMAT A%d"
|
|
|
|
|
(if enhanced 60 35))))
|
|
|
|
|
|
|
|
|
|
(sql-redirect sqlbuf
|
|
|
|
|
(if enhanced enhanced-sql simple-sql)
|
|
|
|
|
outbuf)
|
|
|
|
|
|
|
|
|
|
(sql-redirect sqlbuf
|
|
|
|
|
'("COLUMN SQL_EL_NAME CLEAR"
|
|
|
|
|
"COLUMN SQL_EL_TYPE CLEAR"))
|
|
|
|
|
|
|
|
|
|
(sql-oracle-restore-settings sqlbuf settings)))
|
|
|
|
|
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(defun sql-oracle-list-table (sqlbuf outbuf _enhanced table-name)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"Implements :list-table under Oracle."
|
|
|
|
|
(let ((settings (sql-oracle-save-settings sqlbuf)))
|
|
|
|
|
|
|
|
|
|
(sql-redirect sqlbuf
|
|
|
|
|
(format
|
|
|
|
|
(concat "SET LINESIZE %d PAGESIZE 50000"
|
|
|
|
|
" DESCRIBE DEPTH 1 LINENUM OFF INDENT ON")
|
|
|
|
|
(max 65 (min 120 (window-width)))))
|
|
|
|
|
|
|
|
|
|
(sql-redirect sqlbuf (format "DESCRIBE %s" table-name)
|
|
|
|
|
outbuf)
|
|
|
|
|
|
|
|
|
|
(sql-oracle-restore-settings sqlbuf settings)))
|
|
|
|
|
|
|
|
|
|
(defcustom sql-oracle-completion-types '("FUNCTION" "PACKAGE" "PROCEDURE"
|
|
|
|
|
"SEQUENCE" "SYNONYM" "TABLE" "TRIGGER"
|
|
|
|
|
"TYPE" "VIEW")
|
|
|
|
|
"List of object types to include for completion under Oracle.
|
|
|
|
|
|
|
|
|
|
See the distinct values in ALL_OBJECTS.OBJECT_TYPE for possible values."
|
|
|
|
|
:version "24.1"
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type '(repeat string))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
|
|
|
|
(defun sql-oracle-completion-object (sqlbuf schema)
|
|
|
|
|
(sql-redirect-value
|
|
|
|
|
sqlbuf
|
|
|
|
|
(concat
|
|
|
|
|
"SELECT CHR(1)||"
|
|
|
|
|
(if schema
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(concat "CASE WHEN REGEXP_LIKE (owner, q'/^[A-Z0-9_#$]+$/','c') THEN owner ELSE '\"'|| owner ||'\"' END "
|
|
|
|
|
"||'.'||"
|
|
|
|
|
"CASE WHEN REGEXP_LIKE (object_name, q'/^[A-Z0-9_#$]+$/','c') THEN object_name ELSE '\"'|| object_name ||'\"' END "
|
|
|
|
|
" AS o FROM all_objects "
|
|
|
|
|
(format "WHERE owner = %s AND "
|
|
|
|
|
(sql-str-literal (if (string-match "^[\"]\\(.+\\)[\"]$" schema)
|
|
|
|
|
(match-string 1 schema) (upcase schema)))))
|
|
|
|
|
(concat "CASE WHEN REGEXP_LIKE (object_name, q'/^[A-Z0-9_#$]+$/','c') THEN object_name ELSE '\"'|| object_name ||'\"' END "
|
|
|
|
|
" AS o FROM user_objects WHERE "))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
"temporary = 'N' AND generated = 'N' AND secondary = 'N' AND "
|
|
|
|
|
"object_type IN ("
|
|
|
|
|
(mapconcat (function sql-str-literal) sql-oracle-completion-types ",")
|
|
|
|
|
");")
|
|
|
|
|
"^[\001]\\(.+\\)$" 1))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
2000-07-27 20:06:37 +00:00
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-sybase (&optional buffer)
|
2010-05-14 15:31:36 +02:00
|
|
|
|
"Run isql by Sybase as an inferior process.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-sybase-program'. Login uses
|
2000-10-18 14:38:55 +00:00
|
|
|
|
the variables `sql-server', `sql-user', `sql-password', and
|
2001-03-05 09:47:59 +00:00
|
|
|
|
`sql-database' as defaults, if set. Additional command line parameters
|
|
|
|
|
can be stored in the list `sql-sybase-options'.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
1999-01-11 15:26:36 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-sybase]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
|
|
|
|
before \\[sql-sybase]. You can also specify this with \\[set-buffer-process-coding-system]
|
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'sybase buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-sybase (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to Sybase."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Put all parameters to the program (if defined) in a list and call
|
|
|
|
|
;; make-comint.
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(let ((params
|
|
|
|
|
(append
|
|
|
|
|
(if (not (string= "" sql-user))
|
|
|
|
|
(list "-U" sql-user))
|
|
|
|
|
(if (not (string= "" sql-password))
|
|
|
|
|
(list "-P" sql-password))
|
|
|
|
|
(if (not (string= "" sql-database))
|
|
|
|
|
(list "-D" sql-database))
|
|
|
|
|
(if (not (string= "" sql-server))
|
|
|
|
|
(list "-S" sql-server))
|
|
|
|
|
options)))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product params buf-name)))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-07-27 20:06:37 +00:00
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-informix (&optional buffer)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
"Run dbaccess by Informix as an inferior process.
|
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-informix-program'. Login uses
|
|
|
|
|
the variable `sql-database' as default, if set.
|
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
1999-01-11 15:26:36 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-informix]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
|
|
|
|
before \\[sql-informix]. You can also specify this with \\[set-buffer-process-coding-system]
|
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'informix buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-informix (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to Informix."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; username and password are ignored.
|
2010-05-09 22:07:58 -04:00
|
|
|
|
(let ((db (if (string= "" sql-database)
|
|
|
|
|
"-"
|
|
|
|
|
(if (string= "" sql-server)
|
|
|
|
|
sql-database
|
|
|
|
|
(concat sql-database "@" sql-server)))))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product (append `(,db "-") options) buf-name)))
|
1999-02-06 05:09:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-06-17 20:58:37 +00:00
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-sqlite (&optional buffer)
|
2003-06-17 20:58:37 +00:00
|
|
|
|
"Run sqlite as an inferior process.
|
|
|
|
|
|
|
|
|
|
SQLite is free software.
|
|
|
|
|
|
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-sqlite-program'. Login uses
|
|
|
|
|
the variables `sql-user', `sql-password', `sql-database', and
|
|
|
|
|
`sql-server' as defaults, if set. Additional command line parameters
|
|
|
|
|
can be stored in the list `sql-sqlite-options'.
|
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
2003-06-17 20:58:37 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-sqlite]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
2003-06-17 20:58:37 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
|
|
|
|
before \\[sql-sqlite]. You can also specify this with \\[set-buffer-process-coding-system]
|
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'sqlite buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-sqlite (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to SQLite."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Put all parameters to the program (if defined) in a list and call
|
|
|
|
|
;; make-comint.
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(let ((params
|
|
|
|
|
(append options
|
|
|
|
|
(if (not (string= "" sql-database))
|
|
|
|
|
`(,(expand-file-name sql-database))))))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product params buf-name)))
|
2003-06-17 20:58:37 +00:00
|
|
|
|
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(defun sql-sqlite-completion-object (sqlbuf _schema)
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-redirect-value sqlbuf ".tables" "\\sw\\(?:\\sw\\|\\s_\\)*" 0))
|
|
|
|
|
|
2003-06-17 20:58:37 +00:00
|
|
|
|
|
|
|
|
|
|
2000-07-27 20:06:37 +00:00
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-mysql (&optional buffer)
|
1999-02-06 05:09:31 +00:00
|
|
|
|
"Run mysql by TcX as an inferior process.
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
2001-10-29 09:35:04 +00:00
|
|
|
|
Mysql versions 3.23 and up are free software.
|
1999-02-06 05:09:31 +00:00
|
|
|
|
|
1999-02-06 05:12:54 +00:00
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
1999-02-06 05:09:31 +00:00
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-mysql-program'. Login uses
|
1999-02-13 12:04:00 +00:00
|
|
|
|
the variables `sql-user', `sql-password', `sql-database', and
|
2001-03-05 09:47:59 +00:00
|
|
|
|
`sql-server' as defaults, if set. Additional command line parameters
|
|
|
|
|
can be stored in the list `sql-mysql-options'.
|
1999-02-06 05:09:31 +00:00
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
1999-02-06 05:09:31 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-mysql]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
1999-02-06 05:09:31 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
1999-02-13 12:04:00 +00:00
|
|
|
|
before \\[sql-mysql]. You can also specify this with \\[set-buffer-process-coding-system]
|
1999-02-06 05:09:31 +00:00
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'mysql buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-mysql (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to MySQL."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Put all parameters to the program (if defined) in a list and call
|
|
|
|
|
;; make-comint.
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(let ((params
|
|
|
|
|
(append
|
|
|
|
|
options
|
|
|
|
|
(if (not (string= "" sql-user))
|
|
|
|
|
(list (concat "--user=" sql-user)))
|
|
|
|
|
(if (not (string= "" sql-password))
|
|
|
|
|
(list (concat "--password=" sql-password)))
|
|
|
|
|
(if (not (= 0 sql-port))
|
|
|
|
|
(list (concat "--port=" (number-to-string sql-port))))
|
|
|
|
|
(if (not (string= "" sql-server))
|
|
|
|
|
(list (concat "--host=" sql-server)))
|
|
|
|
|
(if (not (string= "" sql-database))
|
|
|
|
|
(list sql-database)))))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product params buf-name)))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2018-06-10 20:01:36 -04:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun sql-mariadb (&optional buffer)
|
|
|
|
|
"Run mysql by MariaDB as an inferior process.
|
|
|
|
|
|
|
|
|
|
MariaDB is free software.
|
|
|
|
|
|
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-mariadb-program'. Login uses
|
|
|
|
|
the variables `sql-user', `sql-password', `sql-database', and
|
|
|
|
|
`sql-server' as defaults, if set. Additional command line parameters
|
|
|
|
|
can be stored in the list `sql-mariadb-options'.
|
|
|
|
|
|
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-mariadb]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
|
|
|
|
before \\[sql-mariadb]. You can also specify this with \\[set-buffer-process-coding-system]
|
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'mariadb buffer))
|
|
|
|
|
|
|
|
|
|
(defun sql-comint-mariadb (product options &optional buf-name)
|
|
|
|
|
"Create comint buffer and connect to MariaDB.
|
|
|
|
|
|
|
|
|
|
Use the MySQL comint driver since the two are compatible."
|
|
|
|
|
(sql-comint-mysql product options buf-name))
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
2000-07-27 20:06:37 +00:00
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-solid (&optional buffer)
|
1999-02-13 12:04:00 +00:00
|
|
|
|
"Run solsql by Solid as an inferior process.
|
|
|
|
|
|
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-solid-program'. Login uses
|
|
|
|
|
the variables `sql-user', `sql-password', and `sql-server' as
|
|
|
|
|
defaults, if set.
|
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
1999-02-13 12:04:00 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-solid]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
|
|
|
|
before \\[sql-solid]. You can also specify this with \\[set-buffer-process-coding-system]
|
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'solid buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-solid (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to Solid."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Put all parameters to the program (if defined) in a list and call
|
|
|
|
|
;; make-comint.
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(let ((params
|
|
|
|
|
(append
|
|
|
|
|
(if (not (string= "" sql-server))
|
|
|
|
|
(list sql-server))
|
|
|
|
|
;; It only makes sense if both username and password are there.
|
|
|
|
|
(if (not (or (string= "" sql-user)
|
|
|
|
|
(string= "" sql-password)))
|
|
|
|
|
(list sql-user sql-password))
|
|
|
|
|
options)))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product params buf-name)))
|
1999-02-13 12:04:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-07-27 20:06:37 +00:00
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-ingres (&optional buffer)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
"Run sql by Ingres as an inferior process.
|
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-ingres-program'. Login uses
|
|
|
|
|
the variable `sql-database' as default, if set.
|
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
1999-01-11 15:26:36 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-ingres]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
|
|
|
|
before \\[sql-ingres]. You can also specify this with \\[set-buffer-process-coding-system]
|
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'ingres buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-ingres (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to Ingres."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; username and password are ignored.
|
2010-07-18 14:44:32 -04:00
|
|
|
|
(sql-comint product
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(append (if (string= "" sql-database)
|
|
|
|
|
nil
|
|
|
|
|
(list sql-database))
|
|
|
|
|
options)
|
|
|
|
|
buf-name))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-07-27 20:06:37 +00:00
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-ms (&optional buffer)
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
"Run osql by Microsoft as an inferior process.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-ms-program'. Login uses the
|
1999-02-13 12:04:00 +00:00
|
|
|
|
variables `sql-user', `sql-password', `sql-database', and `sql-server'
|
2002-11-21 08:32:06 +00:00
|
|
|
|
as defaults, if set. Additional command line parameters can be stored
|
|
|
|
|
in the list `sql-ms-options'.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
1999-01-11 15:26:36 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-ms]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
1999-02-13 12:04:00 +00:00
|
|
|
|
before \\[sql-ms]. You can also specify this with \\[set-buffer-process-coding-system]
|
1999-01-11 15:26:36 +00:00
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'ms buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-ms (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to Microsoft SQL Server."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Put all parameters to the program (if defined) in a list and call
|
|
|
|
|
;; make-comint.
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(let ((params
|
|
|
|
|
(append
|
|
|
|
|
(if (not (string= "" sql-user))
|
|
|
|
|
(list "-U" sql-user))
|
|
|
|
|
(if (not (string= "" sql-database))
|
|
|
|
|
(list "-d" sql-database))
|
|
|
|
|
(if (not (string= "" sql-server))
|
|
|
|
|
(list "-S" sql-server))
|
|
|
|
|
options)))
|
|
|
|
|
(setq params
|
|
|
|
|
(if (not (string= "" sql-password))
|
|
|
|
|
`("-P" ,sql-password ,@params)
|
|
|
|
|
(if (string= "" sql-user)
|
|
|
|
|
;; If neither user nor password is provided, use system
|
|
|
|
|
;; credentials.
|
|
|
|
|
`("-E" ,@params)
|
|
|
|
|
;; If -P is passed to ISQL as the last argument without a
|
|
|
|
|
;; password, it's considered null.
|
|
|
|
|
`(,@params "-P"))))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product params buf-name)))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-postgres (&optional buffer)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
"Run psql by Postgres as an inferior process.
|
|
|
|
|
|
1999-02-13 12:04:00 +00:00
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-postgres-program'. Login uses
|
1999-02-19 04:27:18 +00:00
|
|
|
|
the variables `sql-database' and `sql-server' as default, if set.
|
2001-03-05 09:47:59 +00:00
|
|
|
|
Additional command line parameters can be stored in the list
|
|
|
|
|
`sql-postgres-options'.
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
1999-01-11 15:26:36 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-postgres]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
|
|
|
|
before \\[sql-postgres]. You can also specify this with \\[set-buffer-process-coding-system]
|
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
1999-09-29 09:51:59 +00:00
|
|
|
|
`default-process-coding-system'. If your output lines end with ^M,
|
1999-01-11 15:26:36 +00:00
|
|
|
|
your might try undecided-dos as a coding system. If this doesn't help,
|
|
|
|
|
Try to set `comint-output-filter-functions' like this:
|
|
|
|
|
|
2019-11-08 17:07:13 -08:00
|
|
|
|
\(add-hook \\='comint-output-filter-functions #\\='comint-strip-ctrl-m \\='append)
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'postgres buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-postgres (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to Postgres."
|
2012-12-06 12:29:30 -05:00
|
|
|
|
;; username and password are ignored. Mark Stosberg suggests to add
|
|
|
|
|
;; the database at the end. Jason Beegan suggests using --pset and
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; pager=off instead of \\o|cat. The later was the solution by
|
|
|
|
|
;; Gregor Zych. Jason's suggestion is the default value for
|
|
|
|
|
;; sql-postgres-options.
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(let ((params
|
|
|
|
|
(append
|
|
|
|
|
(if (not (= 0 sql-port))
|
|
|
|
|
(list "-p" (number-to-string sql-port)))
|
|
|
|
|
(if (not (string= "" sql-user))
|
|
|
|
|
(list "-U" sql-user))
|
|
|
|
|
(if (not (string= "" sql-server))
|
|
|
|
|
(list "-h" sql-server))
|
|
|
|
|
options
|
|
|
|
|
(if (not (string= "" sql-database))
|
|
|
|
|
(list sql-database)))))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product params buf-name)))
|
1999-01-11 15:26:36 +00:00
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(defun sql-postgres-completion-object (sqlbuf schema)
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(sql-redirect sqlbuf "\\t on")
|
|
|
|
|
(let ((aligned
|
|
|
|
|
(string= "aligned"
|
|
|
|
|
(car (sql-redirect-value
|
|
|
|
|
sqlbuf "\\a"
|
|
|
|
|
"Output format is \\(.*\\)[.]$" 1)))))
|
|
|
|
|
(when aligned
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
(sql-redirect sqlbuf "\\a"))
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(let* ((fs (or (car (sql-redirect-value
|
|
|
|
|
sqlbuf "\\f" "Field separator is \"\\(.\\)[.]$" 1))
|
|
|
|
|
"|"))
|
|
|
|
|
(re (concat "^\\([^" fs "]*\\)" fs "\\([^" fs "]*\\)"
|
|
|
|
|
fs "[^" fs "]*" fs "[^" fs "]*$"))
|
|
|
|
|
(cl (if (not schema)
|
|
|
|
|
(sql-redirect-value sqlbuf "\\d" re '(1 2))
|
|
|
|
|
(append (sql-redirect-value
|
|
|
|
|
sqlbuf (format "\\dt %s.*" schema) re '(1 2))
|
|
|
|
|
(sql-redirect-value
|
|
|
|
|
sqlbuf (format "\\dv %s.*" schema) re '(1 2))
|
|
|
|
|
(sql-redirect-value
|
|
|
|
|
sqlbuf (format "\\ds %s.*" schema) re '(1 2))))))
|
|
|
|
|
|
|
|
|
|
;; Restore tuples and alignment to what they were.
|
|
|
|
|
(sql-redirect sqlbuf "\\t off")
|
|
|
|
|
(when (not aligned)
|
|
|
|
|
(sql-redirect sqlbuf "\\a"))
|
|
|
|
|
|
|
|
|
|
;; Return the list of table names (public schema name can be omitted)
|
2016-07-26 17:08:29 +02:00
|
|
|
|
(mapcar (lambda (tbl)
|
2013-03-11 00:09:37 -04:00
|
|
|
|
(if (string= (car tbl) "public")
|
2016-01-30 22:03:57 -05:00
|
|
|
|
(format "\"%s\"" (cadr tbl))
|
|
|
|
|
(format "\"%s\".\"%s\"" (car tbl) (cadr tbl))))
|
2012-12-06 12:29:30 -05:00
|
|
|
|
cl))))
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
|
2001-03-06 12:26:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-interbase (&optional buffer)
|
2001-03-06 12:26:35 +00:00
|
|
|
|
"Run isql by Interbase as an inferior process.
|
|
|
|
|
|
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-interbase-program'. Login
|
|
|
|
|
uses the variables `sql-user', `sql-password', and `sql-database' as
|
|
|
|
|
defaults, if set.
|
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
2001-03-06 12:26:35 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-interbase]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
2001-03-06 12:26:35 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
|
|
|
|
before \\[sql-interbase]. You can also specify this with \\[set-buffer-process-coding-system]
|
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'interbase buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-interbase (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to Interbase."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Put all parameters to the program (if defined) in a list and call
|
|
|
|
|
;; make-comint.
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(let ((params
|
|
|
|
|
(append
|
|
|
|
|
(if (not (string= "" sql-database))
|
|
|
|
|
(list sql-database)) ; Add to the front!
|
|
|
|
|
(if (not (string= "" sql-password))
|
|
|
|
|
(list "-p" sql-password))
|
|
|
|
|
(if (not (string= "" sql-user))
|
|
|
|
|
(list "-u" sql-user))
|
|
|
|
|
options)))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product params buf-name)))
|
2001-03-06 12:26:35 +00:00
|
|
|
|
|
2001-04-20 10:03:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-db2 (&optional buffer)
|
2001-04-20 10:03:48 +00:00
|
|
|
|
"Run db2 by IBM as an inferior process.
|
|
|
|
|
|
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-db2-program'. There is not
|
|
|
|
|
automatic login.
|
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
2001-04-20 10:03:48 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
2001-08-20 10:02:07 +00:00
|
|
|
|
If you use \\[sql-accumulate-and-indent] to send multiline commands to
|
|
|
|
|
db2, newlines will be escaped if necessary. If you don't want that, set
|
|
|
|
|
`comint-input-sender' back to `comint-simple-send' by writing an after
|
|
|
|
|
advice. See the elisp manual for more information.
|
2001-04-20 10:03:48 +00:00
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-db2]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
2001-04-20 10:03:48 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the process, use \\[universal-coding-system-argument]
|
|
|
|
|
before \\[sql-db2]. You can also specify this with \\[set-buffer-process-coding-system]
|
|
|
|
|
in the SQL buffer, after you start the process.
|
|
|
|
|
The default comes from `process-coding-system-alist' and
|
|
|
|
|
`default-process-coding-system'.
|
|
|
|
|
|
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'db2 buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-db2 (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to DB2."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Put all parameters to the program (if defined) in a list and call
|
|
|
|
|
;; make-comint.
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product options buf-name))
|
2001-04-20 10:03:48 +00:00
|
|
|
|
|
2002-11-21 08:32:06 +00:00
|
|
|
|
;;;###autoload
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(defun sql-linter (&optional buffer)
|
2002-11-21 08:32:06 +00:00
|
|
|
|
"Run inl by RELEX as an inferior process.
|
|
|
|
|
|
|
|
|
|
If buffer `*SQL*' exists but no process is running, make a new process.
|
|
|
|
|
If buffer exists and a process is running, just switch to buffer
|
|
|
|
|
`*SQL*'.
|
|
|
|
|
|
|
|
|
|
Interpreter used comes from variable `sql-linter-program' - usually `inl'.
|
|
|
|
|
Login uses the variables `sql-user', `sql-password', `sql-database' and
|
|
|
|
|
`sql-server' as defaults, if set. Additional command line parameters
|
2010-05-09 22:07:58 -04:00
|
|
|
|
can be stored in the list `sql-linter-options'. Run inl -h to get help on
|
2002-11-21 08:32:06 +00:00
|
|
|
|
parameters.
|
|
|
|
|
|
|
|
|
|
`sql-database' is used to set the LINTER_MBX environment variable for
|
|
|
|
|
local connections, `sql-server' refers to the server name from the
|
|
|
|
|
`nodetab' file for the network connection (dbc_tcp or friends must run
|
|
|
|
|
for this to work). If `sql-password' is an empty string, inl will use
|
|
|
|
|
an empty password.
|
|
|
|
|
|
2010-04-24 04:59:23 +02:00
|
|
|
|
The buffer is put in SQL interactive mode, giving commands for sending
|
2002-11-21 08:32:06 +00:00
|
|
|
|
input. See `sql-interactive-mode'.
|
|
|
|
|
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
To set the buffer name directly, use \\[universal-argument]
|
|
|
|
|
before \\[sql-linter]. Once session has started,
|
|
|
|
|
\\[sql-rename-buffer] can be called separately to rename the
|
|
|
|
|
buffer.
|
|
|
|
|
|
2002-11-21 08:32:06 +00:00
|
|
|
|
\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
|
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6
(sql-dialect): Synonym for "sql-product".
(sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
(sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
Set "sql-buffer" to buffer name not buffer object so multiple sql
interactive buffers work properly. Reverts misguided changes in
earlier work.
(sql-comint): Make sure different buffer name is used if "*SQL*"
buffer is for a different product.
(sql-make-alternate-buffer-name): Fix bug with "sql-database"
login param.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
Accept new buffer name or prompt for one.
(sql-port): Default to zero.
(sql-comint-mysql): Handle "sql-port" as a numeric.
(sql-port-history): Delete unused variable.
(sql-get-login): Default "sql-port" to a number.
(sql-product-alist): Correct Postgres prompt and terminator
regexp.
(sql-sqlite-program): Dynamically detect presence of "sqlite" or
"sqlite3" executables.
(sql-sqlite-login-params): Add "*.sqlite[23]?" database name
pattern.
(sql-buffer-live-p): New function.
(sql-mode-menu, sql-send-string): Use it.
(sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
syntax pattern.
(sql-mode-postgres-font-lock-keywords): Support Postgres V9.
(sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
2010-09-10 23:17:02 -04:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'linter buffer))
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-linter (product options &optional buf-name)
|
2010-05-09 22:07:58 -04:00
|
|
|
|
"Create comint buffer and connect to Linter."
|
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
2003-08-18 17:29:23 +00:00
|
|
|
|
;; Put all parameters to the program (if defined) in a list and call
|
|
|
|
|
;; make-comint.
|
2012-12-06 12:29:30 -05:00
|
|
|
|
(let* ((login
|
|
|
|
|
(if (not (string= "" sql-user))
|
|
|
|
|
(concat sql-user "/" sql-password)))
|
|
|
|
|
(params
|
|
|
|
|
(append
|
|
|
|
|
(if (not (string= "" sql-server))
|
|
|
|
|
(list "-n" sql-server))
|
|
|
|
|
(list "-u" login)
|
|
|
|
|
options)))
|
|
|
|
|
(cl-letf (((getenv "LINTER_MBX")
|
|
|
|
|
(unless (string= "" sql-database) sql-database)))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(sql-comint product params buf-name))))
|
2002-11-21 08:32:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-12 15:57:40 -04:00
|
|
|
|
(defcustom sql-vertica-program "vsql"
|
|
|
|
|
"Command to start the Vertica client."
|
2014-09-29 14:14:08 -04:00
|
|
|
|
:version "25.1"
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'file)
|
2014-09-12 15:57:40 -04:00
|
|
|
|
|
|
|
|
|
(defcustom sql-vertica-options '("-P" "pager=off")
|
|
|
|
|
"List of additional options for `sql-vertica-program'.
|
|
|
|
|
The default value disables the internal pager."
|
2014-09-29 14:14:08 -04:00
|
|
|
|
:version "25.1"
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type '(repeat string))
|
2014-09-12 15:57:40 -04:00
|
|
|
|
|
|
|
|
|
(defcustom sql-vertica-login-params '(user password database server)
|
|
|
|
|
"List of login parameters needed to connect to Vertica."
|
2014-09-29 14:14:08 -04:00
|
|
|
|
:version "25.1"
|
2020-03-14 15:39:31 -04:00
|
|
|
|
:type 'sql-login-params)
|
2014-09-12 15:57:40 -04:00
|
|
|
|
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
(defun sql-comint-vertica (product options &optional buf-name)
|
2014-09-12 15:57:40 -04:00
|
|
|
|
"Create comint buffer and connect to Vertica."
|
|
|
|
|
(sql-comint product
|
|
|
|
|
(nconc
|
|
|
|
|
(and (not (string= "" sql-server))
|
|
|
|
|
(list "-h" sql-server))
|
|
|
|
|
(and (not (string= "" sql-database))
|
|
|
|
|
(list "-d" sql-database))
|
|
|
|
|
(and (not (string= "" sql-password))
|
|
|
|
|
(list "-w" sql-password))
|
|
|
|
|
(and (not (string= "" sql-user))
|
|
|
|
|
(list "-U" sql-user))
|
* lisp/progmodes/sql.el: Version 3.6
(sql-login-params): Added :must-match for completition of
`server' and `database' login parameters.
(sql-sqlite-login-params, sql-postgres-login-params): Set
:must-match to `confirm'.
(sql-get-login-ext): Use :must-match value to control
`read-file-name' or `completing-read'.
(sql-connect): Added optional BUF-NAME parameter; Reworked
connection variable processing; Pass buffer name to
`sql-product-interactive'.
(sql-product-interactive): Pass buffer name along.
(sql-comint): Add optional BUF-NAME and calculate reasonable default.
(sql-comint-oracle, sql-sybase-comint, sql-comint-informix)
(sql-comint-sqlite, sql-comint-mysql, sql-comint-solid)
(sql-comint-ingres, sql-comint-ms, sql-comint-postgres)
(sql-comint-interbase, sql-comint-db2, sql-comint-linter)
(sql-comint-vertica): Add optional BUF-NAME, pass to
`sql-comint'.
(sql-oracle--list-oracle-name): New function.
(sql-oracle-list-all): Use it.
(sql-oracle-completion-object): Enhanced.
2017-03-20 23:26:53 -04:00
|
|
|
|
options)
|
|
|
|
|
buf-name))
|
2014-09-12 15:57:40 -04:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun sql-vertica (&optional buffer)
|
|
|
|
|
"Run vsql as an inferior process."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(sql-product-interactive 'vertica buffer))
|
|
|
|
|
|
|
|
|
|
|
1999-01-11 15:26:36 +00:00
|
|
|
|
(provide 'sql)
|
|
|
|
|
|
* progmodes/sql.el: Version 3.0
(sql-product-alist): Added product :completion-object,
:completion-column, and :statement attributes.
(sql-mode-menu, sql-interactive-mode-map): Fixed List entries.
(sql-mode-syntax-table): Mark all punctuation.
(sql-font-lock-keywords-builder): Temporarily removed fallback on
ansi keywords.
(sql-regexp-abbrev, sql-regexp-abbrev-list): New functions.
(sql-mode-oracle-font-lock-keywords): Improved.
(sql-oracle-show-reserved-words): New function for development.
(sql-product-font-lock): Simplify for source code buffers.
(sql-product-syntax-table, sql-product-font-lock-syntax-alist):
New functions.
(sql-highlight-product): Set product specific syntax table.
(sql-mode-map): Added statement movement functions.
(sql-ansi-statement-starters, sql-oracle-statement-starters): New
variable.
(sql-statement-regexp, sql-beginning-of-statement)
(sql-end-of-statement, sql-signum): New functions.
(sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION
parameter.
(sql-show-sqli-buffer): Bug fix.
(sql-interactive-mode): Store connection data as buffer local.
(sql-connect): Added NEW-NAME parameter. Redesigned interaction
with sql-interactive-mode.
(sql-save-connection): Save buffer local settings.
(sql-connection-menu-filter): Changed menu entry name.
(sql-product-interactive): Bug fix.
(sql-preoutput-hold): New variable.
(sql-interactive-remove-continuation-prompt): Bug fixes.
(sql-debug-redirect): New variable.
(sql-str-literal): New function.
(sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute):
Redesigned.
(sql-oracle-save-settings, sql-oracle-restore-settings)
(sql-oracle-list-all, sql-oracle-list-table): New functions.
(sql-completion-object, sql-completion-column)
(sql-completion-sqlbuf): New variables.
(sql-build-completions-1, sql-build-completions)
(sql-try-completion): New functions.
(sql-read-table-name): Use them.
(sql-contains-names): New buffer local variable.
(sql-list-all, sql-list-table): Use it.
(sql-oracle-completion-types): New variable.
(sql-oracle-completion-object, sql-sqlite-completion-object)
(sql-postgres-completion-object): New functions.
2011-07-05 23:51:48 -04:00
|
|
|
|
; LocalWords: sql SQL SQLite sqlite Sybase Informix MySQL
|
|
|
|
|
; LocalWords: Postgres SQLServer SQLi
|
2021-04-19 12:21:01 +02:00
|
|
|
|
|
|
|
|
|
;;; sql.el ends here
|