Mercurial > emacs
annotate lisp/progmodes/sql.el @ 108381:aa05f2497948
SQL mode version 2.1
Redesigned product specific definition and handling. Includes many
bug fixes and enhancements.
author | Michael Mauger <mmaug@yahoo.com> |
---|---|
date | Sun, 09 May 2010 22:07:58 -0400 |
parents | cf2043af9228 |
children | 6e7ebe021a2c |
rev | line source |
---|---|
24050 | 1 ;;; sql.el --- specialized comint.el for SQL interpreters |
2 | |
100908 | 3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
106815 | 4 ;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
24050 | 5 |
25381
970b18c6803f
(sql-sybase): use sql-server instead of sql-database.
Alex Schroeder <alex@gnu.org>
parents:
25183
diff
changeset
|
6 ;; Author: Alex Schroeder <alex@gnu.org> |
52482 | 7 ;; Maintainer: Michael Mauger <mmaug@yahoo.com> |
108381 | 8 ;; Version: 2.1 |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
9 ;; Keywords: comm languages processes |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
10 ;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el |
38872 | 11 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode |
24050 | 12 |
13 ;; This file is part of GNU Emacs. | |
14 | |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; GNU Emacs is free software: you can redistribute it and/or modify |
24050 | 16 ;; it under the terms of the GNU General Public License as published by |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
17 ;; the Free Software Foundation, either version 3 of the License, or |
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
18 ;; (at your option) any later version. |
24050 | 19 |
20 ;; GNU Emacs is distributed in the hope that it will be useful, | |
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 ;; GNU General Public License for more details. | |
24 | |
25 ;; You should have received a copy of the GNU General Public License | |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
26 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
24050 | 27 |
28 ;;; Commentary: | |
29 | |
24354
6a438ef0b573
Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents:
24353
diff
changeset
|
30 ;; Please send bug reports and bug fixes to the mailing list at |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
31 ;; help-gnu-emacs@gnu.org. If you want to subscribe to the mailing |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
32 ;; list, see the web page at |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
33 ;; http://lists.gnu.org/mailman/listinfo/help-gnu-emacs for |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
34 ;; instructions. I monitor this list actively. If you send an e-mail |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
35 ;; to Alex Schroeder it usually makes it to me when Alex has a chance |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
36 ;; to forward them along (Thanks, Alex). |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
37 |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
38 ;; This file provides a sql-mode and a sql-interactive-mode. The |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
39 ;; original goals were two simple modes providing syntactic |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
40 ;; highlighting. The interactive mode had to provide a command-line |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
41 ;; history; the other mode had to provide "send region/buffer to SQL |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
42 ;; interpreter" functions. "simple" in this context means easy to |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
43 ;; use, easy to maintain and little or no bells and whistles. This |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
44 ;; has changed somewhat as experience with the mode has accumulated. |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
45 |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
46 ;; Support for different flavors of SQL and command interpreters was |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
47 ;; available in early versions of sql.el. This support has been |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
48 ;; extended and formalized in later versions. Part of the impetus for |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
49 ;; the improved support of SQL flavors was borne out of the current |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
50 ;; maintainer's consulting experience. In the past fifteen years, I |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
51 ;; have used Oracle, Sybase, Informix, MySQL, Postgres, and SQLServer. |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
52 ;; On some assignments, I have used two or more of these concurrently. |
24050 | 53 |
54 ;; If anybody feels like extending this sql mode, take a look at the | |
55 ;; above mentioned modes and write a sqlx-mode on top of this one. If | |
56 ;; this proves to be difficult, please suggest changes that will | |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
57 ;; facilitate your plans. Facilities have been provided to add |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
58 ;; products and product-specific configuration. |
24050 | 59 |
60 ;; sql-interactive-mode is used to interact with a SQL interpreter | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
61 ;; process in a SQLi buffer (usually called `*SQL*'). The SQLi buffer |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
62 ;; is created by calling a SQL interpreter-specific entry function or |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
63 ;; sql-product-interactive. Do *not* call sql-interactive-mode by |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
64 ;; itself. |
24050 | 65 |
66 ;; The list of currently supported interpreters and the corresponding | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
67 ;; entry function used to create the SQLi buffers is shown with |
24050 | 68 ;; `sql-help' (M-x sql-help). |
69 | |
70 ;; Since sql-interactive-mode is built on top of the general | |
71 ;; command-interpreter-in-a-buffer mode (comint mode), it shares a | |
72 ;; common base functionality, and a common set of bindings, with all | |
73 ;; modes derived from comint mode. This makes these modes easier to | |
74 ;; use. | |
75 | |
31392
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
76 ;; sql-mode can be used to keep editing SQL statements. The SQL |
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
77 ;; statements can be sent to the SQL process in the SQLi buffer. |
24050 | 78 |
79 ;; For documentation on the functionality provided by comint mode, and | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
80 ;; the hooks available for customizing it, see the file `comint.el'. |
24050 | 81 |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
82 ;; Hint for newbies: take a look at `dabbrev-expand', `abbrev-mode', and |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
83 ;; `imenu-add-menubar-index'. |
24050 | 84 |
85 ;;; Requirements for Emacs 19.34: | |
86 | |
87 ;; If you are using Emacs 19.34, you will have to get and install | |
88 ;; the file regexp-opt.el | |
89 ;; <URL:ftp://ftp.ifi.uio.no/pub/emacs/emacs-20.3/lisp/emacs-lisp/regexp-opt.el> | |
90 ;; and the custom package | |
91 ;; <URL:http://www.dina.kvl.dk/~abraham/custom/>. | |
92 | |
93 ;;; Bugs: | |
94 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
95 ;; sql-ms now uses osql instead of isql. Osql flushes its error |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
96 ;; stream more frequently than isql so that error messages are |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
97 ;; available. There is no prompt and some output still is buffered. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
98 ;; This improves the interaction under Emacs but it still is somewhat |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
99 ;; awkward. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
100 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
101 ;; Quoted identifiers are not supported for hilighting. Most |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
102 ;; databases support the use of double quoted strings in place of |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
103 ;; identifiers; ms (Microsoft SQLServer) also supports identifiers |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
104 ;; enclosed within brackets []. |
24050 | 105 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
106 ;;; Product Support: |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
107 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
108 ;; To add support for additional SQL products the following steps |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
109 ;; must be followed ("xyz" is the name of the product in the examples |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
110 ;; below): |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
111 |
108381 | 112 ;; 1) Add the product to the list of known products. |
113 | |
114 ;; (sql-add-product 'xyz "XyzDB" | |
115 ;; '(:free-software t)) | |
116 | |
117 ;; 2) Define font lock settings. All ANSI keywords will be | |
118 ;; highlighted automatically, so only product specific keywords | |
119 ;; need to be defined here. | |
120 | |
121 ;; (defvar my-sql-mode-xyz-font-lock-keywords | |
122 ;; '(("\\b\\(red\\|orange\\|yellow\\)\\b" | |
123 ;; . font-lock-keyword-face)) | |
124 ;; "XyzDB SQL keywords used by font-lock.") | |
125 | |
126 ;; (sql-set-product-feature 'xyz | |
127 ;; :font-lock | |
128 ;; 'my-sql-mode-xyz-font-lock-keywords) | |
129 | |
130 ;; 3) Define any special syntax characters including comments and | |
131 ;; identifier characters. | |
132 | |
133 ;; (sql-set-product-feature 'xyz | |
134 ;; :syntax-alist ((?# . "w"))) | |
135 | |
136 ;; 4) Define the interactive command interpreter for the database | |
137 ;; product. | |
138 | |
139 ;; (defcustom my-sql-xyz-program "ixyz" | |
140 ;; "Command to start ixyz by XyzDB." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
141 ;; :type 'file |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
142 ;; :group 'SQL) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
143 ;; |
108381 | 144 ;; (sql-set-product-feature 'xyz |
145 ;; :sqli-program 'my-sql-xyz-program) | |
146 ;; (sql-set-product-feature 'xyz | |
147 ;; :prompt-regexp "^xyzdb> ") | |
148 ;; (sql-set-product-feature 'xyz | |
149 ;; :prompt-length 7) | |
150 | |
151 ;; 5) Define login parameters and command line formatting. | |
152 | |
153 ;; (defcustom my-sql-xyz-login-params '(user password server database) | |
154 ;; "Login parameters to needed to connect to XyzDB." | |
155 ;; :type '(repeat (choice | |
156 ;; (const user) | |
157 ;; (const password) | |
158 ;; (const server) | |
159 ;; (const database))) | |
160 ;; :group 'SQL) | |
161 ;; | |
162 ;; (sql-set-product-feature 'xyz | |
163 ;; :sqli-login 'my-sql-xyz-login-params) | |
164 | |
165 ;; (defcustom my-sql-xyz-options '("-X" "-Y" "-Z") | |
166 ;; "List of additional options for `sql-xyz-program'." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
167 ;; :type '(repeat string) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
168 ;; :group 'SQL) |
108381 | 169 ;; |
170 ;; (sql-set-product-feature 'xyz | |
171 ;; :sqli-options 'my-sql-xyz-options)) | |
172 | |
173 ;; (defun my-sql-connect-xyz (product options) | |
174 ;; "Connect ti XyzDB in a comint buffer." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
175 ;; |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
176 ;; ;; Do something with `sql-user', `sql-password', |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
177 ;; ;; `sql-database', and `sql-server'. |
108381 | 178 ;; (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
179 ;; (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
180 ;; (setq params (append (list "-S" sql-server) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
181 ;; (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
182 ;; (setq params (append (list "-D" sql-database) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
183 ;; (if (not (string= "" sql-password)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
184 ;; (setq params (append (list "-P" sql-password) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
185 ;; (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
186 ;; (setq params (append (list "-U" sql-user) params))) |
108381 | 187 ;; (sql-connect product params))) |
188 ;; | |
189 ;; (sql-set-product-feature 'xyz | |
190 ;; :sqli-connect-func 'my-sql-connect-xyz) | |
191 | |
192 ;; 6) Define a convienence function to invoke the SQL interpreter. | |
193 | |
194 ;; (defun my-sql-xyz () | |
195 ;; "Run ixyz by XyzDB as an inferior process." | |
196 ;; (interactive) | |
197 ;; (sql-product-interactive 'xyz)) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
198 |
51929
3da2cf447bf9
Revert last change.
Juanma Barranquero <lekktu@gmail.com>
parents:
51893
diff
changeset
|
199 ;;; To Do: |
51893
1a294cfb1636
Version 1.8.0 of sql-mode.
Juanma Barranquero <lekktu@gmail.com>
parents:
51607
diff
changeset
|
200 |
108381 | 201 ;; Improve keyword highlighting for individual products. I have tried |
202 ;; to update those database that I use. Feel free to send me updates, | |
203 ;; or direct me to the reference manuals for your favorite database. | |
204 | |
205 ;; When there are no keywords defined, the ANSI keywords are | |
206 ;; highlighted. ANSI keywords are highlighted even if the keyword is | |
207 ;; not used for your current product. This should help identify | |
208 ;; portability concerns. | |
209 | |
210 ;; Add different highlighting levels. | |
211 | |
212 ;; Add support for listing available tables or the columns in a table. | |
24050 | 213 |
214 ;;; Thanks to all the people who helped me out: | |
215 | |
108381 | 216 ;; Alex Schroeder <alex@gnu.org> -- the original author |
24050 | 217 ;; Kai Blauberg <kai.blauberg@metla.fi> |
218 ;; <ibalaban@dalet.com> | |
219 ;; Yair Friedman <yfriedma@JohnBryce.Co.Il> | |
220 ;; Gregor Zych <zych@pool.informatik.rwth-aachen.de> | |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
221 ;; nino <nino@inform.dk> |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
222 ;; Berend de Boer <berend@pobox.com> |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
223 ;; Adam Jenkins <adam@thejenkins.org> |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
224 ;; Michael Mauger <mmaug@yahoo.com> -- improved product support |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
225 ;; Drew Adams <drew.adams@oracle.com> -- Emacs 20 support |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
226 ;; Harald Maier <maierh@myself.com> -- sql-send-string |
108381 | 227 ;; Stefan Monnier <monnier@iro.umontreal.ca> -- font-lock corrections; code polish |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
228 |
24050 | 229 |
230 | |
231 ;;; Code: | |
232 | |
233 (require 'comint) | |
234 ;; Need the following to allow GNU Emacs 19 to compile the file. | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
235 (eval-when-compile |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
236 (require 'regexp-opt)) |
24050 | 237 (require 'custom) |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
238 (eval-when-compile ;; needed in Emacs 19, 20 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
239 (setq max-specpdl-size 2000)) |
24050 | 240 |
65240
e3995ff46137
(font-lock-keyword-face, font-lock-set-defaults, font-lock-string-face):
Juanma Barranquero <lekktu@gmail.com>
parents:
65198
diff
changeset
|
241 (defvar font-lock-keyword-face) |
e3995ff46137
(font-lock-keyword-face, font-lock-set-defaults, font-lock-string-face):
Juanma Barranquero <lekktu@gmail.com>
parents:
65198
diff
changeset
|
242 (defvar font-lock-set-defaults) |
e3995ff46137
(font-lock-keyword-face, font-lock-set-defaults, font-lock-string-face):
Juanma Barranquero <lekktu@gmail.com>
parents:
65198
diff
changeset
|
243 (defvar font-lock-string-face) |
e3995ff46137
(font-lock-keyword-face, font-lock-set-defaults, font-lock-string-face):
Juanma Barranquero <lekktu@gmail.com>
parents:
65198
diff
changeset
|
244 |
24050 | 245 ;;; Allow customization |
246 | |
247 (defgroup SQL nil | |
64052
68f51d595f7f
(SQL): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63410
diff
changeset
|
248 "Running a SQL interpreter from within Emacs buffers." |
24556 | 249 :version "20.4" |
108381 | 250 :group 'languages |
24050 | 251 :group 'processes) |
252 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
253 ;; These four variables will be used as defaults, if set. |
24050 | 254 |
255 (defcustom sql-user "" | |
108381 | 256 "Default username." |
24050 | 257 :type 'string |
258 :group 'SQL) | |
108381 | 259 (put 'sql-user 'safe-local-variable 'stringp) |
24050 | 260 |
261 (defcustom sql-password "" | |
108381 | 262 "Default password. |
24050 | 263 |
264 Storing your password in a textfile such as ~/.emacs could be dangerous. | |
265 Customizing your password will store it in your ~/.emacs file." | |
266 :type 'string | |
267 :group 'SQL) | |
108381 | 268 (put 'sql-password 'risky-local-variable t) |
24050 | 269 |
270 (defcustom sql-database "" | |
108381 | 271 "Default database." |
24050 | 272 :type 'string |
273 :group 'SQL) | |
108381 | 274 (put 'sql-database 'safe-local-variable 'stringp) |
24050 | 275 |
276 (defcustom sql-server "" | |
108381 | 277 "Default server or host." |
24050 | 278 :type 'string |
279 :group 'SQL) | |
108381 | 280 (put 'sql-server 'safe-local-variable 'stringp) |
281 | |
282 (defcustom sql-port nil | |
283 "Default server or host." | |
284 :type 'number | |
285 :group 'SQL) | |
286 (put 'sql-port 'safe-local-variable 'numberp) | |
24050 | 287 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
288 ;; SQL Product support |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
289 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
290 (defvar sql-interactive-product nil |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
291 "Product under `sql-interactive-mode'.") |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
292 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
293 (defvar sql-product-alist |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
294 '((ansi |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
295 :name "ANSI" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
296 :font-lock sql-mode-ansi-font-lock-keywords) |
108381 | 297 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
298 (db2 |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
299 :name "DB2" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
300 :font-lock sql-mode-db2-font-lock-keywords |
108381 | 301 :sqli-program sql-db2-program |
302 :sqli-options sql-db2-options | |
303 :sqli-login sql-db2-login-params | |
304 :sqli-connect-func sql-connect-db2 | |
305 :prompt-regexp "^db2 => " | |
306 :prompt-length 7 | |
307 :input-filter sql-escape-newlines-filter) | |
308 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
309 (informix |
108381 | 310 :name "Informix" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
311 :font-lock sql-mode-informix-font-lock-keywords |
108381 | 312 :sqli-program sql-informix-program |
313 :sqli-options sql-informix-options | |
314 :sqli-login sql-informix-login-params | |
315 :sqli-connect-func sql-connect-informix | |
316 :prompt-regexp "^> " | |
317 :prompt-length 2 | |
318 :syntax-alist ((?{ . "<") (?} . ">"))) | |
319 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
320 (ingres |
108381 | 321 :name "Ingres" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
322 :font-lock sql-mode-ingres-font-lock-keywords |
108381 | 323 :sqli-program sql-ingres-program |
324 :sqli-options sql-ingres-options | |
325 :sqli-login sql-ingres-login-params | |
326 :sqli-connect-func sql-connect-ingres | |
327 :prompt-regexp "^\* " | |
328 :prompt-length 2) | |
329 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
330 (interbase |
108381 | 331 :name "Interbase" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
332 :font-lock sql-mode-interbase-font-lock-keywords |
108381 | 333 :sqli-program sql-interbase-program |
334 :sqli-options sql-interbase-options | |
335 :sqli-login sql-interbase-login-params | |
336 :sqli-connect-func sql-connect-interbase | |
337 :prompt-regexp "^SQL> " | |
338 :prompt-length 5) | |
339 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
340 (linter |
108381 | 341 :name "Linter" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
342 :font-lock sql-mode-linter-font-lock-keywords |
108381 | 343 :sqli-program sql-linter-program |
344 :sqli-options sql-linter-options | |
345 :sqli-login sql-linter-login-params | |
346 :sqli-connect-func sql-connect-linter | |
347 :prompt-regexp "^SQL>" | |
348 :prompt-length 4) | |
349 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
350 (ms |
108381 | 351 :name "Microsoft" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
352 :font-lock sql-mode-ms-font-lock-keywords |
108381 | 353 :sqli-program sql-ms-program |
354 :sqli-options sql-ms-options | |
355 :sqli-login sql-ms-login-params | |
356 :sqli-connect-func sql-connect-ms | |
357 :prompt-regexp "^[0-9]*>" | |
358 :prompt-length 5 | |
359 :syntax-alist ((?@ . "w")) | |
360 :terminator ("^go" . "go")) | |
361 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
362 (mysql |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
363 :name "MySQL" |
108381 | 364 :free-software t |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
365 :font-lock sql-mode-mysql-font-lock-keywords |
108381 | 366 :sqli-program sql-mysql-program |
367 :sqli-options sql-mysql-options | |
368 :sqli-login sql-mysql-login-params | |
369 :sqli-connect-func sql-connect-mysql | |
370 :prompt-regexp "^mysql> " | |
371 :prompt-length 6 | |
372 :input-filter sql-remove-tabs-filter) | |
373 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
374 (oracle |
108381 | 375 :name "Oracle" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
376 :font-lock sql-mode-oracle-font-lock-keywords |
108381 | 377 :sqli-program sql-oracle-program |
378 :sqli-options sql-oracle-options | |
379 :sqli-login sql-oracle-login-params | |
380 :sqli-connect-func sql-connect-oracle | |
381 :prompt-regexp "^SQL> " | |
382 :prompt-length 5 | |
383 :syntax-alist ((?$ . "w") (?# . "w")) | |
384 :terminator ("\\(^/\\|;\\)" . "/") | |
385 :input-filter sql-placeholders-filter) | |
386 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
387 (postgres |
108381 | 388 :name "Postgres" |
389 :free-software t | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
390 :font-lock sql-mode-postgres-font-lock-keywords |
108381 | 391 :sqli-program sql-postgres-program |
392 :sqli-options sql-postgres-options | |
393 :sqli-login sql-postgres-login-params | |
394 :sqli-connect-func sql-connect-postgres | |
395 :prompt-regexp "^.*[#>] *" | |
396 :prompt-length 5 | |
397 :input-filter sql-remove-tabs-filter | |
398 :terminator ("\\(^[\\]g\\|;\\)" . ";")) | |
399 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
400 (solid |
108381 | 401 :name "Solid" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
402 :font-lock sql-mode-solid-font-lock-keywords |
108381 | 403 :sqli-program sql-solid-program |
404 :sqli-options sql-solid-options | |
405 :sqli-login sql-solid-login-params | |
406 :sqli-connect-func sql-connect-solid | |
407 :prompt-regexp "^" | |
408 :prompt-length 0) | |
409 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
410 (sqlite |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
411 :name "SQLite" |
108381 | 412 :free-software t |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
413 :font-lock sql-mode-sqlite-font-lock-keywords |
108381 | 414 :sqli-program sql-sqlite-program |
415 :sqli-options sql-sqlite-options | |
416 :sqli-login sql-sqlite-login-params | |
417 :sqli-connect-func sql-connect-sqlite | |
418 :prompt-regexp "^sqlite> " | |
419 :prompt-length 8) | |
420 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
421 (sybase |
108381 | 422 :name "Sybase" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
423 :font-lock sql-mode-sybase-font-lock-keywords |
108381 | 424 :sqli-program sql-sybase-program |
425 :sqli-options sql-sybase-options | |
426 :sqli-login sql-sybase-login-params | |
427 :sqli-connect-func sql-connect-sybase | |
428 :prompt-regexp "^SQL> " | |
429 :prompt-length 5 | |
430 :syntax-alist ((?@ . "w")) | |
431 :terminator ("^go" . "go")) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
432 ) |
108381 | 433 "An alist of product specific configuration settings. |
434 | |
435 Without an entry in this list a product will not be properly | |
436 highlighted and will not support `sql-interactive-mode'. | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
437 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
438 Each element in the list is in the following format: |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
439 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
440 \(PRODUCT FEATURE VALUE ...) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
441 |
108381 | 442 where PRODUCT is the appropriate value of `sql-product'. The |
443 product name is then followed by FEATURE-VALUE pairs. If a | |
444 FEATURE is not specified, its VALUE is treated as nil. FEATURE | |
445 may be any one of the following: | |
446 | |
447 :name string containing the displayable name of | |
448 the product. | |
449 | |
450 :free-software is the product Free (as in Freedom) software? | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
451 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
452 :font-lock name of the variable containing the product |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
453 specific font lock highlighting patterns. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
454 |
108381 | 455 :sqli-program name of the variable containing the product |
456 specific interactive program name. | |
457 | |
458 :sqli-options name of the variable containing the list | |
459 of product specific options. | |
460 | |
461 :sqli-login name of the variable containing the list of | |
462 login parameters (i.e., user, password, | |
463 database and server) needed to connect to | |
464 the database. | |
465 | |
466 :sqli-connect-func name of a function which accepts no | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
467 parameters that will use the values of |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
468 `sql-user', `sql-password', |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
469 `sql-database' and `sql-server' to open a |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
470 comint buffer and connect to the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
471 database. Do product specific |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
472 configuration of comint in this function. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
473 |
108381 | 474 :prompt-regexp regular expression string that matches |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
475 the prompt issued by the product |
108381 | 476 interpreter. |
477 | |
478 :prompt-length length of the prompt on the line. | |
479 | |
480 :input-filter function which can filter strings sent to | |
481 the command interpreter. It is also used | |
482 by the `sql-send-string', | |
483 `sql-send-region', `sql-send-paragraph' | |
484 and `sql-send-buffer' functions. The | |
485 function is passed the string sent to the | |
486 command interpreter and must return the | |
487 filtered string. | |
488 | |
489 :terminator the terminator to be sent after a | |
490 `sql-send-string', `sql-send-region', | |
491 `sql-send-paragraph' and | |
492 `sql-send-buffer' command. May be the | |
493 literal string or a cons of a regexp to | |
494 match an existing terminator in the | |
495 string and the terminator to be used if | |
496 its absent. By default \";\". | |
497 | |
498 :syntax-alist alist of syntax table entries to enable | |
499 special character treatment by font-lock | |
500 and imenu. | |
501 | |
502 Other features can be stored but they will be ignored. However, | |
503 you can develop new functionality which is product independent by | |
504 using `sql-get-product-feature' to lookup the product specific | |
505 settings.") | |
506 | |
507 (defvar sql-indirect-features | |
508 '(:font-lock :sqli-program :sqli-options :sqli-login)) | |
509 | |
510 ;;;###autoload | |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
511 (defcustom sql-product 'ansi |
108381 | 512 "Select the SQL database product used so that buffers can be |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
513 highlighted properly when you open them." |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
514 :type `(choice |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
515 ,@(mapcar (lambda (prod-info) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
516 `(const :tag |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
517 ,(or (plist-get (cdr prod-info) :name) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
518 (capitalize (symbol-name (car prod-info)))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
519 ,(car prod-info))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
520 sql-product-alist)) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
521 :group 'SQL) |
108381 | 522 (put 'sql-product 'safe-local-variable 'symbolp) |
523 | |
524 (defvar sql-interactive-product nil | |
525 "Product under `sql-interactive-mode'.") | |
526 | |
527 ;; misc customization of sql.el behaviour | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
528 |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
529 (defcustom sql-electric-stuff nil |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
530 "Treat some input as electric. |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
531 If set to the symbol `semicolon', then hitting `;' will send current |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
532 input in the SQLi buffer to the process. |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
533 If set to the symbol `go', then hitting `go' on a line by itself will |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
534 send current input in the SQLi buffer to the process. |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
535 If set to nil, then you must use \\[comint-send-input] in order to send |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
536 current input in the SQLi buffer to the process." |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
537 :type '(choice (const :tag "Nothing" nil) |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
538 (const :tag "The semicolon `;'" semicolon) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
539 (const :tag "The string `go' by itself" go)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
540 :version "20.8" |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
541 :group 'SQL) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
542 |
108381 | 543 (defcustom sql-send-terminator nil |
544 "When non-nil, add a terminator to text sent to the SQL interpreter. | |
545 | |
546 When text is sent to the SQL interpreter (via `sql-send-string', | |
547 `sql-send-region', `sql-send-paragraph' or `sql-send-buffer'), a | |
548 command terminator can be automatically sent as well. The | |
549 terminator is not sent, if the string sent already ends with the | |
550 terminator. | |
551 | |
552 If this value is t, then the default command terminator for the | |
553 SQL interpreter is sent. If this value is a string, then the | |
554 string is sent. | |
555 | |
556 If the value is a cons cell of the form (PAT . TERM), then PAT is | |
557 a regexp used to match the terminator in the string and TERM is | |
558 the terminator to be sent. This form is useful if the SQL | |
559 interpreter has more than one way of submitting a SQL command. | |
560 The PAT regexp can match any of them, and TERM is the way we do | |
561 it automatically." | |
562 | |
563 :type '(choice (const :tag "No Terminator" nil) | |
564 (const :tag "Default Terminator" t) | |
565 (string :tag "Terminator String") | |
566 (cons :tag "Terminator Pattern and String" | |
567 (string :tag "Terminator Pattern") | |
568 (string :tag "Terminator String"))) | |
569 :version "22.2" | |
570 :group 'SQL) | |
571 | |
24050 | 572 (defcustom sql-pop-to-buffer-after-send-region nil |
108381 | 573 "When non-nil, pop to the buffer SQL statements are sent to. |
574 | |
575 After a call to `sql-sent-string', `sql-send-region', | |
576 `sql-send-paragraph' or `sql-send-buffer', the window is split | |
577 and the SQLi buffer is shown. If this variable is not nil, that | |
578 buffer's window will be selected by calling `pop-to-buffer'. If | |
579 this variable is nil, that buffer is shown using | |
580 `display-buffer'." | |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
581 :type 'boolean |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
582 :group 'SQL) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
583 |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
584 ;; imenu support for sql-mode. |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
585 |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
586 (defvar sql-imenu-generic-expression |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
587 ;; Items are in reverse order because they are rendered in reverse. |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
588 '(("Rules/Defaults" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*\\(rule\\|default\\)\\s-+\\(\\w+\\)" 3) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
589 ("Sequences" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*sequence\\s-+\\(\\w+\\)" 2) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
590 ("Triggers" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*trigger\\s-+\\(\\w+\\)" 2) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
591 ("Functions" "^\\s-*\\(create\\s-+\\(\\w+\\s-+\\)*\\)?function\\s-+\\(\\w+\\)" 3) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
592 ("Procedures" "^\\s-*\\(create\\s-+\\(\\w+\\s-+\\)*\\)?proc\\(edure\\)?\\s-+\\(\\w+\\)" 4) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
593 ("Packages" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*package\\s-+\\(body\\s-+\\)?\\(\\w+\\)" 3) |
108381 | 594 ("Types" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*type\\s-+\\(body\\s-+\\)?\\(\\w+\\)" 3) |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
595 ("Indexes" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*index\\s-+\\(\\w+\\)" 2) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
596 ("Tables/Views" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*\\(table\\|view\\)\\s-+\\(\\w+\\)" 3)) |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
597 "Define interesting points in the SQL buffer for `imenu'. |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
598 |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
599 This is used to set `imenu-generic-expression' when SQL mode is |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
600 entered. Subsequent changes to `sql-imenu-generic-expression' will |
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
601 not affect existing SQL buffers because imenu-generic-expression is |
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
602 a local variable.") |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
603 |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
604 ;; history file |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
605 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
606 (defcustom sql-input-ring-file-name nil |
108381 | 607 "If non-nil, name of the file to read/write input history. |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
608 |
24861
0d593aa15c0f
(sql-input-ring-file-name): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24591
diff
changeset
|
609 You have to set this variable if you want the history of your commands |
0d593aa15c0f
(sql-input-ring-file-name): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24591
diff
changeset
|
610 saved from one Emacs session to the next. If this variable is set, |
0d593aa15c0f
(sql-input-ring-file-name): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24591
diff
changeset
|
611 exiting the SQL interpreter in an SQLi buffer will write the input |
0d593aa15c0f
(sql-input-ring-file-name): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24591
diff
changeset
|
612 history to the specified file. Starting a new process in a SQLi buffer |
0d593aa15c0f
(sql-input-ring-file-name): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24591
diff
changeset
|
613 will read the input history from the specified file. |
0d593aa15c0f
(sql-input-ring-file-name): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24591
diff
changeset
|
614 |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
615 This is used to initialize `comint-input-ring-file-name'. |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
616 |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
617 Note that the size of the input history is determined by the variable |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
618 `comint-input-ring-size'." |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
619 :type '(choice (const :tag "none" nil) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
620 (file)) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
621 :group 'SQL) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
622 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
623 (defcustom sql-input-ring-separator "\n--\n" |
108381 | 624 "Separator between commands in the history file. |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
625 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
626 If set to \"\\n\", each line in the history file will be interpreted as |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
627 one command. Multi-line commands are split into several commands when |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
628 the input ring is initialized from a history file. |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
629 |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
630 This variable used to initialize `comint-input-ring-separator'. |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
631 `comint-input-ring-separator' is part of Emacs 21; if your Emacs |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
632 does not have it, setting `sql-input-ring-separator' will have no |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
633 effect. In that case multiline commands will be split into several |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
634 commands when the input history is read, as if you had set |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
635 `sql-input-ring-separator' to \"\\n\"." |
24050 | 636 :type 'string |
637 :group 'SQL) | |
638 | |
639 ;; The usual hooks | |
640 | |
641 (defcustom sql-interactive-mode-hook '() | |
108381 | 642 "Hook for customizing `sql-interactive-mode'." |
24050 | 643 :type 'hook |
644 :group 'SQL) | |
645 | |
646 (defcustom sql-mode-hook '() | |
108381 | 647 "Hook for customizing `sql-mode'." |
24050 | 648 :type 'hook |
649 :group 'SQL) | |
650 | |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
651 (defcustom sql-set-sqli-hook '() |
108381 | 652 "Hook for reacting to changes of `sql-buffer'. |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
653 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
654 This is called by `sql-set-sqli-buffer' when the value of `sql-buffer' |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
655 is changed." |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
656 :type 'hook |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
657 :group 'SQL) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
658 |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
659 ;; Customization for Oracle |
24050 | 660 |
661 (defcustom sql-oracle-program "sqlplus" | |
108381 | 662 "Command to start sqlplus by Oracle. |
24050 | 663 |
664 Starts `sql-interactive-mode' after doing some setup. | |
665 | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
666 On Windows, \"sqlplus\" usually starts the sqlplus \"GUI\". In order to |
24050 | 667 start the sqlplus console, use \"plus33\" or something similar. You |
108381 | 668 will find the file in your Orant\\bin directory." |
24050 | 669 :type 'file |
670 :group 'SQL) | |
671 | |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
672 (defcustom sql-oracle-options nil |
108381 | 673 "List of additional options for `sql-oracle-program'." |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
674 :type '(repeat string) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
675 :version "20.8" |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
676 :group 'SQL) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
677 |
108381 | 678 (defcustom sql-oracle-login-params '(user password database) |
679 "List of login parameters needed to connect to Oracle." | |
680 :type '(repeat (choice | |
681 (const user) | |
682 (const password) | |
683 (const server) | |
684 (const database))) | |
685 :version "24.1" | |
686 :group 'SQL) | |
687 | |
688 (defcustom sql-oracle-scan-on t | |
689 "Non-nil if placeholders should be replaced in Oracle SQLi. | |
690 | |
691 When non-nil, Emacs will scan text sent to sqlplus and prompt | |
692 for replacement text for & placeholders as sqlplus does. This | |
693 is needed on Windows where sqlplus output is buffer and the | |
694 prompts are not shown until after the text is entered. | |
695 | |
696 You will probably want to issue the following command in sqlplus | |
697 to be safe: | |
698 | |
699 SET SCAN OFF" | |
700 :type 'boolean | |
701 :group 'SQL) | |
702 | |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
703 ;; Customization for SQLite |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
704 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
705 (defcustom sql-sqlite-program "sqlite" |
108381 | 706 "Command to start SQLite. |
707 | |
708 Starts `sql-interactive-mode' after doing some setup." | |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
709 :type 'file |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
710 :group 'SQL) |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
711 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
712 (defcustom sql-sqlite-options nil |
108381 | 713 "List of additional options for `sql-sqlite-program'." |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
714 :type '(repeat string) |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
715 :version "20.8" |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
716 :group 'SQL) |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
717 |
108381 | 718 (defcustom sql-sqlite-login-params '(database) |
719 "List of login parameters needed to connect to SQLite." | |
720 :type '(repeat (choice | |
721 (const user) | |
722 (const password) | |
723 (const server) | |
724 (const database))) | |
725 :version "24.1" | |
726 :group 'SQL) | |
727 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
728 ;; Customization for MySql |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
729 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
730 (defcustom sql-mysql-program "mysql" |
108381 | 731 "Command to start mysql by TcX. |
732 | |
733 Starts `sql-interactive-mode' after doing some setup." | |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
734 :type 'file |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
735 :group 'SQL) |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
736 |
32169
5aa8b2b669b7
(sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31392
diff
changeset
|
737 (defcustom sql-mysql-options nil |
108381 | 738 "List of additional options for `sql-mysql-program'. |
34704
7cb3b80e66b8
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32621
diff
changeset
|
739 The following list of options is reported to make things work |
7cb3b80e66b8
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32621
diff
changeset
|
740 on Windows: \"-C\" \"-t\" \"-f\" \"-n\"." |
32169
5aa8b2b669b7
(sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31392
diff
changeset
|
741 :type '(repeat string) |
5aa8b2b669b7
(sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31392
diff
changeset
|
742 :version "20.8" |
5aa8b2b669b7
(sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31392
diff
changeset
|
743 :group 'SQL) |
5aa8b2b669b7
(sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31392
diff
changeset
|
744 |
108381 | 745 (defcustom sql-mysql-login-params '(user password database server) |
746 "List of login parameters needed to connect to MySql." | |
747 :type '(repeat (choice | |
748 (const user) | |
749 (const password) | |
750 (const server) | |
751 (const database) | |
752 (const port))) | |
753 :version "24.1" | |
754 :group 'SQL) | |
755 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
756 ;; Customization for Solid |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
757 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
758 (defcustom sql-solid-program "solsql" |
108381 | 759 "Command to start SOLID SQL Editor. |
760 | |
761 Starts `sql-interactive-mode' after doing some setup." | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
762 :type 'file |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
763 :group 'SQL) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
764 |
108381 | 765 (defcustom sql-solid-login-params '(user password server) |
766 "List of login parameters needed to connect to Solid." | |
767 :type '(repeat (choice | |
768 (const user) | |
769 (const password) | |
770 (const server) | |
771 (const database))) | |
772 :version "24.1" | |
773 :group 'SQL) | |
774 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
775 ;; Customization for SyBase |
24050 | 776 |
777 (defcustom sql-sybase-program "isql" | |
108381 | 778 "Command to start isql by SyBase. |
779 | |
780 Starts `sql-interactive-mode' after doing some setup." | |
24050 | 781 :type 'file |
782 :group 'SQL) | |
783 | |
32621
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
784 (defcustom sql-sybase-options nil |
108381 | 785 "List of additional options for `sql-sybase-program'. |
32621
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
786 Some versions of isql might require the -n option in order to work." |
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
787 :type '(repeat string) |
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
788 :version "20.8" |
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
789 :group 'SQL) |
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
790 |
108381 | 791 (defcustom sql-sybase-login-params '(server user password database) |
792 "List of login parameters needed to connect to Sybase." | |
793 :type '(repeat (choice | |
794 (const user) | |
795 (const password) | |
796 (const server) | |
797 (const database))) | |
798 :version "24.1" | |
799 :group 'SQL) | |
800 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
801 ;; Customization for Informix |
24050 | 802 |
803 (defcustom sql-informix-program "dbaccess" | |
108381 | 804 "Command to start dbaccess by Informix. |
805 | |
806 Starts `sql-interactive-mode' after doing some setup." | |
24050 | 807 :type 'file |
808 :group 'SQL) | |
809 | |
108381 | 810 (defcustom sql-informix-login-params '(database) |
811 "List of login parameters needed to connect to Informix." | |
812 :type '(repeat (choice | |
813 (const user) | |
814 (const password) | |
815 (const server) | |
816 (const database))) | |
817 :version "24.1" | |
818 :group 'SQL) | |
819 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
820 ;; Customization for Ingres |
24050 | 821 |
822 (defcustom sql-ingres-program "sql" | |
108381 | 823 "Command to start sql by Ingres. |
824 | |
825 Starts `sql-interactive-mode' after doing some setup." | |
24050 | 826 :type 'file |
827 :group 'SQL) | |
828 | |
108381 | 829 (defcustom sql-ingres-login-params '(database) |
830 "List of login parameters needed to connect to Ingres." | |
831 :type '(repeat (choice | |
832 (const user) | |
833 (const password) | |
834 (const server) | |
835 (const database))) | |
836 :version "24.1" | |
837 :group 'SQL) | |
838 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
839 ;; Customization for Microsoft |
24050 | 840 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
841 (defcustom sql-ms-program "osql" |
108381 | 842 "Command to start osql by Microsoft. |
843 | |
844 Starts `sql-interactive-mode' after doing some setup." | |
24050 | 845 :type 'file |
846 :group 'SQL) | |
847 | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
848 (defcustom sql-ms-options '("-w" "300" "-n") |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
849 ;; -w is the linesize |
108381 | 850 "List of additional options for `sql-ms-program'." |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
851 :type '(repeat string) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
55370
diff
changeset
|
852 :version "22.1" |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
853 :group 'SQL) |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
854 |
108381 | 855 (defcustom sql-ms-login-params '(user password server database) |
856 "List of login parameters needed to connect to Microsoft." | |
857 :type '(repeat (choice | |
858 (const user) | |
859 (const password) | |
860 (const server) | |
861 (const database))) | |
862 :version "24.1" | |
863 :group 'SQL) | |
864 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
865 ;; Customization for Postgres |
24050 | 866 |
867 (defcustom sql-postgres-program "psql" | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
868 "Command to start psql by Postgres. |
24050 | 869 |
108381 | 870 Starts `sql-interactive-mode' after doing some setup." |
24050 | 871 :type 'file |
872 :group 'SQL) | |
873 | |
34704
7cb3b80e66b8
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32621
diff
changeset
|
874 (defcustom sql-postgres-options '("-P" "pager=off") |
108381 | 875 "List of additional options for `sql-postgres-program'. |
38872 | 876 The default setting includes the -P option which breaks older versions |
877 of the psql client (such as version 6.5.3). The -P option is equivalent | |
878 to the --pset option. If you want the psql to prompt you for a user | |
879 name, add the string \"-u\" to the list of options. If you want to | |
880 provide a user name on the command line (newer versions such as 7.1), | |
881 add your name with a \"-U\" prefix (such as \"-Umark\") to the list." | |
31392
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
882 :type '(repeat string) |
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
883 :version "20.8" |
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
884 :group 'SQL) |
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
885 |
108381 | 886 (defcustom sql-postgres-login-params '(user database server) |
887 "List of login parameters needed to connect to Postgres." | |
888 :type '(repeat (choice | |
889 (const user) | |
890 (const password) | |
891 (const server) | |
892 (const database))) | |
893 :version "24.1" | |
894 :group 'SQL) | |
895 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
896 ;; Customization for Interbase |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
897 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
898 (defcustom sql-interbase-program "isql" |
108381 | 899 "Command to start isql by Interbase. |
900 | |
901 Starts `sql-interactive-mode' after doing some setup." | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
902 :type 'file |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
903 :group 'SQL) |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
904 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
905 (defcustom sql-interbase-options nil |
108381 | 906 "List of additional options for `sql-interbase-program'." |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
907 :type '(repeat string) |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
908 :version "20.8" |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
909 :group 'SQL) |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
910 |
108381 | 911 (defcustom sql-interbase-login-params '(user password database) |
912 "List of login parameters needed to connect to Interbase." | |
913 :type '(repeat (choice | |
914 (const user) | |
915 (const password) | |
916 (const server) | |
917 (const database))) | |
918 :version "24.1" | |
919 :group 'SQL) | |
920 | |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
921 ;; Customization for DB2 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
922 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
923 (defcustom sql-db2-program "db2" |
108381 | 924 "Command to start db2 by IBM. |
925 | |
926 Starts `sql-interactive-mode' after doing some setup." | |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
927 :type 'file |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
928 :group 'SQL) |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
929 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
930 (defcustom sql-db2-options nil |
108381 | 931 "List of additional options for `sql-db2-program'." |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
932 :type '(repeat string) |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
933 :version "20.8" |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
934 :group 'SQL) |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
935 |
108381 | 936 (defcustom sql-db2-login-params nil |
937 "List of login parameters needed to connect to DB2." | |
938 :type '(repeat (choice | |
939 (const user) | |
940 (const password) | |
941 (const server) | |
942 (const database))) | |
943 :version "24.1" | |
944 :group 'SQL) | |
945 | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
946 ;; Customization for Linter |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
947 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
948 (defcustom sql-linter-program "inl" |
108381 | 949 "Command to start inl by RELEX. |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
950 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
951 Starts `sql-interactive-mode' after doing some setup." |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
952 :type 'file |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
953 :group 'SQL) |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
954 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
955 (defcustom sql-linter-options nil |
108381 | 956 "List of additional options for `sql-linter-program'." |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
957 :type '(repeat string) |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
958 :version "21.3" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
959 :group 'SQL) |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
960 |
108381 | 961 (defcustom sql-linter-login-params '(user password database server) |
962 "Login parameters to needed to connect to Linter." | |
963 :type '(repeat (choice | |
964 (const user) | |
965 (const password) | |
966 (const server) | |
967 (const database))) | |
968 :version "24.1" | |
969 :group 'SQL) | |
970 | |
24050 | 971 |
972 | |
973 ;;; Variables which do not need customization | |
974 | |
975 (defvar sql-user-history nil | |
976 "History of usernames used.") | |
977 | |
978 (defvar sql-database-history nil | |
979 "History of databases used.") | |
980 | |
981 (defvar sql-server-history nil | |
982 "History of servers used.") | |
983 | |
108381 | 984 (defvar sql-port-history nil |
985 "History of ports used.") | |
986 | |
24050 | 987 ;; Passwords are not kept in a history. |
988 | |
989 (defvar sql-buffer nil | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
990 "Current SQLi buffer. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
991 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
992 The global value of `sql-buffer' is the name of the latest SQLi buffer |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
993 created. Any SQL buffer created will make a local copy of this value. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
994 See `sql-interactive-mode' for more on multiple sessions. If you want |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
995 to change the SQLi buffer a SQL mode sends its SQL strings to, change |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
996 the local value of `sql-buffer' using \\[sql-set-sqli-buffer].") |
24050 | 997 |
998 (defvar sql-prompt-regexp nil | |
999 "Prompt used to initialize `comint-prompt-regexp'. | |
1000 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1001 You can change `sql-prompt-regexp' on `sql-interactive-mode-hook'.") |
24050 | 1002 |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
1003 (defvar sql-prompt-length 0 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
1004 "Prompt used to set `left-margin' in `sql-interactive-mode'. |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
1005 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1006 You can change `sql-prompt-length' on `sql-interactive-mode-hook'.") |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
1007 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1008 (defvar sql-alternate-buffer-name nil |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1009 "Buffer-local string used to possibly rename the SQLi buffer. |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1010 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1011 Used by `sql-rename-buffer'.") |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1012 |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1013 ;; Keymap for sql-interactive-mode. |
24050 | 1014 |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1015 (defvar sql-interactive-mode-map |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1016 (let ((map (make-sparse-keymap))) |
64837
f80fef683ab5
(sql-interactive-mode-map): Use fboundp.
Richard M. Stallman <rms@gnu.org>
parents:
64699
diff
changeset
|
1017 (if (fboundp 'set-keymap-parent) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1018 (set-keymap-parent map comint-mode-map); Emacs |
64837
f80fef683ab5
(sql-interactive-mode-map): Use fboundp.
Richard M. Stallman <rms@gnu.org>
parents:
64699
diff
changeset
|
1019 (if (fboundp 'set-keymap-parents) |
f80fef683ab5
(sql-interactive-mode-map): Use fboundp.
Richard M. Stallman <rms@gnu.org>
parents:
64699
diff
changeset
|
1020 (set-keymap-parents map (list comint-mode-map)))); XEmacs |
f80fef683ab5
(sql-interactive-mode-map): Use fboundp.
Richard M. Stallman <rms@gnu.org>
parents:
64699
diff
changeset
|
1021 (if (fboundp 'set-keymap-name) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1022 (set-keymap-name map 'sql-interactive-mode-map)); XEmacs |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1023 (define-key map (kbd "C-j") 'sql-accumulate-and-indent) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1024 (define-key map (kbd "C-c C-w") 'sql-copy-column) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1025 (define-key map (kbd "O") 'sql-magic-go) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1026 (define-key map (kbd "o") 'sql-magic-go) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1027 (define-key map (kbd ";") 'sql-magic-semicolon) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1028 map) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1029 "Mode map used for `sql-interactive-mode'. |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1030 Based on `comint-mode-map'.") |
24050 | 1031 |
1032 ;; Keymap for sql-mode. | |
1033 | |
1034 (defvar sql-mode-map | |
1035 (let ((map (make-sparse-keymap))) | |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1036 (define-key map (kbd "C-c C-c") 'sql-send-paragraph) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1037 (define-key map (kbd "C-c C-r") 'sql-send-region) |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1038 (define-key map (kbd "C-c C-s") 'sql-send-string) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1039 (define-key map (kbd "C-c C-b") 'sql-send-buffer) |
108381 | 1040 (define-key map (kbd "C-c C-i") 'sql-product-interactive) |
24050 | 1041 map) |
1042 "Mode map used for `sql-mode'.") | |
1043 | |
1044 ;; easy menu for sql-mode. | |
1045 | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
1046 (easy-menu-define |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
1047 sql-mode-menu sql-mode-map |
24050 | 1048 "Menu for `sql-mode'." |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1049 `("SQL" |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1050 ["Send Paragraph" sql-send-paragraph (and (buffer-live-p sql-buffer) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1051 (get-buffer-process sql-buffer))] |
108381 | 1052 ["Send Region" sql-send-region (and mark-active |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1053 (buffer-live-p sql-buffer) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1054 (get-buffer-process sql-buffer))] |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1055 ["Send Buffer" sql-send-buffer (and (buffer-live-p sql-buffer) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1056 (get-buffer-process sql-buffer))] |
108381 | 1057 ["Send String" sql-send-string (and (buffer-live-p sql-buffer) |
1058 (get-buffer-process sql-buffer))] | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1059 ["--" nil nil] |
108381 | 1060 ["Start SQLi session" sql-product-interactive (sql-get-product-feature sql-product :sqli-connect-func)] |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1061 ["Show SQLi buffer" sql-show-sqli-buffer t] |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1062 ["Set SQLi buffer" sql-set-sqli-buffer t] |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
1063 ["Pop to SQLi buffer after send" |
24050 | 1064 sql-toggle-pop-to-buffer-after-send-region |
1065 :style toggle | |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
1066 :selected sql-pop-to-buffer-after-send-region] |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1067 ["--" nil nil] |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1068 ("Product" |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1069 ,@(mapcar (lambda (prod-info) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1070 (let* ((prod (pop prod-info)) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1071 (name (or (plist-get prod-info :name) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1072 (capitalize (symbol-name prod)))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1073 (cmd (intern (format "sql-highlight-%s-keywords" prod)))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1074 (fset cmd `(lambda () ,(format "Highlight %s SQL keywords." name) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1075 (interactive) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1076 (sql-set-product ',prod))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1077 (vector name cmd |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1078 :style 'radio |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1079 :selected `(eq sql-product ',prod)))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1080 sql-product-alist)))) |
24050 | 1081 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1082 ;; easy menu for sql-interactive-mode. |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1083 |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
1084 (easy-menu-define |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1085 sql-interactive-mode-menu sql-interactive-mode-map |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1086 "Menu for `sql-interactive-mode'." |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1087 '("SQL" |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1088 ["Rename Buffer" sql-rename-buffer t])) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1089 |
24050 | 1090 ;; Abbreviations -- if you want more of them, define them in your |
1091 ;; ~/.emacs file. Abbrevs have to be enabled in your ~/.emacs, too. | |
1092 | |
1093 (defvar sql-mode-abbrev-table nil | |
1094 "Abbrev table used in `sql-mode' and `sql-interactive-mode'.") | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1095 (unless sql-mode-abbrev-table |
74433
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1096 (define-abbrev-table 'sql-mode-abbrev-table nil)) |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1097 |
84922
1b6b77d0f75a
(top): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
1098 (mapc |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1099 ;; In Emacs 22+, provide SYSTEM-FLAG to define-abbrev. |
74433
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1100 '(lambda (abbrev) |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1101 (let ((name (car abbrev)) |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1102 (expansion (cdr abbrev))) |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1103 (condition-case nil |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1104 (define-abbrev sql-mode-abbrev-table name expansion nil 0 t) |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1105 (error |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1106 (define-abbrev sql-mode-abbrev-table name expansion))))) |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1107 '(("ins" . "insert") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1108 ("upd" . "update") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1109 ("del" . "delete") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1110 ("sel" . "select") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1111 ("proc" . "procedure") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1112 ("func" . "function") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1113 ("cr" . "create"))) |
24050 | 1114 |
1115 ;; Syntax Table | |
1116 | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
1117 (defvar sql-mode-syntax-table |
24050 | 1118 (let ((table (make-syntax-table))) |
1119 ;; C-style comments /**/ (see elisp manual "Syntax Flags")) | |
1120 (modify-syntax-entry ?/ ". 14" table) | |
1121 (modify-syntax-entry ?* ". 23" table) | |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1122 ;; double-dash starts comments |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
1123 (modify-syntax-entry ?- ". 12b" table) |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1124 ;; newline and formfeed end comments |
24050 | 1125 (modify-syntax-entry ?\n "> b" table) |
1126 (modify-syntax-entry ?\f "> b" table) | |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1127 ;; single quotes (') delimit strings |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
1128 (modify-syntax-entry ?' "\"" table) |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1129 ;; double quotes (") don't delimit strings |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1130 (modify-syntax-entry ?\" "." table) |
40971
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
1131 ;; backslash is no escape character |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
1132 (modify-syntax-entry ?\\ "." table) |
24050 | 1133 table) |
1134 "Syntax table used in `sql-mode' and `sql-interactive-mode'.") | |
1135 | |
1136 ;; Font lock support | |
1137 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1138 (defvar sql-mode-font-lock-object-name |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1139 (eval-when-compile |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1140 (list (concat "^\\s-*\\(?:create\\|drop\\|alter\\)\\s-+" ;; lead off with CREATE, DROP or ALTER |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1141 "\\(?:\\w+\\s-+\\)*" ;; optional intervening keywords |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1142 "\\(?:table\\|view\\|\\(?:package\\|type\\)\\(?:\\s-+body\\)?\\|proc\\(?:edure\\)?" |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1143 "\\|function\\|trigger\\|sequence\\|rule\\|default\\)\\s-+" |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1144 "\\(\\w+\\)") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1145 1 'font-lock-function-name-face)) |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1146 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1147 "Pattern to match the names of top-level objects. |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1148 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1149 The pattern matches the name in a CREATE, DROP or ALTER |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1150 statement. The format of variable should be a valid |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1151 `font-lock-keywords' entry.") |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1152 |
108381 | 1153 ;; While there are international and American standards for SQL, they |
1154 ;; are not followed closely, and most vendors offer significant | |
1155 ;; capabilities beyond those defined in the standard specifications. | |
1156 | |
1157 ;; SQL mode provides support for hilighting based on the product. In | |
1158 ;; addition to hilighting the product keywords, any ANSI keywords not | |
1159 ;; used by the product are also hilighted. This will help identify | |
1160 ;; keywords that could be restricted in future versions of the product | |
1161 ;; or might be a problem if ported to another product. | |
1162 | |
1163 ;; To reduce the complexity and size of the regular expressions | |
1164 ;; generated to match keywords, ANSI keywords are filtered out of | |
1165 ;; product keywords if they are equivalent. To do this, we define a | |
1166 ;; function `sql-font-lock-keywords-builder' that removes any keywords | |
1167 ;; that are matched by the ANSI patterns and results in the same face | |
1168 ;; being applied. For this to work properly, we must play some games | |
1169 ;; with the execution and compile time behavior. This code is a | |
1170 ;; little tricky but works properly. | |
1171 | |
1172 ;; When defining the keywords for individual products you should | |
1173 ;; include all of the keywords that you want matched. The filtering | |
1174 ;; against the ANSI keywords will be automatic if you use the | |
1175 ;; `sql-font-lock-keywords-builder' function and follow the | |
1176 ;; implementation pattern used for the other products in this file. | |
1177 | |
1178 (eval-when-compile | |
1179 (defvar sql-mode-ansi-font-lock-keywords) | |
1180 (setq sql-mode-ansi-font-lock-keywords nil)) | |
1181 | |
1182 (eval-and-compile | |
1183 (defun sql-font-lock-keywords-builder (face boundaries &rest keywords) | |
1184 "Generation of regexp matching any one of KEYWORDS." | |
1185 | |
1186 (let ((bdy (or boundaries '("\\b" . "\\b"))) | |
1187 kwd) | |
1188 | |
1189 ;; Remove keywords that are defined in ANSI | |
1190 (setq kwd keywords) | |
1191 (dolist (k keywords) | |
1192 (catch 'next | |
1193 (dolist (a sql-mode-ansi-font-lock-keywords) | |
1194 (when (and (eq face (cdr a)) | |
1195 (eq (string-match (car a) k 0) 0) | |
1196 (eq (match-end 0) (length k))) | |
1197 (setq kwd (delq k kwd)) | |
1198 (throw 'next nil))))) | |
1199 | |
1200 ;; Create a properly formed font-lock-keywords item | |
1201 (cons (concat (car bdy) | |
1202 (regexp-opt kwd t) | |
1203 (cdr bdy)) | |
1204 face)))) | |
1205 | |
1206 (eval-when-compile | |
1207 (setq sql-mode-ansi-font-lock-keywords | |
1208 (list | |
1209 ;; ANSI Non Reserved keywords | |
1210 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1211 "ada" "asensitive" "assignment" "asymmetric" "atomic" "between" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1212 "bitvar" "called" "catalog_name" "chain" "character_set_catalog" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1213 "character_set_name" "character_set_schema" "checked" "class_origin" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1214 "cobol" "collation_catalog" "collation_name" "collation_schema" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1215 "column_name" "command_function" "command_function_code" "committed" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1216 "condition_number" "connection_name" "constraint_catalog" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1217 "constraint_name" "constraint_schema" "contains" "cursor_name" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1218 "datetime_interval_code" "datetime_interval_precision" "defined" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1219 "definer" "dispatch" "dynamic_function" "dynamic_function_code" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1220 "existing" "exists" "final" "fortran" "generated" "granted" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1221 "hierarchy" "hold" "implementation" "infix" "insensitive" "instance" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1222 "instantiable" "invoker" "key_member" "key_type" "length" "m" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1223 "message_length" "message_octet_length" "message_text" "method" "more" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1224 "mumps" "name" "nullable" "number" "options" "overlaps" "overriding" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1225 "parameter_mode" "parameter_name" "parameter_ordinal_position" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1226 "parameter_specific_catalog" "parameter_specific_name" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1227 "parameter_specific_schema" "pascal" "pli" "position" "repeatable" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1228 "returned_length" "returned_octet_length" "returned_sqlstate" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1229 "routine_catalog" "routine_name" "routine_schema" "row_count" "scale" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1230 "schema_name" "security" "self" "sensitive" "serializable" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1231 "server_name" "similar" "simple" "source" "specific_name" "style" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1232 "subclass_origin" "sublist" "symmetric" "system" "table_name" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1233 "transaction_active" "transactions_committed" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1234 "transactions_rolled_back" "transform" "transforms" "trigger_catalog" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1235 "trigger_name" "trigger_schema" "type" "uncommitted" "unnamed" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1236 "user_defined_type_catalog" "user_defined_type_name" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1237 "user_defined_type_schema" |
108381 | 1238 ) |
1239 ;; ANSI Reserved keywords | |
1240 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1241 "absolute" "action" "add" "admin" "after" "aggregate" "alias" "all" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1242 "allocate" "alter" "and" "any" "are" "as" "asc" "assertion" "at" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1243 "authorization" "before" "begin" "both" "breadth" "by" "call" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1244 "cascade" "cascaded" "case" "catalog" "check" "class" "close" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1245 "collate" "collation" "column" "commit" "completion" "connect" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1246 "connection" "constraint" "constraints" "constructor" "continue" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1247 "corresponding" "create" "cross" "cube" "current" "cursor" "cycle" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1248 "data" "day" "deallocate" "declare" "default" "deferrable" "deferred" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1249 "delete" "depth" "deref" "desc" "describe" "descriptor" "destroy" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1250 "destructor" "deterministic" "diagnostics" "dictionary" "disconnect" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1251 "distinct" "domain" "drop" "dynamic" "each" "else" "end" "equals" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1252 "escape" "every" "except" "exception" "exec" "execute" "external" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1253 "false" "fetch" "first" "for" "foreign" "found" "free" "from" "full" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1254 "function" "general" "get" "global" "go" "goto" "grant" "group" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1255 "grouping" "having" "host" "hour" "identity" "ignore" "immediate" "in" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1256 "indicator" "initialize" "initially" "inner" "inout" "input" "insert" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1257 "intersect" "into" "is" "isolation" "iterate" "join" "key" "language" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1258 "last" "lateral" "leading" "left" "less" "level" "like" "limit" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1259 "local" "locator" "map" "match" "minute" "modifies" "modify" "module" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1260 "month" "names" "natural" "new" "next" "no" "none" "not" "null" "of" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1261 "off" "old" "on" "only" "open" "operation" "option" "or" "order" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1262 "ordinality" "out" "outer" "output" "pad" "parameter" "parameters" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1263 "partial" "path" "postfix" "prefix" "preorder" "prepare" "preserve" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1264 "primary" "prior" "privileges" "procedure" "public" "read" "reads" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1265 "recursive" "references" "referencing" "relative" "restrict" "result" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1266 "return" "returns" "revoke" "right" "role" "rollback" "rollup" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1267 "routine" "rows" "savepoint" "schema" "scroll" "search" "second" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1268 "section" "select" "sequence" "session" "set" "sets" "size" "some" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1269 "space" "specific" "specifictype" "sql" "sqlexception" "sqlstate" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1270 "sqlwarning" "start" "state" "statement" "static" "structure" "table" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1271 "temporary" "terminate" "than" "then" "timezone_hour" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1272 "timezone_minute" "to" "trailing" "transaction" "translation" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1273 "trigger" "true" "under" "union" "unique" "unknown" "unnest" "update" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1274 "usage" "using" "value" "values" "variable" "view" "when" "whenever" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1275 "where" "with" "without" "work" "write" "year" |
108381 | 1276 ) |
1277 | |
1278 ;; ANSI Functions | |
1279 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | |
1280 "abs" "avg" "bit_length" "cardinality" "cast" "char_length" | |
1281 "character_length" "coalesce" "convert" "count" "current_date" | |
1282 "current_path" "current_role" "current_time" "current_timestamp" | |
1283 "current_user" "extract" "localtime" "localtimestamp" "lower" "max" | |
1284 "min" "mod" "nullif" "octet_length" "overlay" "placing" "session_user" | |
1285 "substring" "sum" "system_user" "translate" "treat" "trim" "upper" | |
1286 "user" | |
1287 ) | |
1288 ;; ANSI Data Types | |
1289 (sql-font-lock-keywords-builder 'font-lock-type-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1290 "array" "binary" "bit" "blob" "boolean" "char" "character" "clob" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1291 "date" "dec" "decimal" "double" "float" "int" "integer" "interval" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1292 "large" "national" "nchar" "nclob" "numeric" "object" "precision" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1293 "real" "ref" "row" "scope" "smallint" "time" "timestamp" "varchar" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1294 "varying" "zone" |
108381 | 1295 )))) |
1296 | |
1297 (defvar sql-mode-ansi-font-lock-keywords | |
1298 (eval-when-compile sql-mode-ansi-font-lock-keywords) | |
24050 | 1299 "ANSI SQL keywords used by font-lock. |
1300 | |
1301 This variable is used by `sql-mode' and `sql-interactive-mode'. The | |
1302 regular expressions are created during compilation by calling the | |
1303 function `regexp-opt'. Therefore, take a look at the source before | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1304 you define your own `sql-mode-ansi-font-lock-keywords'. You may want |
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1305 to add functions and PL/SQL keywords.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1306 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1307 (defvar sql-mode-oracle-font-lock-keywords |
108381 | 1308 (eval-when-compile |
1309 (list | |
1310 ;; Oracle SQL*Plus Commands | |
1311 (cons | |
1312 (concat | |
1313 "^\\(?:\\(?:" (regexp-opt '( | |
1314 "@" "@@" "accept" "append" "archive" "attribute" "break" | |
1315 "btitle" "change" "clear" "column" "connect" "copy" "define" | |
1316 "del" "describe" "disconnect" "edit" "execute" "exit" "get" "help" | |
1317 "host" "input" "list" "password" "pause" "print" "prompt" "recover" | |
1318 "remark" "repfooter" "repheader" "run" "save" "show" "shutdown" | |
1319 "spool" "start" "startup" "store" "timing" "ttitle" "undefine" | |
1320 "variable" "whenever" | |
1321 ) t) | |
1322 | |
1323 "\\)\\|" | |
1324 "\\(?:compute\\s-+\\(?:avg\\|cou\\|min\\|max\\|num\\|sum\\|std\\|var\\)\\)\\|" | |
1325 "\\(?:set\\s-+\\(" | |
1326 | |
1327 (regexp-opt | |
1328 '("appi" "appinfo" "array" "arraysize" "auto" "autocommit" | |
1329 "autop" "autoprint" "autorecovery" "autot" "autotrace" "blo" | |
1330 "blockterminator" "buffer" "closecursor" "cmds" "cmdsep" | |
1331 "colsep" "com" "compatibility" "con" "concat" "constraint" | |
1332 "constraints" "copyc" "copycommit" "copytypecheck" "database" | |
1333 "def" "define" "document" "echo" "editf" "editfile" "emb" | |
1334 "embedded" "esc" "escape" "feed" "feedback" "flagger" "flu" | |
1335 "flush" "hea" "heading" "heads" "headsep" "instance" "lin" | |
1336 "linesize" "lobof" "loboffset" "logsource" "long" "longc" | |
1337 "longchunksize" "maxdata" "newp" "newpage" "null" "num" | |
1338 "numf" "numformat" "numwidth" "pages" "pagesize" "pau" | |
1339 "pause" "recsep" "recsepchar" "role" "scan" "serveroutput" | |
1340 "shift" "shiftinout" "show" "showmode" "space" "sqlbl" | |
1341 "sqlblanklines" "sqlc" "sqlcase" "sqlco" "sqlcontinue" "sqln" | |
1342 "sqlnumber" "sqlp" "sqlpluscompat" "sqlpluscompatibility" | |
1343 "sqlpre" "sqlprefix" "sqlprompt" "sqlt" "sqlterminator" | |
1344 "statement_id" "suf" "suffix" "tab" "term" "termout" "ti" | |
1345 "time" "timi" "timing" "transaction" "trim" "trimout" "trims" | |
1346 "trimspool" "truncate" "und" "underline" "ver" "verify" "wra" | |
1347 "wrap")) "\\)\\)" | |
1348 | |
1349 "\\)\\b.*" | |
1350 ) | |
1351 'font-lock-doc-face) | |
1352 '("^[ \t]*rem\\(?:ark\\)?.*" . font-lock-comment-face) | |
1353 | |
1354 ;; Oracle Functions | |
1355 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1356 "abs" "acos" "add_months" "ascii" "asciistr" "asin" "atan" "atan2" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1357 "avg" "bfilename" "bin_to_num" "bitand" "cast" "ceil" "chartorowid" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1358 "chr" "coalesce" "compose" "concat" "convert" "corr" "cos" "cosh" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1359 "count" "covar_pop" "covar_samp" "cume_dist" "current_date" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1360 "current_timestamp" "current_user" "dbtimezone" "decode" "decompose" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1361 "dense_rank" "depth" "deref" "dump" "empty_clob" "existsnode" "exp" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1362 "extract" "extractvalue" "first" "first_value" "floor" "following" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1363 "from_tz" "greatest" "group_id" "grouping_id" "hextoraw" "initcap" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1364 "instr" "lag" "last" "last_day" "last_value" "lead" "least" "length" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1365 "ln" "localtimestamp" "lower" "lpad" "ltrim" "make_ref" "max" "min" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1366 "mod" "months_between" "new_time" "next_day" "nls_charset_decl_len" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1367 "nls_charset_id" "nls_charset_name" "nls_initcap" "nls_lower" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1368 "nls_upper" "nlssort" "ntile" "nullif" "numtodsinterval" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1369 "numtoyminterval" "nvl" "nvl2" "over" "path" "percent_rank" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1370 "percentile_cont" "percentile_disc" "power" "preceding" "rank" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1371 "ratio_to_report" "rawtohex" "rawtonhex" "reftohex" "regr_" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1372 "regr_avgx" "regr_avgy" "regr_count" "regr_intercept" "regr_r2" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1373 "regr_slope" "regr_sxx" "regr_sxy" "regr_syy" "replace" "round" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1374 "row_number" "rowidtochar" "rowidtonchar" "rpad" "rtrim" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1375 "sessiontimezone" "sign" "sin" "sinh" "soundex" "sqrt" "stddev" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1376 "stddev_pop" "stddev_samp" "substr" "sum" "sys_connect_by_path" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1377 "sys_context" "sys_dburigen" "sys_extract_utc" "sys_guid" "sys_typeid" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1378 "sys_xmlagg" "sys_xmlgen" "sysdate" "systimestamp" "tan" "tanh" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1379 "to_char" "to_clob" "to_date" "to_dsinterval" "to_lob" "to_multi_byte" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1380 "to_nchar" "to_nclob" "to_number" "to_single_byte" "to_timestamp" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1381 "to_timestamp_tz" "to_yminterval" "translate" "treat" "trim" "trunc" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1382 "tz_offset" "uid" "unbounded" "unistr" "updatexml" "upper" "user" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1383 "userenv" "var_pop" "var_samp" "variance" "vsize" "width_bucket" "xml" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1384 "xmlagg" "xmlattribute" "xmlcolattval" "xmlconcat" "xmlelement" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1385 "xmlforest" "xmlsequence" "xmltransform" |
108381 | 1386 ) |
1387 ;; Oracle Keywords | |
1388 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1389 "abort" "access" "accessed" "account" "activate" "add" "admin" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1390 "advise" "after" "agent" "aggregate" "all" "allocate" "allow" "alter" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1391 "always" "analyze" "ancillary" "and" "any" "apply" "archive" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1392 "archivelog" "array" "as" "asc" "associate" "at" "attribute" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1393 "attributes" "audit" "authenticated" "authid" "authorization" "auto" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1394 "autoallocate" "automatic" "availability" "backup" "before" "begin" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1395 "behalf" "between" "binding" "bitmap" "block" "blocksize" "body" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1396 "both" "buffer_pool" "build" "by" "cache" "call" "cancel" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1397 "cascade" "case" "category" "certificate" "chained" "change" "check" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1398 "checkpoint" "child" "chunk" "class" "clear" "clone" "close" "cluster" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1399 "column" "column_value" "columns" "comment" "commit" "committed" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1400 "compatibility" "compile" "complete" "composite_limit" "compress" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1401 "compute" "connect" "connect_time" "consider" "consistent" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1402 "constraint" "constraints" "constructor" "contents" "context" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1403 "continue" "controlfile" "corruption" "cost" "cpu_per_call" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1404 "cpu_per_session" "create" "cross" "cube" "current" "currval" "cycle" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1405 "dangling" "data" "database" "datafile" "datafiles" "day" "ddl" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1406 "deallocate" "debug" "default" "deferrable" "deferred" "definer" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1407 "delay" "delete" "demand" "desc" "determines" "deterministic" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1408 "dictionary" "dimension" "directory" "disable" "disassociate" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1409 "disconnect" "distinct" "distinguished" "distributed" "dml" "drop" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1410 "each" "element" "else" "enable" "end" "equals_path" "escape" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1411 "estimate" "except" "exceptions" "exchange" "excluding" "exists" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1412 "expire" "explain" "extent" "external" "externally" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1413 "failed_login_attempts" "fast" "file" "final" "finish" "flush" "for" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1414 "force" "foreign" "freelist" "freelists" "freepools" "fresh" "from" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1415 "full" "function" "functions" "generated" "global" "global_name" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1416 "globally" "grant" "group" "grouping" "groups" "guard" "hash" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1417 "hashkeys" "having" "heap" "hierarchy" "id" "identified" "identifier" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1418 "idle_time" "immediate" "in" "including" "increment" "index" "indexed" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1419 "indexes" "indextype" "indextypes" "indicator" "initial" "initialized" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1420 "initially" "initrans" "inner" "insert" "instance" "instantiable" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1421 "instead" "intersect" "into" "invalidate" "is" "isolation" "java" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1422 "join" "keep" "key" "kill" "language" "left" "less" "level" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1423 "levels" "library" "like" "like2" "like4" "likec" "limit" "link" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1424 "list" "lob" "local" "location" "locator" "lock" "log" "logfile" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1425 "logging" "logical" "logical_reads_per_call" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1426 "logical_reads_per_session" "managed" "management" "manual" "map" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1427 "mapping" "master" "matched" "materialized" "maxdatafiles" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1428 "maxextents" "maximize" "maxinstances" "maxlogfiles" "maxloghistory" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1429 "maxlogmembers" "maxsize" "maxtrans" "maxvalue" "member" "memory" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1430 "merge" "migrate" "minextents" "minimize" "minimum" "minus" "minvalue" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1431 "mode" "modify" "monitoring" "month" "mount" "move" "movement" "name" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1432 "named" "natural" "nested" "never" "new" "next" "nextval" "no" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1433 "noarchivelog" "noaudit" "nocache" "nocompress" "nocopy" "nocycle" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1434 "nodelay" "noforce" "nologging" "nomapping" "nomaxvalue" "nominimize" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1435 "nominvalue" "nomonitoring" "none" "noorder" "noparallel" "norely" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1436 "noresetlogs" "noreverse" "normal" "norowdependencies" "nosort" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1437 "noswitch" "not" "nothing" "notimeout" "novalidate" "nowait" "null" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1438 "nulls" "object" "of" "off" "offline" "oidindex" "old" "on" "online" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1439 "only" "open" "operator" "optimal" "option" "or" "order" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1440 "organization" "out" "outer" "outline" "overflow" "overriding" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1441 "package" "packages" "parallel" "parallel_enable" "parameters" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1442 "parent" "partition" "partitions" "password" "password_grace_time" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1443 "password_life_time" "password_lock_time" "password_reuse_max" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1444 "password_reuse_time" "password_verify_function" "pctfree" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1445 "pctincrease" "pctthreshold" "pctused" "pctversion" "percent" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1446 "performance" "permanent" "pfile" "physical" "pipelined" "plan" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1447 "post_transaction" "pragma" "prebuilt" "preserve" "primary" "private" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1448 "private_sga" "privileges" "procedure" "profile" "protection" "public" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1449 "purge" "query" "quiesce" "quota" "range" "read" "reads" "rebuild" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1450 "records_per_block" "recover" "recovery" "recycle" "reduced" "ref" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1451 "references" "referencing" "refresh" "register" "reject" "relational" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1452 "rely" "rename" "reset" "resetlogs" "resize" "resolve" "resolver" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1453 "resource" "restrict" "restrict_references" "restricted" "result" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1454 "resumable" "resume" "retention" "return" "returning" "reuse" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1455 "reverse" "revoke" "rewrite" "right" "rnds" "rnps" "role" "roles" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1456 "rollback" "rollup" "row" "rowdependencies" "rownum" "rows" "sample" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1457 "savepoint" "scan" "schema" "scn" "scope" "segment" "select" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1458 "selectivity" "self" "sequence" "serializable" "session" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1459 "sessions_per_user" "set" "sets" "settings" "shared" "shared_pool" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1460 "shrink" "shutdown" "siblings" "sid" "single" "size" "skip" "some" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1461 "sort" "source" "space" "specification" "spfile" "split" "standby" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1462 "start" "statement_id" "static" "statistics" "stop" "storage" "store" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1463 "structure" "subpartition" "subpartitions" "substitutable" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1464 "successful" "supplemental" "suspend" "switch" "switchover" "synonym" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1465 "sys" "system" "table" "tables" "tablespace" "tempfile" "template" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1466 "temporary" "test" "than" "then" "thread" "through" "time_zone" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1467 "timeout" "to" "trace" "transaction" "trigger" "triggers" "truncate" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1468 "trust" "type" "types" "unarchived" "under" "under_path" "undo" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1469 "uniform" "union" "unique" "unlimited" "unlock" "unquiesce" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1470 "unrecoverable" "until" "unusable" "unused" "update" "upgrade" "usage" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1471 "use" "using" "validate" "validation" "value" "values" "variable" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1472 "varray" "version" "view" "wait" "when" "whenever" "where" "with" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1473 "without" "wnds" "wnps" "work" "write" "xmldata" "xmlschema" "xmltype" |
108381 | 1474 ) |
1475 ;; Oracle Data Types | |
1476 (sql-font-lock-keywords-builder 'font-lock-type-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1477 "bfile" "blob" "byte" "char" "character" "clob" "date" "dec" "decimal" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1478 "double" "float" "int" "integer" "interval" "long" "national" "nchar" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1479 "nclob" "number" "numeric" "nvarchar2" "precision" "raw" "real" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1480 "rowid" "second" "smallint" "time" "timestamp" "urowid" "varchar" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1481 "varchar2" "varying" "year" "zone" |
108381 | 1482 ) |
1483 | |
1484 ;; Oracle PL/SQL Attributes | |
1485 (sql-font-lock-keywords-builder 'font-lock-builtin-face '("" . "\\b") | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1486 "%bulk_rowcount" "%found" "%isopen" "%notfound" "%rowcount" "%rowtype" |
108381 | 1487 "%type" |
1488 ) | |
1489 | |
1490 ;; Oracle PL/SQL Functions | |
1491 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | |
1492 "extend" "prior" | |
1493 ) | |
1494 | |
1495 ;; Oracle PL/SQL Keywords | |
1496 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1497 "autonomous_transaction" "bulk" "char_base" "collect" "constant" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1498 "cursor" "declare" "do" "elsif" "exception_init" "execute" "exit" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1499 "extends" "false" "fetch" "forall" "goto" "hour" "if" "interface" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1500 "loop" "minute" "number_base" "ocirowid" "opaque" "others" "rowtype" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1501 "separate" "serially_reusable" "sql" "sqlcode" "sqlerrm" "subtype" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1502 "the" "timezone_abbr" "timezone_hour" "timezone_minute" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1503 "timezone_region" "true" "varrying" "while" |
108381 | 1504 ) |
1505 | |
1506 ;; Oracle PL/SQL Data Types | |
1507 (sql-font-lock-keywords-builder 'font-lock-type-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1508 "binary_integer" "boolean" "naturaln" "pls_integer" "positive" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1509 "positiven" "record" "signtype" "string" |
108381 | 1510 ) |
1511 | |
1512 ;; Oracle PL/SQL Exceptions | |
1513 (sql-font-lock-keywords-builder 'font-lock-warning-face nil | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1514 "access_into_null" "case_not_found" "collection_is_null" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1515 "cursor_already_open" "dup_val_on_index" "invalid_cursor" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1516 "invalid_number" "login_denied" "no_data_found" "not_logged_on" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1517 "program_error" "rowtype_mismatch" "self_is_null" "storage_error" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1518 "subscript_beyond_count" "subscript_outside_limit" "sys_invalid_rowid" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1519 "timeout_on_resource" "too_many_rows" "value_error" "zero_divide" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1520 "exception" "notfound" |
108381 | 1521 ))) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1522 |
24050 | 1523 "Oracle SQL keywords used by font-lock. |
1524 | |
1525 This variable is used by `sql-mode' and `sql-interactive-mode'. The | |
1526 regular expressions are created during compilation by calling the | |
1527 function `regexp-opt'. Therefore, take a look at the source before | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1528 you define your own `sql-mode-oracle-font-lock-keywords'. You may want |
24050 | 1529 to add functions and PL/SQL keywords.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1530 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1531 (defvar sql-mode-postgres-font-lock-keywords |
108381 | 1532 (eval-when-compile |
1533 (list | |
1534 ;; Postgres Functions | |
1535 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1536 "abbrev" "abs" "acos" "age" "area" "ascii" "asin" "atab2" "atan" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1537 "atan2" "avg" "bit_length" "both" "broadcast" "btrim" "cbrt" "ceil" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1538 "center" "char_length" "chr" "coalesce" "col_description" "convert" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1539 "cos" "cot" "count" "current_database" "current_date" "current_schema" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1540 "current_schemas" "current_setting" "current_time" "current_timestamp" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1541 "current_user" "currval" "date_part" "date_trunc" "decode" "degrees" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1542 "diameter" "encode" "exp" "extract" "floor" "get_bit" "get_byte" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1543 "has_database_privilege" "has_function_privilege" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1544 "has_language_privilege" "has_schema_privilege" "has_table_privilege" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1545 "height" "host" "initcap" "isclosed" "isfinite" "isopen" "leading" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1546 "length" "ln" "localtime" "localtimestamp" "log" "lower" "lpad" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1547 "ltrim" "masklen" "max" "min" "mod" "netmask" "network" "nextval" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1548 "now" "npoints" "nullif" "obj_description" "octet_length" "overlay" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1549 "pclose" "pg_client_encoding" "pg_function_is_visible" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1550 "pg_get_constraintdef" "pg_get_indexdef" "pg_get_ruledef" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1551 "pg_get_userbyid" "pg_get_viewdef" "pg_opclass_is_visible" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1552 "pg_operator_is_visible" "pg_table_is_visible" "pg_type_is_visible" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1553 "pi" "popen" "position" "pow" "quote_ident" "quote_literal" "radians" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1554 "radius" "random" "repeat" "replace" "round" "rpad" "rtrim" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1555 "session_user" "set_bit" "set_byte" "set_config" "set_masklen" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1556 "setval" "sign" "sin" "split_part" "sqrt" "stddev" "strpos" "substr" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1557 "substring" "sum" "tan" "timeofday" "to_ascii" "to_char" "to_date" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1558 "to_hex" "to_number" "to_timestamp" "trailing" "translate" "trim" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1559 "trunc" "upper" "variance" "version" "width" |
108381 | 1560 ) |
1561 ;; Postgres Reserved | |
1562 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1563 "abort" "access" "add" "after" "aggregate" "alignment" "all" "alter" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1564 "analyze" "and" "any" "as" "asc" "assignment" "authorization" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1565 "backward" "basetype" "before" "begin" "between" "binary" "by" "cache" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1566 "called" "cascade" "case" "cast" "characteristics" "check" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1567 "checkpoint" "class" "close" "cluster" "column" "comment" "commit" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1568 "committed" "commutator" "constraint" "constraints" "conversion" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1569 "copy" "create" "createdb" "createuser" "cursor" "cycle" "database" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1570 "deallocate" "declare" "default" "deferrable" "deferred" "definer" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1571 "delete" "delimiter" "desc" "distinct" "do" "domain" "drop" "each" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1572 "element" "else" "encoding" "encrypted" "end" "escape" "except" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1573 "exclusive" "execute" "exists" "explain" "extended" "external" "false" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1574 "fetch" "finalfunc" "for" "force" "foreign" "forward" "freeze" "from" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1575 "full" "function" "grant" "group" "gtcmp" "handler" "hashes" "having" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1576 "immediate" "immutable" "implicit" "in" "increment" "index" "inherits" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1577 "initcond" "initially" "input" "insensitive" "insert" "instead" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1578 "internallength" "intersect" "into" "invoker" "is" "isnull" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1579 "isolation" "join" "key" "language" "leftarg" "level" "like" "limit" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1580 "listen" "load" "local" "location" "lock" "ltcmp" "main" "match" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1581 "maxvalue" "merges" "minvalue" "mode" "move" "natural" "negator" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1582 "next" "nocreatedb" "nocreateuser" "none" "not" "nothing" "notify" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1583 "notnull" "null" "of" "offset" "oids" "on" "only" "operator" "or" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1584 "order" "output" "owner" "partial" "passedbyvalue" "password" "plain" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1585 "prepare" "primary" "prior" "privileges" "procedural" "procedure" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1586 "public" "read" "recheck" "references" "reindex" "relative" "rename" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1587 "reset" "restrict" "returns" "revoke" "rightarg" "rollback" "row" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1588 "rule" "schema" "scroll" "security" "select" "sequence" "serializable" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1589 "session" "set" "sfunc" "share" "show" "similar" "some" "sort1" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1590 "sort2" "stable" "start" "statement" "statistics" "storage" "strict" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1591 "stype" "sysid" "table" "temp" "template" "temporary" "then" "to" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1592 "transaction" "trigger" "true" "truncate" "trusted" "type" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1593 "unencrypted" "union" "unique" "unknown" "unlisten" "until" "update" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1594 "usage" "user" "using" "vacuum" "valid" "validator" "values" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1595 "variable" "verbose" "view" "volatile" "when" "where" "with" "without" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1596 "work" |
108381 | 1597 ) |
1598 | |
1599 ;; Postgres Data Types | |
1600 (sql-font-lock-keywords-builder 'font-lock-type-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1601 "anyarray" "bigint" "bigserial" "bit" "boolean" "box" "bytea" "char" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1602 "character" "cidr" "circle" "cstring" "date" "decimal" "double" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1603 "float4" "float8" "inet" "int2" "int4" "int8" "integer" "internal" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1604 "interval" "language_handler" "line" "lseg" "macaddr" "money" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1605 "numeric" "oid" "opaque" "path" "point" "polygon" "precision" "real" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1606 "record" "regclass" "regoper" "regoperator" "regproc" "regprocedure" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1607 "regtype" "serial" "serial4" "serial8" "smallint" "text" "time" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1608 "timestamp" "varchar" "varying" "void" "zone" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1609 ))) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1610 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1611 "Postgres SQL keywords used by font-lock. |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1612 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1613 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1614 regular expressions are created during compilation by calling the |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1615 function `regexp-opt'. Therefore, take a look at the source before |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1616 you define your own `sql-mode-postgres-font-lock-keywords'.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1617 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1618 (defvar sql-mode-linter-font-lock-keywords |
108381 | 1619 (eval-when-compile |
1620 (list | |
1621 ;; Linter Keywords | |
1622 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1623 "autocommit" "autoinc" "autorowid" "cancel" "cascade" "channel" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1624 "committed" "count" "countblob" "cross" "current" "data" "database" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1625 "datafile" "datafiles" "datesplit" "dba" "dbname" "default" "deferred" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1626 "denied" "description" "device" "difference" "directory" "error" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1627 "escape" "euc" "exclusive" "external" "extfile" "false" "file" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1628 "filename" "filesize" "filetime" "filter" "findblob" "first" "foreign" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1629 "full" "fuzzy" "global" "granted" "ignore" "immediate" "increment" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1630 "indexes" "indexfile" "indexfiles" "indextime" "initial" "integrity" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1631 "internal" "key" "last_autoinc" "last_rowid" "limit" "linter" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1632 "linter_file_device" "linter_file_size" "linter_name_length" "ln" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1633 "local" "login" "maxisn" "maxrow" "maxrowid" "maxvalue" "message" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1634 "minvalue" "module" "names" "national" "natural" "new" "new_table" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1635 "no" "node" "noneuc" "nulliferror" "numbers" "off" "old" "old_table" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1636 "only" "operation" "optimistic" "option" "page" "partially" "password" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1637 "phrase" "plan" "precision" "primary" "priority" "privileges" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1638 "proc_info_size" "proc_par_name_len" "protocol" "quant" "range" "raw" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1639 "read" "record" "records" "references" "remote" "rename" "replication" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1640 "restart" "rewrite" "root" "row" "rule" "savepoint" "security" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1641 "sensitive" "sequence" "serializable" "server" "since" "size" "some" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1642 "startup" "statement" "station" "success" "sys_guid" "tables" "test" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1643 "timeout" "trace" "transaction" "translation" "trigger" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1644 "trigger_info_size" "true" "trunc" "uncommitted" "unicode" "unknown" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1645 "unlimited" "unlisted" "user" "utf8" "value" "varying" "volumes" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1646 "wait" "windows_code" "workspace" "write" "xml" |
108381 | 1647 ) |
1648 | |
1649 ;; Linter Reserved | |
1650 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1651 "access" "action" "add" "address" "after" "all" "alter" "always" "and" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1652 "any" "append" "as" "asc" "ascic" "async" "at_begin" "at_end" "audit" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1653 "aud_obj_name_len" "backup" "base" "before" "between" "blobfile" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1654 "blobfiles" "blobpct" "brief" "browse" "by" "case" "cast" "check" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1655 "clear" "close" "column" "comment" "commit" "connect" "contains" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1656 "correct" "create" "delete" "desc" "disable" "disconnect" "distinct" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1657 "drop" "each" "ef" "else" "enable" "end" "event" "except" "exclude" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1658 "execute" "exists" "extract" "fetch" "finish" "for" "from" "get" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1659 "grant" "group" "having" "identified" "in" "index" "inner" "insert" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1660 "instead" "intersect" "into" "is" "isolation" "join" "left" "level" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1661 "like" "lock" "mode" "modify" "not" "nowait" "null" "of" "on" "open" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1662 "or" "order" "outer" "owner" "press" "prior" "procedure" "public" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1663 "purge" "rebuild" "resource" "restrict" "revoke" "right" "role" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1664 "rollback" "rownum" "select" "session" "set" "share" "shutdown" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1665 "start" "stop" "sync" "synchronize" "synonym" "sysdate" "table" "then" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1666 "to" "union" "unique" "unlock" "until" "update" "using" "values" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1667 "view" "when" "where" "with" "without" |
108381 | 1668 ) |
1669 | |
1670 ;; Linter Functions | |
1671 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1672 "abs" "acos" "asin" "atan" "atan2" "avg" "ceil" "cos" "cosh" "divtime" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1673 "exp" "floor" "getbits" "getblob" "getbyte" "getlong" "getraw" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1674 "getstr" "gettext" "getword" "hextoraw" "lenblob" "length" "log" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1675 "lower" "lpad" "ltrim" "max" "min" "mod" "monthname" "nvl" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1676 "octet_length" "power" "rand" "rawtohex" "repeat_string" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1677 "right_substr" "round" "rpad" "rtrim" "sign" "sin" "sinh" "soundex" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1678 "sqrt" "sum" "tan" "tanh" "timeint_to_days" "to_char" "to_date" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1679 "to_gmtime" "to_localtime" "to_number" "trim" "upper" "decode" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1680 "substr" "substring" "chr" "dayname" "days" "greatest" "hex" "initcap" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1681 "instr" "least" "multime" "replace" "width" |
108381 | 1682 ) |
1683 | |
1684 ;; Linter Data Types | |
1685 (sql-font-lock-keywords-builder 'font-lock-type-face nil | |
1686 "bigint" "bitmap" "blob" "boolean" "char" "character" "date" | |
1687 "datetime" "dec" "decimal" "double" "float" "int" "integer" "nchar" | |
1688 "number" "numeric" "real" "smallint" "varbyte" "varchar" "byte" | |
1689 "cursor" "long" | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1690 ))) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1691 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1692 "Linter SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1693 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1694 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1695 regular expressions are created during compilation by calling the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1696 function `regexp-opt'.") |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1697 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1698 (defvar sql-mode-ms-font-lock-keywords |
108381 | 1699 (eval-when-compile |
1700 (list | |
1701 ;; MS isql/osql Commands | |
1702 (cons | |
1703 (concat | |
1704 "^\\(?:\\(?:set\\s-+\\(?:" | |
1705 (regexp-opt '( | |
1706 "datefirst" "dateformat" "deadlock_priority" "lock_timeout" | |
1707 "concat_null_yields_null" "cursor_close_on_commit" | |
1708 "disable_def_cnst_chk" "fips_flagger" "identity_insert" "language" | |
1709 "offsets" "quoted_identifier" "arithabort" "arithignore" "fmtonly" | |
1710 "nocount" "noexec" "numeric_roundabort" "parseonly" | |
1711 "query_governor_cost_limit" "rowcount" "textsize" "ansi_defaults" | |
1712 "ansi_null_dflt_off" "ansi_null_dflt_on" "ansi_nulls" "ansi_padding" | |
1713 "ansi_warnings" "forceplan" "showplan_all" "showplan_text" | |
1714 "statistics" "implicit_transactions" "remote_proc_transactions" | |
1715 "transaction" "xact_abort" | |
1716 ) t) | |
1717 "\\)\\)\\|go\\s-*\\|use\\s-+\\|setuser\\s-+\\|dbcc\\s-+\\).*$") | |
1718 'font-lock-doc-face) | |
1719 | |
1720 ;; MS Reserved | |
1721 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1722 "absolute" "add" "all" "alter" "and" "any" "as" "asc" "authorization" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1723 "avg" "backup" "begin" "between" "break" "browse" "bulk" "by" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1724 "cascade" "case" "check" "checkpoint" "close" "clustered" "coalesce" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1725 "column" "commit" "committed" "compute" "confirm" "constraint" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1726 "contains" "containstable" "continue" "controlrow" "convert" "count" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1727 "create" "cross" "current" "current_date" "current_time" |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1728 "current_timestamp" "current_user" "database" "deallocate" "declare" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1729 "default" "delete" "deny" "desc" "disk" "distinct" "distributed" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1730 "double" "drop" "dummy" "dump" "else" "end" "errlvl" "errorexit" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1731 "escape" "except" "exec" "execute" "exists" "exit" "fetch" "file" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1732 "fillfactor" "first" "floppy" "for" "foreign" "freetext" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1733 "freetexttable" "from" "full" "goto" "grant" "group" "having" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1734 "holdlock" "identity" "identity_insert" "identitycol" "if" "in" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1735 "index" "inner" "insert" "intersect" "into" "is" "isolation" "join" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1736 "key" "kill" "last" "left" "level" "like" "lineno" "load" "max" "min" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1737 "mirrorexit" "national" "next" "nocheck" "nolock" "nonclustered" "not" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1738 "null" "nullif" "of" "off" "offsets" "on" "once" "only" "open" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1739 "opendatasource" "openquery" "openrowset" "option" "or" "order" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1740 "outer" "output" "over" "paglock" "percent" "perm" "permanent" "pipe" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1741 "plan" "precision" "prepare" "primary" "print" "prior" "privileges" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1742 "proc" "procedure" "processexit" "public" "raiserror" "read" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1743 "readcommitted" "readpast" "readtext" "readuncommitted" "reconfigure" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1744 "references" "relative" "repeatable" "repeatableread" "replication" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1745 "restore" "restrict" "return" "revoke" "right" "rollback" "rowcount" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1746 "rowguidcol" "rowlock" "rule" "save" "schema" "select" "serializable" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1747 "session_user" "set" "shutdown" "some" "statistics" "sum" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1748 "system_user" "table" "tablock" "tablockx" "tape" "temp" "temporary" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1749 "textsize" "then" "to" "top" "tran" "transaction" "trigger" "truncate" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1750 "tsequal" "uncommitted" "union" "unique" "update" "updatetext" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1751 "updlock" "use" "user" "values" "view" "waitfor" "when" "where" |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1752 "while" "with" "work" "writetext" "collate" "function" "openxml" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1753 "returns" |
108381 | 1754 ) |
1755 | |
1756 ;; MS Functions | |
1757 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1758 "@@connections" "@@cpu_busy" "@@cursor_rows" "@@datefirst" "@@dbts" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1759 "@@error" "@@fetch_status" "@@identity" "@@idle" "@@io_busy" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1760 "@@langid" "@@language" "@@lock_timeout" "@@max_connections" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1761 "@@max_precision" "@@nestlevel" "@@options" "@@pack_received" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1762 "@@pack_sent" "@@packet_errors" "@@procid" "@@remserver" "@@rowcount" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1763 "@@servername" "@@servicename" "@@spid" "@@textsize" "@@timeticks" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1764 "@@total_errors" "@@total_read" "@@total_write" "@@trancount" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1765 "@@version" "abs" "acos" "and" "app_name" "ascii" "asin" "atan" "atn2" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1766 "avg" "case" "cast" "ceiling" "char" "charindex" "coalesce" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1767 "col_length" "col_name" "columnproperty" "containstable" "convert" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1768 "cos" "cot" "count" "current_timestamp" "current_user" "cursor_status" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1769 "databaseproperty" "datalength" "dateadd" "datediff" "datename" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1770 "datepart" "day" "db_id" "db_name" "degrees" "difference" "exp" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1771 "file_id" "file_name" "filegroup_id" "filegroup_name" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1772 "filegroupproperty" "fileproperty" "floor" "formatmessage" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1773 "freetexttable" "fulltextcatalogproperty" "fulltextserviceproperty" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1774 "getansinull" "getdate" "grouping" "host_id" "host_name" "ident_incr" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1775 "ident_seed" "identity" "index_col" "indexproperty" "is_member" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1776 "is_srvrolemember" "isdate" "isnull" "isnumeric" "left" "len" "log" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1777 "log10" "lower" "ltrim" "max" "min" "month" "nchar" "newid" "nullif" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1778 "object_id" "object_name" "objectproperty" "openquery" "openrowset" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1779 "parsename" "patindex" "patindex" "permissions" "pi" "power" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1780 "quotename" "radians" "rand" "replace" "replicate" "reverse" "right" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1781 "round" "rtrim" "session_user" "sign" "sin" "soundex" "space" "sqrt" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1782 "square" "stats_date" "stdev" "stdevp" "str" "stuff" "substring" "sum" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1783 "suser_id" "suser_name" "suser_sid" "suser_sname" "system_user" "tan" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1784 "textptr" "textvalid" "typeproperty" "unicode" "upper" "user" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1785 "user_id" "user_name" "var" "varp" "year" |
108381 | 1786 ) |
1787 | |
1788 ;; MS Variables | |
1789 '("\\b@[a-zA-Z0-9_]*\\b" . font-lock-variable-name-face) | |
1790 | |
1791 ;; MS Types | |
1792 (sql-font-lock-keywords-builder 'font-lock-type-face nil | |
1793 "binary" "bit" "char" "character" "cursor" "datetime" "dec" "decimal" | |
1794 "double" "float" "image" "int" "integer" "money" "national" "nchar" | |
1795 "ntext" "numeric" "numeric" "nvarchar" "precision" "real" | |
1796 "smalldatetime" "smallint" "smallmoney" "text" "timestamp" "tinyint" | |
1797 "uniqueidentifier" "varbinary" "varchar" "varying" | |
1798 ))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1799 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1800 "Microsoft SQLServer SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1801 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1802 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1803 regular expressions are created during compilation by calling the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1804 function `regexp-opt'. Therefore, take a look at the source before |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1805 you define your own `sql-mode-ms-font-lock-keywords'.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1806 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1807 (defvar sql-mode-sybase-font-lock-keywords nil |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1808 "Sybase SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1809 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1810 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1811 regular expressions are created during compilation by calling the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1812 function `regexp-opt'. Therefore, take a look at the source before |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1813 you define your own `sql-mode-sybase-font-lock-keywords'.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1814 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1815 (defvar sql-mode-informix-font-lock-keywords nil |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1816 "Informix SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1817 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1818 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1819 regular expressions are created during compilation by calling the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1820 function `regexp-opt'. Therefore, take a look at the source before |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1821 you define your own `sql-mode-informix-font-lock-keywords'.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1822 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1823 (defvar sql-mode-interbase-font-lock-keywords nil |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1824 "Interbase SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1825 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1826 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1827 regular expressions are created during compilation by calling the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1828 function `regexp-opt'. Therefore, take a look at the source before |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1829 you define your own `sql-mode-interbase-font-lock-keywords'.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1830 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1831 (defvar sql-mode-ingres-font-lock-keywords nil |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1832 "Ingres SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1833 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1834 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1835 regular expressions are created during compilation by calling the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1836 function `regexp-opt'. Therefore, take a look at the source before |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1837 you define your own `sql-mode-interbase-font-lock-keywords'.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1838 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1839 (defvar sql-mode-solid-font-lock-keywords nil |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1840 "Solid SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1841 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1842 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1843 regular expressions are created during compilation by calling the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1844 function `regexp-opt'. Therefore, take a look at the source before |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1845 you define your own `sql-mode-solid-font-lock-keywords'.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1846 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1847 (defvar sql-mode-mysql-font-lock-keywords |
108381 | 1848 (eval-when-compile |
1849 (list | |
1850 ;; MySQL Functions | |
1851 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1852 "ascii" "avg" "bdmpolyfromtext" "bdmpolyfromwkb" "bdpolyfromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1853 "bdpolyfromwkb" "benchmark" "bin" "bit_and" "bit_length" "bit_or" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1854 "bit_xor" "both" "cast" "char_length" "character_length" "coalesce" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1855 "concat" "concat_ws" "connection_id" "conv" "convert" "count" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1856 "curdate" "current_date" "current_time" "current_timestamp" "curtime" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1857 "elt" "encrypt" "export_set" "field" "find_in_set" "found_rows" "from" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1858 "geomcollfromtext" "geomcollfromwkb" "geometrycollectionfromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1859 "geometrycollectionfromwkb" "geometryfromtext" "geometryfromwkb" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1860 "geomfromtext" "geomfromwkb" "get_lock" "group_concat" "hex" "ifnull" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1861 "instr" "interval" "isnull" "last_insert_id" "lcase" "leading" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1862 "length" "linefromtext" "linefromwkb" "linestringfromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1863 "linestringfromwkb" "load_file" "locate" "lower" "lpad" "ltrim" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1864 "make_set" "master_pos_wait" "max" "mid" "min" "mlinefromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1865 "mlinefromwkb" "mpointfromtext" "mpointfromwkb" "mpolyfromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1866 "mpolyfromwkb" "multilinestringfromtext" "multilinestringfromwkb" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1867 "multipointfromtext" "multipointfromwkb" "multipolygonfromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1868 "multipolygonfromwkb" "now" "nullif" "oct" "octet_length" "ord" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1869 "pointfromtext" "pointfromwkb" "polyfromtext" "polyfromwkb" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1870 "polygonfromtext" "polygonfromwkb" "position" "quote" "rand" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1871 "release_lock" "repeat" "replace" "reverse" "rpad" "rtrim" "soundex" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1872 "space" "std" "stddev" "substring" "substring_index" "sum" "sysdate" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1873 "trailing" "trim" "ucase" "unix_timestamp" "upper" "user" "variance" |
108381 | 1874 ) |
1875 | |
1876 ;; MySQL Keywords | |
1877 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1878 "action" "add" "after" "against" "all" "alter" "and" "as" "asc" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1879 "auto_increment" "avg_row_length" "bdb" "between" "by" "cascade" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1880 "case" "change" "character" "check" "checksum" "close" "collate" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1881 "collation" "column" "columns" "comment" "committed" "concurrent" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1882 "constraint" "create" "cross" "data" "database" "default" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1883 "delay_key_write" "delayed" "delete" "desc" "directory" "disable" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1884 "distinct" "distinctrow" "do" "drop" "dumpfile" "duplicate" "else" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1885 "enable" "enclosed" "end" "escaped" "exists" "fields" "first" "for" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1886 "force" "foreign" "from" "full" "fulltext" "global" "group" "handler" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1887 "having" "heap" "high_priority" "if" "ignore" "in" "index" "infile" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1888 "inner" "insert" "insert_method" "into" "is" "isam" "isolation" "join" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1889 "key" "keys" "last" "left" "level" "like" "limit" "lines" "load" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1890 "local" "lock" "low_priority" "match" "max_rows" "merge" "min_rows" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1891 "mode" "modify" "mrg_myisam" "myisam" "natural" "next" "no" "not" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1892 "null" "offset" "oj" "on" "open" "optionally" "or" "order" "outer" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1893 "outfile" "pack_keys" "partial" "password" "prev" "primary" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1894 "procedure" "quick" "raid0" "raid_type" "read" "references" "rename" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1895 "repeatable" "restrict" "right" "rollback" "rollup" "row_format" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1896 "savepoint" "select" "separator" "serializable" "session" "set" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1897 "share" "show" "sql_big_result" "sql_buffer_result" "sql_cache" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1898 "sql_calc_found_rows" "sql_no_cache" "sql_small_result" "starting" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1899 "straight_join" "striped" "table" "tables" "temporary" "terminated" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1900 "then" "to" "transaction" "truncate" "type" "uncommitted" "union" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1901 "unique" "unlock" "update" "use" "using" "values" "when" "where" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1902 "with" "write" "xor" |
108381 | 1903 ) |
1904 | |
1905 ;; MySQL Data Types | |
1906 (sql-font-lock-keywords-builder 'font-lock-type-face nil | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1907 "bigint" "binary" "bit" "blob" "bool" "boolean" "char" "curve" "date" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1908 "datetime" "dec" "decimal" "double" "enum" "fixed" "float" "geometry" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1909 "geometrycollection" "int" "integer" "line" "linearring" "linestring" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1910 "longblob" "longtext" "mediumblob" "mediumint" "mediumtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1911 "multicurve" "multilinestring" "multipoint" "multipolygon" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1912 "multisurface" "national" "numeric" "point" "polygon" "precision" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1913 "real" "smallint" "surface" "text" "time" "timestamp" "tinyblob" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1914 "tinyint" "tinytext" "unsigned" "varchar" "year" "year2" "year4" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1915 "zerofill" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1916 ))) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1917 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1918 "MySQL SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1919 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1920 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1921 regular expressions are created during compilation by calling the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1922 function `regexp-opt'. Therefore, take a look at the source before |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1923 you define your own `sql-mode-mysql-font-lock-keywords'.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1924 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1925 (defvar sql-mode-sqlite-font-lock-keywords nil |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1926 "SQLite SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1927 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1928 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1929 regular expressions are created during compilation by calling the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1930 function `regexp-opt'. Therefore, take a look at the source before |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1931 you define your own `sql-mode-sqlite-font-lock-keywords'.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1932 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1933 (defvar sql-mode-db2-font-lock-keywords nil |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1934 "DB2 SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1935 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1936 This variable is used by `sql-mode' and `sql-interactive-mode'. The |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1937 regular expressions are created during compilation by calling the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1938 function `regexp-opt'. Therefore, take a look at the source before |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1939 you define your own `sql-mode-db2-font-lock-keywords'.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1940 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1941 (defvar sql-mode-font-lock-keywords nil |
24050 | 1942 "SQL keywords used by font-lock. |
1943 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1944 Setting this variable directly no longer has any affect. Use |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1945 `sql-product' and `sql-add-product-keywords' to control the |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1946 highlighting rules in SQL mode.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1947 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1948 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1949 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1950 ;;; SQL Product support functions |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1951 |
108381 | 1952 (defun sql-add-product (product display &rest plist) |
1953 "Add support for a database product in `sql-mode'. | |
1954 | |
1955 Add PRODUCT to `sql-product-alist' which enables `sql-mode' to | |
1956 properly support syntax highlighting and interactive interaction. | |
1957 DISPLAY is the name of the SQL product that will appear in the | |
1958 menu bar and in messages. PLIST initializes the product | |
1959 configuration." | |
1960 | |
1961 ;; Don't do anything if the product is already supported | |
1962 (if (assoc product sql-product-alist) | |
1963 (message "Product `%s' is already defined" product) | |
1964 | |
1965 ;; Add product to the alist | |
1966 (add-to-list 'sql-product-alist `((,product :name ,display . ,plist))) | |
1967 ;; Add a menu item to the SQL->Product menu | |
1968 (easy-menu-add-item sql-mode-menu '("Product") | |
1969 ;; Each product is represented by a radio | |
1970 ;; button with it's display name. | |
1971 `[,display | |
1972 (lambda () (interactive) (sql-set-product ',product)) | |
1973 :style radio | |
1974 :selected (eq sql-product ',product)] | |
1975 ;; Maintain the product list in | |
1976 ;; (case-insensitive) alphabetic order of the | |
1977 ;; display names. Loop thru each keymap item | |
1978 ;; looking for an item whose display name is | |
1979 ;; after this product's name. | |
1980 (let ((next-item) | |
1981 (down-display (downcase display))) | |
1982 (map-keymap (lambda (k b) | |
1983 (when (and (not next-item) | |
1984 (string-lessp down-display | |
1985 (downcase (cadr b)))) | |
1986 (setq next-item k))) | |
1987 (easy-menu-get-map sql-mode-menu '("Product"))) | |
1988 next-item)) | |
1989 product)) | |
1990 | |
1991 (defun sql-del-product (product) | |
1992 "Remove support for PRODUCT in `sql-mode'." | |
1993 | |
1994 ;; Remove the menu item based on the display name | |
1995 (easy-menu-remove-item sql-mode-menu '("Product") (sql-get-product-feature product :name)) | |
1996 ;; Remove the product alist item | |
1997 (setq sql-product-alist (assq-delete-all product sql-product-alist)) | |
1998 nil) | |
1999 | |
2000 (defun sql-set-product-feature (product feature newvalue) | |
2001 "Set FEATURE of database PRODUCT to NEWVALUE. | |
2002 | |
2003 The PRODUCT must be a symbol which identifies the database | |
2004 product. The product must have already exist on the product | |
2005 list. See `sql-add-product' to add new products. The FEATURE | |
2006 argument must be a plist keyword accepted by | |
2007 `sql-product-alist'." | |
2008 | |
2009 (let* ((p (assoc product sql-product-alist)) | |
2010 (v (plist-get (cdr p) feature))) | |
2011 (if p | |
2012 (if (and | |
2013 (member feature sql-indirect-features) | |
2014 (symbolp v)) | |
2015 (set v newvalue) | |
2016 (setcdr p (plist-put (cdr p) feature newvalue))) | |
2017 (message "`%s' is not a known product; use `sql-add-product' to add it first." product)))) | |
2018 | |
2019 (defun sql-get-product-feature (product feature &optional fallback) | |
2020 "Lookup FEATURE associated with a SQL PRODUCT. | |
2021 | |
2022 If the FEATURE is nil for PRODUCT, and FALLBACK is specified, | |
2023 then the FEATURE associated with the FALLBACK product is | |
2024 returned. | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2025 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2026 See `sql-product-alist' for a list of products and supported features." |
108381 | 2027 (let* ((p (assoc product sql-product-alist)) |
2028 (v (plist-get (cdr p) feature))) | |
2029 | |
2030 (if p | |
2031 ;; If no value and fallback, lookup feature for fallback | |
2032 (if (and (not v) | |
2033 fallback | |
2034 (not (eq product fallback))) | |
2035 (sql-get-product-feature fallback feature) | |
2036 | |
2037 (if (and | |
2038 (member feature sql-indirect-features) | |
2039 (symbolp v)) | |
2040 (symbol-value v) | |
2041 v)) | |
2042 (message "`%s' is not a known product; use `sql-add-product' to add it first." product)))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2043 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2044 (defun sql-product-font-lock (keywords-only imenu) |
108381 | 2045 "Configures font-lock and imenu with product-specific settings. |
2046 | |
2047 The KEYWORDS-ONLY flag is passed to font-lock to specify whether | |
2048 only keywords should be hilighted and syntactic hilighting | |
2049 skipped. The IMENU flag indicates whether `imenu-mode' should | |
2050 also be configured." | |
2051 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2052 (let |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2053 ;; Get the product-specific syntax-alist. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2054 ((syntax-alist |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2055 (append |
108381 | 2056 (sql-get-product-feature sql-product :syntax-alist) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2057 '((?_ . "w") (?. . "w"))))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2058 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2059 ;; Get the product-specific keywords. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2060 (setq sql-mode-font-lock-keywords |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2061 (append |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2062 (unless (eq sql-product 'ansi) |
108381 | 2063 (sql-get-product-feature sql-product :font-lock)) |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2064 ;; Always highlight ANSI keywords |
108381 | 2065 (sql-get-product-feature 'ansi :font-lock) |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2066 ;; Fontify object names in CREATE, DROP and ALTER DDL |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2067 ;; statements |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2068 (list sql-mode-font-lock-object-name))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2069 |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2070 ;; Setup font-lock. Force re-parsing of `font-lock-defaults'. |
108381 | 2071 (kill-local-variable 'font-lock-set-defaults) |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2072 (setq font-lock-defaults (list 'sql-mode-font-lock-keywords |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2073 keywords-only t syntax-alist)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2074 |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2075 ;; Force font lock to reinitialize if it is already on |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2076 ;; Otherwise, we can wait until it can be started. |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2077 (when (and (fboundp 'font-lock-mode) |
108381 | 2078 (boundp 'font-lock-mode) |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2079 font-lock-mode) |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2080 (font-lock-mode-internal nil) |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2081 (font-lock-mode-internal t)) |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2082 |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2083 (add-hook 'font-lock-mode-hook |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2084 (lambda () |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2085 ;; Provide defaults for new font-lock faces. |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2086 (defvar font-lock-builtin-face |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2087 (if (boundp 'font-lock-preprocessor-face) |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2088 font-lock-preprocessor-face |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2089 font-lock-keyword-face)) |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2090 (defvar font-lock-doc-face font-lock-string-face)) |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2091 nil t) |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2092 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2093 ;; Setup imenu; it needs the same syntax-alist. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2094 (when imenu |
108381 | 2095 (setq imenu-syntax-alist syntax-alist)))) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2096 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2097 ;;;###autoload |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2098 (defun sql-add-product-keywords (product keywords &optional append) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2099 "Add highlighting KEYWORDS for SQL PRODUCT. |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2100 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2101 PRODUCT should be a symbol, the name of a sql product, such as |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2102 `oracle'. KEYWORDS should be a list; see the variable |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2103 `font-lock-keywords'. By default they are added at the beginning |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2104 of the current highlighting list. If optional argument APPEND is |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2105 `set', they are used to replace the current highlighting list. |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2106 If APPEND is any other non-nil value, they are added at the end |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2107 of the current highlighting list. |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2108 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2109 For example: |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2110 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2111 (sql-add-product-keywords 'ms |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2112 '((\"\\\\b\\\\w+_t\\\\b\" . font-lock-type-face))) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2113 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2114 adds a fontification pattern to fontify identifiers ending in |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2115 `_t' as data types." |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2116 |
108381 | 2117 (let* ((sql-indirect-features nil) |
2118 (font-lock-var (sql-get-product-feature product :font-lock)) | |
2119 (old-val)) | |
2120 | |
2121 (setq old-val (symbol-value font-lock-var)) | |
2122 (set font-lock-var | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2123 (if (eq append 'set) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2124 keywords |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2125 (if append |
108381 | 2126 (append old-val keywords) |
2127 (append keywords old-val)))))) | |
24050 | 2128 |
2129 | |
30905
2069c10bf952
(sql-magic-go): Use comint-bol.
Gerd Moellmann <gerd@gnu.org>
parents:
30838
diff
changeset
|
2130 |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2131 ;;; Functions to switch highlighting |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2132 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2133 (defun sql-highlight-product () |
108381 | 2134 "Turns on the font highlighting for the SQL product selected." |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2135 (when (derived-mode-p 'sql-mode) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2136 ;; Setup font-lock |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2137 (sql-product-font-lock nil t) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2138 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2139 ;; Set the mode name to include the product. |
108381 | 2140 (setq mode-name (concat "SQL[" (or (sql-get-product-feature sql-product :name) |
2141 (symbol-name sql-product)) "]")))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2142 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2143 (defun sql-set-product (product) |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2144 "Set `sql-product' to product and enable appropriate highlighting." |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2145 (interactive |
108381 | 2146 (list (completing-read "SQL product: " |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2147 (mapcar (lambda (info) (symbol-name (car info))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2148 sql-product-alist) |
108381 | 2149 nil 'require-match |
2150 (or (and sql-product (symbol-name sql-product)) "ansi")))) | |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2151 (if (stringp product) (setq product (intern product))) |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2152 (when (not (assoc product sql-product-alist)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2153 (error "SQL product %s is not supported; treated as ANSI" product) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2154 (setq product 'ansi)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2155 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2156 ;; Save product setting and fontify. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2157 (setq sql-product product) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2158 (sql-highlight-product)) |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2159 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2160 |
30838
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2161 ;;; Compatibility functions |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2162 |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2163 (if (not (fboundp 'comint-line-beginning-position)) |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2164 ;; comint-line-beginning-position is defined in Emacs 21 |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2165 (defun comint-line-beginning-position () |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2166 "Return the buffer position of the beginning of the line, after any prompt. |
30838
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2167 The prompt is assumed to be any text at the beginning of the line matching |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2168 the regular expression `comint-prompt-regexp', a buffer local variable." |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2169 (save-excursion (comint-bol nil) (point)))) |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2170 |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2171 |
24050 | 2172 |
2173 ;;; Small functions | |
2174 | |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2175 (defun sql-magic-go (arg) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2176 "Insert \"o\" and call `comint-send-input'. |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2177 `sql-electric-stuff' must be the symbol `go'." |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2178 (interactive "P") |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2179 (self-insert-command (prefix-numeric-value arg)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2180 (if (and (equal sql-electric-stuff 'go) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2181 (save-excursion |
30642
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2182 (comint-bol nil) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2183 (looking-at "go\\b"))) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2184 (comint-send-input))) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2185 |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2186 (defun sql-magic-semicolon (arg) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2187 "Insert semicolon and call `comint-send-input'. |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2188 `sql-electric-stuff' must be the symbol `semicolon'." |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2189 (interactive "P") |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2190 (self-insert-command (prefix-numeric-value arg)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2191 (if (equal sql-electric-stuff 'semicolon) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2192 (comint-send-input))) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2193 |
24050 | 2194 (defun sql-accumulate-and-indent () |
2195 "Continue SQL statement on the next line." | |
2196 (interactive) | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
2197 (if (fboundp 'comint-accumulate) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2198 (comint-accumulate) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2199 (newline)) |
24050 | 2200 (indent-according-to-mode)) |
2201 | |
108381 | 2202 (defun sql-help-list-products (indent freep) |
2203 "Generate listing of products available for use under SQLi. | |
2204 | |
2205 List products with :free-softare attribute set to FREEP. Indent | |
2206 each line with INDENT." | |
2207 | |
2208 (let (sqli-func doc) | |
2209 (setq doc "") | |
2210 (dolist (p sql-product-alist) | |
2211 (setq sqli-func (intern (concat "sql-" (symbol-name (car p))))) | |
2212 | |
2213 (if (and (fboundp sqli-func) | |
2214 (eq (sql-get-product-feature (car p) :free-software) freep)) | |
2215 (setq doc | |
2216 (concat doc | |
2217 indent | |
2218 (or (sql-get-product-feature (car p) :name) | |
2219 (symbol-name (car p))) | |
2220 ":\t" | |
2221 "\\[" | |
2222 (symbol-name sqli-func) | |
2223 "]\n")))) | |
2224 doc)) | |
2225 | |
24050 | 2226 ;;;###autoload |
2227 (defun sql-help () | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2228 "Show short help for the SQL modes. |
24050 | 2229 |
2230 Use an entry function to open an interactive SQL buffer. This buffer is | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2231 usually named `*SQL*'. The name of the major mode is SQLi. |
24050 | 2232 |
2233 Use the following commands to start a specific SQL interpreter: | |
2234 | |
108381 | 2235 \\\\FREE |
24268 | 2236 |
2237 Other non-free SQL implementations are also supported: | |
2238 | |
108381 | 2239 \\\\NONFREE |
24268 | 2240 |
2241 But we urge you to choose a free implementation instead of these. | |
24050 | 2242 |
108381 | 2243 You can also use \\[sql-product-interactive] to invoke the |
2244 interpreter for the current `sql-product'. | |
2245 | |
24050 | 2246 Once you have the SQLi buffer, you can enter SQL statements in the |
2247 buffer. The output generated is appended to the buffer and a new prompt | |
2248 is generated. See the In/Out menu in the SQLi buffer for some functions | |
2249 that help you navigate through the buffer, the input history, etc. | |
2250 | |
2251 If you have a really complex SQL statement or if you are writing a | |
2252 procedure, you can do this in a separate buffer. Put the new buffer in | |
2253 `sql-mode' by calling \\[sql-mode]. The name of this buffer can be | |
2254 anything. The name of the major mode is SQL. | |
2255 | |
2256 In this SQL buffer (SQL mode), you can send the region or the entire | |
2257 buffer to the interactive SQL buffer (SQLi mode). The results are | |
2258 appended to the SQLi buffer without disturbing your SQL buffer." | |
2259 (interactive) | |
108381 | 2260 |
2261 ;; Insert references to loaded products into the help buffer string | |
2262 (let ((doc (documentation 'sql-help t)) | |
2263 changedp) | |
2264 (setq changedp nil) | |
2265 | |
2266 ;; Insert FREE software list | |
2267 (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]FREE\\s-*\n" doc 0) | |
2268 (setq doc (replace-match (sql-help-list-products (match-string 1 doc) t) | |
2269 t t doc 0) | |
2270 changedp t)) | |
2271 | |
2272 ;; Insert non-FREE software list | |
2273 (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]NONFREE\\s-*\n" doc 0) | |
2274 (setq doc (replace-match (sql-help-list-products (match-string 1 doc) nil) | |
2275 t t doc 0) | |
2276 changedp t)) | |
2277 | |
2278 ;; If we changed the help text, save the change so that the help | |
2279 ;; sub-system will see it | |
2280 (when changedp | |
2281 (put 'sql-help 'function-documentation doc))) | |
2282 | |
2283 ;; Call help on this function | |
24050 | 2284 (describe-function 'sql-help)) |
2285 | |
2286 (defun sql-read-passwd (prompt &optional default) | |
64837
f80fef683ab5
(sql-interactive-mode-map): Use fboundp.
Richard M. Stallman <rms@gnu.org>
parents:
64699
diff
changeset
|
2287 "Read a password using PROMPT. Optional DEFAULT is password to start with." |
f80fef683ab5
(sql-interactive-mode-map): Use fboundp.
Richard M. Stallman <rms@gnu.org>
parents:
64699
diff
changeset
|
2288 (read-passwd prompt nil default)) |
24050 | 2289 |
2290 (defun sql-get-login (&rest what) | |
2291 "Get username, password and database from the user. | |
2292 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2293 The variables `sql-user', `sql-password', `sql-server', and |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
2294 `sql-database' can be customized. They are used as the default values. |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2295 Usernames, servers and databases are stored in `sql-user-history', |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2296 `sql-server-history' and `database-history'. Passwords are not stored |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2297 in a history. |
24050 | 2298 |
108381 | 2299 Parameter WHAT is a list of tokens passed as arguments in the |
2300 function call. The function asks for the username if WHAT | |
2301 contains the symbol `user', for the password if it contains the | |
2302 symbol `password', for the server if it contains the symbol | |
2303 `server', and for the database if it contains the symbol | |
2304 `database'. The members of WHAT are processed in the order in | |
2305 which they are provided. | |
24050 | 2306 |
2307 In order to ask the user for username, password and database, call the | |
2308 function like this: (sql-get-login 'user 'password 'database)." | |
2309 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2310 (while what |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2311 (cond |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2312 ((eq (car what) 'user) ; user |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2313 (setq sql-user |
24050 | 2314 (read-from-minibuffer "User: " sql-user nil nil |
108381 | 2315 'sql-user-history))) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2316 ((eq (car what) 'password) ; password |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2317 (setq sql-password |
24050 | 2318 (sql-read-passwd "Password: " sql-password))) |
108381 | 2319 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2320 ((eq (car what) 'server) ; server |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2321 (setq sql-server |
24050 | 2322 (read-from-minibuffer "Server: " sql-server nil nil |
108381 | 2323 'sql-server-history))) |
2324 ((eq (car what) 'port) ; port | |
2325 (setq sql-port | |
2326 (read-from-minibuffer "Port: " sql-port nil nil | |
2327 'sql-port-history))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2328 ((eq (car what) 'database) ; database |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2329 (setq sql-database |
24050 | 2330 (read-from-minibuffer "Database: " sql-database nil nil |
108381 | 2331 'sql-database-history)))) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2332 (setq what (cdr what)))) |
25381
970b18c6803f
(sql-sybase): use sql-server instead of sql-database.
Alex Schroeder <alex@gnu.org>
parents:
25183
diff
changeset
|
2333 |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2334 (defun sql-find-sqli-buffer () |
108381 | 2335 "Returns the current default SQLi buffer or nil. |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2336 In order to qualify, the SQLi buffer must be alive, |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2337 be in `sql-interactive-mode' and have a process." |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2338 (let ((default-buffer (default-value 'sql-buffer))) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2339 (if (and (buffer-live-p default-buffer) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2340 (get-buffer-process default-buffer)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2341 default-buffer |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2342 (save-current-buffer |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2343 (let ((buflist (buffer-list)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2344 (found)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2345 (while (not (or (null buflist) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2346 found)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2347 (let ((candidate (car buflist))) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2348 (set-buffer candidate) |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2349 (if (and (derived-mode-p 'sql-interactive-mode) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2350 (get-buffer-process candidate)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2351 (setq found candidate)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2352 (setq buflist (cdr buflist)))) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2353 found))))) |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2354 |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2355 (defun sql-set-sqli-buffer-generally () |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
2356 "Set SQLi buffer for all SQL buffers that have none. |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2357 This function checks all SQL buffers for their SQLi buffer. If their |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2358 SQLi buffer is nonexistent or has no process, it is set to the current |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2359 default SQLi buffer. The current default SQLi buffer is determined |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2360 using `sql-find-sqli-buffer'. If `sql-buffer' is set, |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2361 `sql-set-sqli-hook' is run." |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2362 (interactive) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2363 (save-excursion |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2364 (let ((buflist (buffer-list)) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2365 (default-sqli-buffer (sql-find-sqli-buffer))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2366 (setq-default sql-buffer default-sqli-buffer) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2367 (while (not (null buflist)) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2368 (let ((candidate (car buflist))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2369 (set-buffer candidate) |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2370 (if (and (derived-mode-p 'sql-mode) |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2371 (not (buffer-live-p sql-buffer))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2372 (progn |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2373 (setq sql-buffer default-sqli-buffer) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2374 (run-hooks 'sql-set-sqli-hook)))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2375 (setq buflist (cdr buflist)))))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2376 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2377 (defun sql-set-sqli-buffer () |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2378 "Set the SQLi buffer SQL strings are sent to. |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2379 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2380 Call this function in a SQL buffer in order to set the SQLi buffer SQL |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2381 strings are sent to. Calling this function sets `sql-buffer' and runs |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2382 `sql-set-sqli-hook'. |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2383 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2384 If you call it from a SQL buffer, this sets the local copy of |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2385 `sql-buffer'. |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2386 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2387 If you call it from anywhere else, it sets the global copy of |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2388 `sql-buffer'." |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2389 (interactive) |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2390 (let ((default-buffer (sql-find-sqli-buffer))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2391 (if (null default-buffer) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2392 (error "There is no suitable SQLi buffer")) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2393 (let ((new-buffer |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2394 (get-buffer |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2395 (read-buffer "New SQLi buffer: " default-buffer t)))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2396 (if (null (get-buffer-process new-buffer)) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2397 (error "Buffer %s has no process" (buffer-name new-buffer))) |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2398 (if (null (with-current-buffer new-buffer |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2399 (equal major-mode 'sql-interactive-mode))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2400 (error "Buffer %s is no SQLi buffer" (buffer-name new-buffer))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2401 (if new-buffer |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2402 (progn |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2403 (setq sql-buffer new-buffer) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2404 (run-hooks 'sql-set-sqli-hook)))))) |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2405 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2406 (defun sql-show-sqli-buffer () |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2407 "Show the name of current SQLi buffer. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2408 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2409 This is the buffer SQL strings are sent to. It is stored in the |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2410 variable `sql-buffer'. See `sql-help' on how to create such a buffer." |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2411 (interactive) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2412 (if (null (buffer-live-p sql-buffer)) |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2413 (message "%s has no SQLi buffer set." (buffer-name (current-buffer))) |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2414 (if (null (get-buffer-process sql-buffer)) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2415 (message "Buffer %s has no process." (buffer-name sql-buffer)) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2416 (message "Current SQLi buffer is %s." (buffer-name sql-buffer))))) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2417 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2418 (defun sql-make-alternate-buffer-name () |
108381 | 2419 "Returns a string that can be used to rename a SQLi buffer. |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2420 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2421 This is used to set `sql-alternate-buffer-name' within |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2422 `sql-interactive-mode'." |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2423 (concat (if (string= "" sql-user) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2424 (if (string= "" (user-login-name)) |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2425 () |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2426 (concat (user-login-name) "/")) |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2427 (concat sql-user "/")) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2428 (if (string= "" sql-database) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2429 (if (string= "" sql-server) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2430 (system-name) |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2431 sql-server) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2432 sql-database))) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2433 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2434 (defun sql-rename-buffer () |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2435 "Rename a SQLi buffer." |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2436 (interactive) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2437 (rename-buffer (format "*SQL: %s*" sql-alternate-buffer-name) t)) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2438 |
24050 | 2439 (defun sql-copy-column () |
2440 "Copy current column to the end of buffer. | |
2441 Inserts SELECT or commas if appropriate." | |
2442 (interactive) | |
2443 (let ((column)) | |
2444 (save-excursion | |
108381 | 2445 (setq column (buffer-substring-no-properties |
24050 | 2446 (progn (forward-char 1) (backward-sexp 1) (point)) |
2447 (progn (forward-sexp 1) (point)))) | |
2448 (goto-char (point-max)) | |
30642
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2449 (let ((bol (comint-line-beginning-position))) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2450 (cond |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2451 ;; if empty command line, insert SELECT |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2452 ((= bol (point)) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2453 (insert "SELECT ")) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2454 ;; else if appending to INTO .* (, SELECT or ORDER BY, insert a comma |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2455 ((save-excursion |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2456 (re-search-backward "\\b\\(\\(into\\s-+\\S-+\\s-+(\\)\\|select\\|order by\\) .+" |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2457 bol t)) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2458 (insert ", ")) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2459 ;; else insert a space |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2460 (t |
64052
68f51d595f7f
(SQL): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63410
diff
changeset
|
2461 (if (eq (preceding-char) ?\s) |
30642
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2462 nil |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2463 (insert " "))))) |
24050 | 2464 ;; in any case, insert the column |
2465 (insert column) | |
2466 (message "%s" column)))) | |
2467 | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2468 ;; On Windows, SQL*Plus for Oracle turns on full buffering for stdout |
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2469 ;; if it is not attached to a character device; therefore placeholder |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2470 ;; replacement by SQL*Plus is fully buffered. The workaround lets |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2471 ;; Emacs query for the placeholders. |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2472 |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2473 (defvar sql-placeholder-history nil |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2474 "History of placeholder values used.") |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2475 |
108381 | 2476 (defun sql-placeholders-filter (string) |
2477 "Replace placeholders in STRING. | |
2478 Placeholders are words starting with and ampersand like &this." | |
2479 | |
2480 (when sql-oracle-scan-on | |
2481 (while (string-match "&\\(\\sw+\\)" string) | |
2482 (setq string (replace-match | |
2483 (read-from-minibuffer | |
2484 (format "Enter value for %s: " (match-string 1 string)) | |
2485 nil nil nil 'sql-placeholder-history) | |
2486 t t string)))) | |
2487 string) | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2488 |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2489 ;; Using DB2 interactively, newlines must be escaped with " \". |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2490 ;; The space before the backslash is relevant. |
108381 | 2491 (defun sql-escape-newlines-filter (string) |
2492 "Escapes newlines in STRING. | |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2493 Every newline in STRING will be preceded with a space and a backslash." |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2494 (let ((result "") (start 0) mb me) |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2495 (while (string-match "\n" string start) |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2496 (setq mb (match-beginning 0) |
108381 | 2497 me (match-end 0) |
2498 result (concat result | |
2499 (substring string start mb) | |
2500 (if (and (> mb 1) | |
2501 (string-equal " \\" (substring string (- mb 2) mb))) | |
2502 "" " \\\n")) | |
2503 start me)) | |
2504 (concat result (substring string start)))) | |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2505 |
24050 | 2506 |
2507 | |
108381 | 2508 ;;; Input sender for SQLi buffers |
2509 | |
2510 (defun sql-input-sender (proc string) | |
2511 "Sends STRING to PROC after applying filters." | |
2512 | |
2513 (let* ((product (with-current-buffer (process-buffer proc) sql-product)) | |
2514 (filter (sql-get-product-feature product :input-filter))) | |
2515 | |
2516 ;; Send the string | |
2517 (comint-simple-send proc (if filter (funcall filter string) string)))) | |
2518 | |
24050 | 2519 ;;; Sending the region to the SQLi buffer. |
2520 | |
108381 | 2521 (defun sql-send-string (str) |
2522 "Send the string STR to the SQL process." | |
2523 (interactive "sSQL Text: ") | |
2524 | |
2525 (let (comint-input-sender-no-newline proc) | |
2526 (if (buffer-live-p sql-buffer) | |
2527 (progn | |
2528 ;; Ignore the hoping around... | |
2529 (save-excursion | |
2530 ;; Get the process | |
2531 (setq proc (get-buffer-process sql-buffer)) | |
2532 | |
2533 ;; Set product context | |
2534 (with-current-buffer sql-buffer | |
2535 ;; Send the string | |
2536 (sql-input-sender proc str) | |
2537 | |
2538 ;; Send a newline if there wasn't one on the end of the string | |
2539 (unless (string-equal "\n" (substring str (1- (length str)))) | |
2540 (comint-send-string proc "\n")) | |
2541 | |
2542 ;; Send a command terminator if we must | |
2543 (if sql-send-terminator | |
2544 (sql-send-magic-terminator sql-buffer str sql-send-terminator)) | |
2545 | |
2546 (message "Sent string to buffer %s." (buffer-name sql-buffer)))) | |
2547 | |
2548 ;; Display the sql buffer | |
2549 (if sql-pop-to-buffer-after-send-region | |
2550 (pop-to-buffer sql-buffer) | |
2551 (display-buffer sql-buffer))) | |
2552 | |
2553 ;; We don't have no stinkin' sql | |
2554 (message "No SQL process started.")))) | |
2555 | |
24050 | 2556 (defun sql-send-region (start end) |
2557 "Send a region to the SQL process." | |
2558 (interactive "r") | |
108381 | 2559 (sql-send-string (buffer-substring-no-properties start end))) |
24050 | 2560 |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2561 (defun sql-send-paragraph () |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2562 "Send the current paragraph to the SQL process." |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2563 (interactive) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2564 (let ((start (save-excursion |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2565 (backward-paragraph) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2566 (point))) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2567 (end (save-excursion |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2568 (forward-paragraph) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2569 (point)))) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2570 (sql-send-region start end))) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2571 |
24050 | 2572 (defun sql-send-buffer () |
2573 "Send the buffer contents to the SQL process." | |
2574 (interactive) | |
2575 (sql-send-region (point-min) (point-max))) | |
2576 | |
108381 | 2577 (defun sql-send-magic-terminator (buf str terminator) |
2578 "Sends TERMINATOR to buffer BUF if its not present in STR." | |
2579 (let (pat term) | |
2580 ;; If flag is merely on(t), get product-specific terminator | |
2581 (if (eq terminator t) | |
2582 (setq terminator (sql-get-product-feature sql-product :terminator))) | |
2583 | |
2584 ;; If there is no terminator specified, use default ";" | |
2585 (unless terminator | |
2586 (setq terminator ";")) | |
2587 | |
2588 ;; Parse the setting into the pattern and the terminator string | |
2589 (cond ((stringp terminator) | |
2590 (setq pat (regexp-quote terminator) | |
2591 term terminator)) | |
2592 ((consp terminator) | |
2593 (setq pat (car terminator) | |
2594 term (cdr terminator))) | |
2595 (t | |
2596 nil)) | |
2597 | |
2598 ;; Check to see if the pattern is present in the str already sent | |
2599 (unless (and pat term | |
2600 (string-match (concat pat "\n?\\'") str)) | |
2601 (comint-send-string buf (concat term "\n"))))) | |
2602 | |
2603 (defun sql-remove-tabs-filter (str) | |
2604 "Replace tab characters with spaces." | |
2605 (replace-regexp-in-string "\t" " " str nil t)) | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2606 |
24050 | 2607 (defun sql-toggle-pop-to-buffer-after-send-region (&optional value) |
2608 "Toggle `sql-pop-to-buffer-after-send-region'. | |
2609 | |
2610 If given the optional parameter VALUE, sets | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2611 `sql-toggle-pop-to-buffer-after-send-region' to VALUE." |
24050 | 2612 (interactive "P") |
2613 (if value | |
2614 (setq sql-pop-to-buffer-after-send-region value) | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2615 (setq sql-pop-to-buffer-after-send-region |
108381 | 2616 (null sql-pop-to-buffer-after-send-region)))) |
24050 | 2617 |
2618 | |
2619 | |
2620 ;;; SQL mode -- uses SQL interactive mode | |
2621 | |
2622 ;;;###autoload | |
2623 (defun sql-mode () | |
2624 "Major mode to edit SQL. | |
2625 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2626 You can send SQL statements to the SQLi buffer using |
24050 | 2627 \\[sql-send-region]. Such a buffer must exist before you can do this. |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2628 See `sql-help' on how to create SQLi buffers. |
24050 | 2629 |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2630 \\{sql-mode-map} |
24050 | 2631 Customization: Entry to this mode runs the `sql-mode-hook'. |
2632 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2633 When you put a buffer in SQL mode, the buffer stores the last SQLi |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2634 buffer created as its destination in the variable `sql-buffer'. This |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2635 will be the buffer \\[sql-send-region] sends the region to. If this |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2636 SQLi buffer is killed, \\[sql-send-region] is no longer able to |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2637 determine where the strings should be sent to. You can set the |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2638 value of `sql-buffer' using \\[sql-set-sqli-buffer]. |
24050 | 2639 |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2640 For information on how to create multiple SQLi buffers, see |
40971
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2641 `sql-interactive-mode'. |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2642 |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2643 Note that SQL doesn't have an escape character unless you specify |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2644 one. If you specify backslash as escape character in SQL, |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2645 you must tell Emacs. Here's how to do that in your `~/.emacs' file: |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2646 |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2647 \(add-hook 'sql-mode-hook |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2648 (lambda () |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2649 (modify-syntax-entry ?\\\\ \".\" sql-mode-syntax-table)))" |
24050 | 2650 (interactive) |
2651 (kill-all-local-variables) | |
2652 (setq major-mode 'sql-mode) | |
2653 (setq mode-name "SQL") | |
2654 (use-local-map sql-mode-map) | |
31392
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
2655 (if sql-mode-menu |
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
2656 (easy-menu-add sql-mode-menu)); XEmacs |
24050 | 2657 (set-syntax-table sql-mode-syntax-table) |
2658 (make-local-variable 'font-lock-defaults) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2659 (make-local-variable 'sql-mode-font-lock-keywords) |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
2660 (make-local-variable 'comment-start) |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
2661 (setq comment-start "--") |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2662 ;; Make each buffer in sql-mode remember the "current" SQLi buffer. |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2663 (make-local-variable 'sql-buffer) |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2664 ;; Add imenu support for sql-mode. Note that imenu-generic-expression |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2665 ;; is buffer-local, so we don't need a local-variable for it. SQL is |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2666 ;; case-insensitive, that's why we have to set imenu-case-fold-search. |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2667 (setq imenu-generic-expression sql-imenu-generic-expression |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2668 imenu-case-fold-search t) |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2669 ;; Make `sql-send-paragraph' work on paragraphs that contain indented |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2670 ;; lines. |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2671 (make-local-variable 'paragraph-separate) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2672 (make-local-variable 'paragraph-start) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2673 (setq paragraph-separate "[\f]*$" |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2674 paragraph-start "[\n\f]") |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2675 ;; Abbrevs |
24050 | 2676 (setq local-abbrev-table sql-mode-abbrev-table) |
2677 (setq abbrev-all-caps 1) | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2678 ;; Run hook |
62772
f2892faa87d4
* progmodes/ada-mode.el (ada-mode):
Lute Kamstra <lute@gnu.org>
parents:
59996
diff
changeset
|
2679 (run-mode-hooks 'sql-mode-hook) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2680 ;; Catch changes to sql-product and highlight accordingly |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2681 (sql-highlight-product) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2682 (add-hook 'hack-local-variables-hook 'sql-highlight-product t t)) |
24050 | 2683 |
2684 | |
2685 | |
2686 ;;; SQL interactive mode | |
2687 | |
2688 (put 'sql-interactive-mode 'mode-class 'special) | |
2689 | |
2690 (defun sql-interactive-mode () | |
2691 "Major mode to use a SQL interpreter interactively. | |
2692 | |
2693 Do not call this function by yourself. The environment must be | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2694 initialized by an entry function specific for the SQL interpreter. |
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2695 See `sql-help' for a list of available entry functions. |
24050 | 2696 |
2697 \\[comint-send-input] after the end of the process' output sends the | |
2698 text from the end of process to the end of the current line. | |
2699 \\[comint-send-input] before end of process output copies the current | |
2700 line minus the prompt to the end of the buffer and sends it. | |
2701 \\[comint-copy-old-input] just copies the current line. | |
2702 Use \\[sql-accumulate-and-indent] to enter multi-line statements. | |
2703 | |
2704 If you want to make multiple SQL buffers, rename the `*SQL*' buffer | |
2705 using \\[rename-buffer] or \\[rename-uniquely] and start a new process. | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2706 See `sql-help' for a list of available entry functions. The last buffer |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2707 created by such an entry function is the current SQLi buffer. SQL |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2708 buffers will send strings to the SQLi buffer current at the time of |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2709 their creation. See `sql-mode' for details. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2710 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2711 Sample session using two connections: |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2712 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2713 1. Create first SQLi buffer by calling an entry function. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2714 2. Rename buffer \"*SQL*\" to \"*Connection 1*\". |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2715 3. Create a SQL buffer \"test1.sql\". |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2716 4. Create second SQLi buffer by calling an entry function. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2717 5. Rename buffer \"*SQL*\" to \"*Connection 2*\". |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2718 6. Create a SQL buffer \"test2.sql\". |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2719 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2720 Now \\[sql-send-region] in buffer \"test1.sql\" will send the region to |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2721 buffer \"*Connection 1*\", \\[sql-send-region] in buffer \"test2.sql\" |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2722 will send the region to buffer \"*Connection 2*\". |
24050 | 2723 |
2724 If you accidentally suspend your process, use \\[comint-continue-subjob] | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2725 to continue it. On some operating systems, this will not work because |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2726 the signals are not supported. |
24050 | 2727 |
2728 \\{sql-interactive-mode-map} | |
2729 Customization: Entry to this mode runs the hooks on `comint-mode-hook' | |
2730 and `sql-interactive-mode-hook' (in that order). Before each input, the | |
2731 hooks on `comint-input-filter-functions' are run. After each SQL | |
2732 interpreter output, the hooks on `comint-output-filter-functions' are | |
2733 run. | |
2734 | |
65198
7fbb366ab47a
(sql-interactive-mode): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
64837
diff
changeset
|
2735 Variable `sql-input-ring-file-name' controls the initialization of the |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2736 input ring history. |
24050 | 2737 |
2738 Variables `comint-output-filter-functions', a hook, and | |
2739 `comint-scroll-to-bottom-on-input' and | |
2740 `comint-scroll-to-bottom-on-output' control whether input and output | |
2741 cause the window to scroll to the end of the buffer. | |
2742 | |
2743 If you want to make SQL buffers limited in length, add the function | |
2744 `comint-truncate-buffer' to `comint-output-filter-functions'. | |
2745 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2746 Here is an example for your .emacs file. It keeps the SQLi buffer a |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2747 certain length. |
24050 | 2748 |
2749 \(add-hook 'sql-interactive-mode-hook | |
2750 \(function (lambda () | |
2751 \(setq comint-output-filter-functions 'comint-truncate-buffer)))) | |
2752 | |
2753 Here is another example. It will always put point back to the statement | |
2754 you entered, right above the output it created. | |
2755 | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2756 \(setq comint-output-filter-functions |
24050 | 2757 \(function (lambda (STR) (comint-show-output))))" |
63410
37dd5dc2f5ae
(sql-interactive-mode): Use delay-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
62772
diff
changeset
|
2758 (delay-mode-hooks (comint-mode)) |
108381 | 2759 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2760 ;; Get the `sql-product' for this interactive session. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2761 (set (make-local-variable 'sql-product) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2762 (or sql-interactive-product |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2763 sql-product)) |
108381 | 2764 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2765 ;; Setup the mode. |
24050 | 2766 (setq major-mode 'sql-interactive-mode) |
108381 | 2767 (setq mode-name (concat "SQLi[" (or (sql-get-product-feature sql-product :name) |
2768 (symbol-name sql-product)) "]")) | |
24050 | 2769 (use-local-map sql-interactive-mode-map) |
31392
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
2770 (if sql-interactive-mode-menu |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2771 (easy-menu-add sql-interactive-mode-menu)) ; XEmacs |
24050 | 2772 (set-syntax-table sql-mode-syntax-table) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2773 (make-local-variable 'sql-mode-font-lock-keywords) |
24050 | 2774 (make-local-variable 'font-lock-defaults) |
108381 | 2775 |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
2776 ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2777 ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2778 ;; will have just one quote. Therefore syntactic hilighting is |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2779 ;; disabled for interactive buffers. No imenu support. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2780 (sql-product-font-lock t nil) |
108381 | 2781 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2782 ;; Enable commenting and uncommenting of the region. |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
2783 (make-local-variable 'comment-start) |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
2784 (setq comment-start "--") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2785 ;; Abbreviation table init and case-insensitive. It is not activated |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2786 ;; by default. |
24050 | 2787 (setq local-abbrev-table sql-mode-abbrev-table) |
2788 (setq abbrev-all-caps 1) | |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2789 ;; Exiting the process will call sql-stop. |
24050 | 2790 (set-process-sentinel (get-buffer-process sql-buffer) 'sql-stop) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2791 ;; Create a usefull name for renaming this buffer later. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2792 (make-local-variable 'sql-alternate-buffer-name) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2793 (setq sql-alternate-buffer-name (sql-make-alternate-buffer-name)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2794 ;; User stuff. Initialize before the hook. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2795 (set (make-local-variable 'sql-prompt-regexp) |
108381 | 2796 (sql-get-product-feature sql-product :prompt-regexp)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2797 (set (make-local-variable 'sql-prompt-length) |
108381 | 2798 (sql-get-product-feature sql-product :prompt-length)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2799 (make-local-variable 'sql-input-ring-separator) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2800 (make-local-variable 'sql-input-ring-file-name) |
108381 | 2801 (setq comint-process-echoes t) |
2802 ;; Run the mode hook (along with comint's hooks). | |
62772
f2892faa87d4
* progmodes/ada-mode.el (ada-mode):
Lute Kamstra <lute@gnu.org>
parents:
59996
diff
changeset
|
2803 (run-mode-hooks 'sql-interactive-mode-hook) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2804 ;; Set comint based on user overrides. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2805 (setq comint-prompt-regexp sql-prompt-regexp) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2806 (setq left-margin sql-prompt-length) |
108381 | 2807 ;; Install input sender |
2808 (set (make-local-variable 'comint-input-sender) 'sql-input-sender) | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2809 ;; People wanting a different history file for each |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2810 ;; buffer/process/client/whatever can change separator and file-name |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2811 ;; on the sql-interactive-mode-hook. |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2812 (setq comint-input-ring-separator sql-input-ring-separator |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2813 comint-input-ring-file-name sql-input-ring-file-name) |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2814 ;; Calling the hook before calling comint-read-input-ring allows users |
24050 | 2815 ;; to set comint-input-ring-file-name in sql-interactive-mode-hook. |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2816 (comint-read-input-ring t)) |
24050 | 2817 |
2818 (defun sql-stop (process event) | |
2819 "Called when the SQL process is stopped. | |
2820 | |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2821 Writes the input history to a history file using |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2822 `comint-write-input-ring' and inserts a short message in the SQL buffer. |
24050 | 2823 |
2824 This function is a sentinel watching the SQL interpreter process. | |
2825 Sentinels will always get the two parameters PROCESS and EVENT." | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2826 (comint-write-input-ring) |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2827 (if (and (eq (current-buffer) sql-buffer) |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2828 (not buffer-read-only)) |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2829 (insert (format "\nProcess %s %s\n" process event)) |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2830 (message "Process %s %s" process event))) |
24050 | 2831 |
2832 | |
2833 | |
2834 ;;; Entry functions for different SQL interpreters. | |
2835 | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2836 ;;;###autoload |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2837 (defun sql-product-interactive (&optional product) |
108381 | 2838 "Run PRODUCT interpreter as an inferior process. |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2839 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2840 If buffer `*SQL*' exists but no process is running, make a new process. |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2841 If buffer exists and a process is running, just switch to buffer `*SQL*'. |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2842 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2843 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
108381 | 2844 (interactive "P") |
2845 | |
2846 (setq product | |
2847 (cond | |
2848 ((equal product '(4)) ; Universal arg, prompt for product | |
2849 (intern (completing-read "SQL product: " | |
2850 (mapcar (lambda (info) (symbol-name (car info))) | |
2851 sql-product-alist) | |
2852 nil 'require-match | |
2853 (or (and sql-product (symbol-name sql-product)) "ansi")))) | |
2854 ((symbolp product) product) ; Product specified | |
2855 (t sql-product))) ; Default to sql-product | |
2856 | |
2857 (when (sql-get-product-feature product :sqli-connect-func) | |
2858 (if (and sql-buffer | |
2859 (buffer-live-p sql-buffer) | |
2860 (comint-check-proc sql-buffer)) | |
2861 (pop-to-buffer sql-buffer) | |
2862 | |
2863 ;; Is the current buffer in sql-mode and | |
2864 ;; there is a buffer local setting of sql-buffer | |
2865 (let* ((start-buffer | |
2866 (and (derived-mode-p 'sql-mode) | |
2867 (current-buffer))) | |
2868 (start-sql-buffer | |
2869 (and start-buffer | |
2870 (let (found) | |
2871 (dolist (var (buffer-local-variables)) | |
2872 (and (consp var) | |
2873 (eq (car var) 'sql-buffer) | |
2874 (buffer-live-p (cdr var)) | |
2875 (get-buffer-process (cdr var)) | |
2876 (setq found (cdr var)))) | |
2877 found))) | |
2878 new-sqli-buffer) | |
2879 | |
2880 ;; Get credentials. | |
2881 (apply 'sql-get-login (sql-get-product-feature product :sqli-login)) | |
2882 | |
2883 ;; Connect to database. | |
2884 (message "Login...") | |
2885 (funcall (sql-get-product-feature product :sqli-connect-func) | |
2886 product | |
2887 (sql-get-product-feature product :sqli-options)) | |
2888 | |
2889 ;; Set SQLi mode. | |
2890 (setq sql-interactive-product product | |
2891 new-sqli-buffer (current-buffer) | |
2892 sql-buffer new-sqli-buffer) | |
2893 (sql-interactive-mode) | |
2894 | |
2895 ;; Set `sql-buffer' in the start buffer | |
2896 (when (and start-buffer (not start-sql-buffer)) | |
2897 (with-current-buffer start-buffer | |
2898 (setq sql-buffer new-sqli-buffer))) | |
2899 | |
2900 ;; All done. | |
2901 (message "Login...done") | |
2902 (pop-to-buffer sql-buffer))))) | |
2903 | |
2904 (defun sql-connect (product params) | |
2905 "Set up a comint buffer to connect to the SQL processor. | |
2906 | |
2907 PRODUCT is the SQL product. PARAMS is a list of strings which are | |
2908 passed as command line arguments." | |
2909 (let ((program (sql-get-product-feature product :sqli-program))) | |
2910 (set-buffer | |
2911 (if params | |
2912 (apply 'make-comint "SQL" program nil params) | |
2913 (make-comint "SQL" program nil))))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2914 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2915 ;;;###autoload |
24050 | 2916 (defun sql-oracle () |
2917 "Run sqlplus by Oracle as an inferior process. | |
2918 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2919 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 2920 If buffer exists and a process is running, just switch to buffer |
2921 `*SQL*'. | |
2922 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2923 Interpreter used comes from variable `sql-oracle-program'. Login uses |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2924 the variables `sql-user', `sql-password', and `sql-database' as |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2925 defaults, if set. Additional command line parameters can be stored in |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2926 the list `sql-oracle-options'. |
24050 | 2927 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2928 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 2929 input. See `sql-interactive-mode'. |
2930 | |
2931 To specify a coding system for converting non-ASCII characters | |
2932 in the input and output to the process, use \\[universal-coding-system-argument] | |
2933 before \\[sql-oracle]. You can also specify this with \\[set-buffer-process-coding-system] | |
2934 in the SQL buffer, after you start the process. | |
2935 The default comes from `process-coding-system-alist' and | |
2936 `default-process-coding-system'. | |
2937 | |
2938 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
2939 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2940 (sql-product-interactive 'oracle)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2941 |
108381 | 2942 (defun sql-connect-oracle (product options) |
2943 "Create comint buffer and connect to Oracle." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2944 ;; Produce user/password@database construct. Password without user |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2945 ;; is meaningless; database without user/password is meaningless, |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2946 ;; because "@param" will ask sqlplus to interpret the script |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2947 ;; "param". |
108381 | 2948 (let ((parameter nil)) |
2949 (if (not (string= "" sql-user)) | |
2950 (if (not (string= "" sql-password)) | |
2951 (setq parameter (concat sql-user "/" sql-password)) | |
2952 (setq parameter sql-user))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2953 (if (and parameter (not (string= "" sql-database))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2954 (setq parameter (concat parameter "@" sql-database))) |
108381 | 2955 (if parameter |
2956 (setq parameter (nconc (list parameter) options)) | |
2957 (setq parameter options)) | |
2958 (sql-connect product parameter))) | |
24050 | 2959 |
2960 | |
2961 | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2962 ;;;###autoload |
24050 | 2963 (defun sql-sybase () |
2964 "Run isql by SyBase as an inferior process. | |
2965 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2966 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 2967 If buffer exists and a process is running, just switch to buffer |
2968 `*SQL*'. | |
2969 | |
2970 Interpreter used comes from variable `sql-sybase-program'. Login uses | |
32621
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
2971 the variables `sql-server', `sql-user', `sql-password', and |
36523
e72a04113eac
(sql-sybase): Fix typo (was: query user about server two
Gerd Moellmann <gerd@gnu.org>
parents:
34704
diff
changeset
|
2972 `sql-database' as defaults, if set. Additional command line parameters |
e72a04113eac
(sql-sybase): Fix typo (was: query user about server two
Gerd Moellmann <gerd@gnu.org>
parents:
34704
diff
changeset
|
2973 can be stored in the list `sql-sybase-options'. |
24050 | 2974 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2975 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 2976 input. See `sql-interactive-mode'. |
2977 | |
2978 To specify a coding system for converting non-ASCII characters | |
2979 in the input and output to the process, use \\[universal-coding-system-argument] | |
2980 before \\[sql-sybase]. You can also specify this with \\[set-buffer-process-coding-system] | |
2981 in the SQL buffer, after you start the process. | |
2982 The default comes from `process-coding-system-alist' and | |
2983 `default-process-coding-system'. | |
2984 | |
2985 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
2986 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2987 (sql-product-interactive 'sybase)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2988 |
108381 | 2989 (defun sql-connect-sybase (product options) |
2990 "Create comint buffer and connect to Sybase." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2991 ;; Put all parameters to the program (if defined) in a list and call |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2992 ;; make-comint. |
108381 | 2993 (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2994 (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2995 (setq params (append (list "-S" sql-server) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2996 (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2997 (setq params (append (list "-D" sql-database) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2998 (if (not (string= "" sql-password)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2999 (setq params (append (list "-P" sql-password) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3000 (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3001 (setq params (append (list "-U" sql-user) params))) |
108381 | 3002 (sql-connect product params))) |
24050 | 3003 |
3004 | |
3005 | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3006 ;;;###autoload |
24050 | 3007 (defun sql-informix () |
3008 "Run dbaccess by Informix as an inferior process. | |
3009 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3010 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 3011 If buffer exists and a process is running, just switch to buffer |
3012 `*SQL*'. | |
3013 | |
3014 Interpreter used comes from variable `sql-informix-program'. Login uses | |
3015 the variable `sql-database' as default, if set. | |
3016 | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3017 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 3018 input. See `sql-interactive-mode'. |
3019 | |
3020 To specify a coding system for converting non-ASCII characters | |
3021 in the input and output to the process, use \\[universal-coding-system-argument] | |
3022 before \\[sql-informix]. You can also specify this with \\[set-buffer-process-coding-system] | |
3023 in the SQL buffer, after you start the process. | |
3024 The default comes from `process-coding-system-alist' and | |
3025 `default-process-coding-system'. | |
3026 | |
3027 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
3028 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3029 (sql-product-interactive 'informix)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3030 |
108381 | 3031 (defun sql-connect-informix (product options) |
3032 "Create comint buffer and connect to Informix." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3033 ;; username and password are ignored. |
108381 | 3034 (let ((db (if (string= "" sql-database) |
3035 "-" | |
3036 (if (string= "" sql-server) | |
3037 sql-database | |
3038 (concat sql-database "@" sql-server))))) | |
3039 (sql-connect product (append `(,db "-") options)))) | |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3040 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3041 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3042 |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3043 ;;;###autoload |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3044 (defun sql-sqlite () |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3045 "Run sqlite as an inferior process. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3046 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3047 SQLite is free software. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3048 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3049 If buffer `*SQL*' exists but no process is running, make a new process. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3050 If buffer exists and a process is running, just switch to buffer |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3051 `*SQL*'. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3052 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3053 Interpreter used comes from variable `sql-sqlite-program'. Login uses |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3054 the variables `sql-user', `sql-password', `sql-database', and |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3055 `sql-server' as defaults, if set. Additional command line parameters |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3056 can be stored in the list `sql-sqlite-options'. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3057 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3058 The buffer is put in SQL interactive mode, giving commands for sending |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3059 input. See `sql-interactive-mode'. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3060 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3061 To specify a coding system for converting non-ASCII characters |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3062 in the input and output to the process, use \\[universal-coding-system-argument] |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3063 before \\[sql-sqlite]. You can also specify this with \\[set-buffer-process-coding-system] |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3064 in the SQL buffer, after you start the process. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3065 The default comes from `process-coding-system-alist' and |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3066 `default-process-coding-system'. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3067 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3068 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3069 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3070 (sql-product-interactive 'sqlite)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3071 |
108381 | 3072 (defun sql-connect-sqlite (product options) |
3073 "Create comint buffer and connect to SQLite." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3074 ;; Put all parameters to the program (if defined) in a list and call |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3075 ;; make-comint. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3076 (let ((params)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3077 (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3078 (setq params (append (list sql-database) params))) |
108381 | 3079 (setq params (append options params)) |
3080 (sql-connect product params))) | |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3081 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3082 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3083 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3084 ;;;###autoload |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3085 (defun sql-mysql () |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3086 "Run mysql by TcX as an inferior process. |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3087 |
40432
225bd38b0ce7
(sql-mysql): Doc change by RMS.
Gerd Moellmann <gerd@gnu.org>
parents:
38872
diff
changeset
|
3088 Mysql versions 3.23 and up are free software. |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3089 |
24268 | 3090 If buffer `*SQL*' exists but no process is running, make a new process. |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3091 If buffer exists and a process is running, just switch to buffer |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3092 `*SQL*'. |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3093 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3094 Interpreter used comes from variable `sql-mysql-program'. Login uses |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3095 the variables `sql-user', `sql-password', `sql-database', and |
36523
e72a04113eac
(sql-sybase): Fix typo (was: query user about server two
Gerd Moellmann <gerd@gnu.org>
parents:
34704
diff
changeset
|
3096 `sql-server' as defaults, if set. Additional command line parameters |
e72a04113eac
(sql-sybase): Fix typo (was: query user about server two
Gerd Moellmann <gerd@gnu.org>
parents:
34704
diff
changeset
|
3097 can be stored in the list `sql-mysql-options'. |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3098 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3099 The buffer is put in SQL interactive mode, giving commands for sending |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3100 input. See `sql-interactive-mode'. |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3101 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3102 To specify a coding system for converting non-ASCII characters |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3103 in the input and output to the process, use \\[universal-coding-system-argument] |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3104 before \\[sql-mysql]. You can also specify this with \\[set-buffer-process-coding-system] |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3105 in the SQL buffer, after you start the process. |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3106 The default comes from `process-coding-system-alist' and |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3107 `default-process-coding-system'. |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3108 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3109 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3110 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3111 (sql-product-interactive 'mysql)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3112 |
108381 | 3113 (defun sql-connect-mysql (product options) |
3114 "Create comint buffer and connect to MySQL." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3115 ;; Put all parameters to the program (if defined) in a list and call |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3116 ;; make-comint. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3117 (let ((params)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3118 (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3119 (setq params (append (list sql-database) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3120 (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3121 (setq params (append (list (concat "--host=" sql-server)) params))) |
108381 | 3122 (if (not (and sql-port (numberp sql-port))) |
3123 (setq params (append (list (concat "--port=" (number-to-string sql-port))) params))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3124 (if (not (string= "" sql-password)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3125 (setq params (append (list (concat "--password=" sql-password)) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3126 (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3127 (setq params (append (list (concat "--user=" sql-user)) params))) |
108381 | 3128 (setq params (append options params)) |
3129 (sql-connect product params))) | |
24050 | 3130 |
3131 | |
3132 | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3133 ;;;###autoload |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3134 (defun sql-solid () |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3135 "Run solsql by Solid as an inferior process. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3136 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3137 If buffer `*SQL*' exists but no process is running, make a new process. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3138 If buffer exists and a process is running, just switch to buffer |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3139 `*SQL*'. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3140 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3141 Interpreter used comes from variable `sql-solid-program'. Login uses |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3142 the variables `sql-user', `sql-password', and `sql-server' as |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3143 defaults, if set. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3144 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3145 The buffer is put in SQL interactive mode, giving commands for sending |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3146 input. See `sql-interactive-mode'. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3147 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3148 To specify a coding system for converting non-ASCII characters |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3149 in the input and output to the process, use \\[universal-coding-system-argument] |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3150 before \\[sql-solid]. You can also specify this with \\[set-buffer-process-coding-system] |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3151 in the SQL buffer, after you start the process. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3152 The default comes from `process-coding-system-alist' and |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3153 `default-process-coding-system'. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3154 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3155 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3156 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3157 (sql-product-interactive 'solid)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3158 |
108381 | 3159 (defun sql-connect-solid (product options) |
3160 "Create comint buffer and connect to Solid." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3161 ;; Put all parameters to the program (if defined) in a list and call |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3162 ;; make-comint. |
108381 | 3163 (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3164 ;; It only makes sense if both username and password are there. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3165 (if (not (or (string= "" sql-user) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3166 (string= "" sql-password))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3167 (setq params (append (list sql-user sql-password) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3168 (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3169 (setq params (append (list sql-server) params))) |
108381 | 3170 (sql-connect product params))) |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3171 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3172 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3173 |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3174 ;;;###autoload |
24050 | 3175 (defun sql-ingres () |
3176 "Run sql by Ingres as an inferior process. | |
3177 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3178 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 3179 If buffer exists and a process is running, just switch to buffer |
3180 `*SQL*'. | |
3181 | |
3182 Interpreter used comes from variable `sql-ingres-program'. Login uses | |
3183 the variable `sql-database' as default, if set. | |
3184 | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3185 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 3186 input. See `sql-interactive-mode'. |
3187 | |
3188 To specify a coding system for converting non-ASCII characters | |
3189 in the input and output to the process, use \\[universal-coding-system-argument] | |
3190 before \\[sql-ingres]. You can also specify this with \\[set-buffer-process-coding-system] | |
3191 in the SQL buffer, after you start the process. | |
3192 The default comes from `process-coding-system-alist' and | |
3193 `default-process-coding-system'. | |
3194 | |
3195 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
3196 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3197 (sql-product-interactive 'ingres)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3198 |
108381 | 3199 (defun sql-connect-ingres (product options) |
3200 "Create comint buffer and connect to Ingres." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3201 ;; username and password are ignored. |
108381 | 3202 (sql-connect product |
3203 (append (if (string= "" sql-database) | |
3204 nil | |
3205 (list sql-database)) | |
3206 options))) | |
24050 | 3207 |
3208 | |
3209 | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3210 ;;;###autoload |
24050 | 3211 (defun sql-ms () |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3212 "Run osql by Microsoft as an inferior process. |
24050 | 3213 |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3214 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 3215 If buffer exists and a process is running, just switch to buffer |
3216 `*SQL*'. | |
3217 | |
3218 Interpreter used comes from variable `sql-ms-program'. Login uses the | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3219 variables `sql-user', `sql-password', `sql-database', and `sql-server' |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3220 as defaults, if set. Additional command line parameters can be stored |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3221 in the list `sql-ms-options'. |
24050 | 3222 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3223 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 3224 input. See `sql-interactive-mode'. |
3225 | |
3226 To specify a coding system for converting non-ASCII characters | |
3227 in the input and output to the process, use \\[universal-coding-system-argument] | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3228 before \\[sql-ms]. You can also specify this with \\[set-buffer-process-coding-system] |
24050 | 3229 in the SQL buffer, after you start the process. |
3230 The default comes from `process-coding-system-alist' and | |
3231 `default-process-coding-system'. | |
3232 | |
3233 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
3234 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3235 (sql-product-interactive 'ms)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3236 |
108381 | 3237 (defun sql-connect-ms (product options) |
3238 "Create comint buffer and connect to Microsoft SQL Server." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3239 ;; Put all parameters to the program (if defined) in a list and call |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3240 ;; make-comint. |
108381 | 3241 (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3242 (if (not (string= "" sql-server)) |
24050 | 3243 (setq params (append (list "-S" sql-server) params))) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3244 (if (not (string= "" sql-database)) |
24050 | 3245 (setq params (append (list "-d" sql-database) params))) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3246 (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3247 (setq params (append (list "-U" sql-user) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3248 (if (not (string= "" sql-password)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3249 (setq params (append (list "-P" sql-password) params)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3250 (if (string= "" sql-user) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3251 ;; if neither user nor password is provided, use system |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3252 ;; credentials. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3253 (setq params (append (list "-E") params)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3254 ;; If -P is passed to ISQL as the last argument without a |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3255 ;; password, it's considered null. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3256 (setq params (append params (list "-P"))))) |
108381 | 3257 (sql-connect product params))) |
24050 | 3258 |
3259 | |
3260 | |
3261 ;;;###autoload | |
3262 (defun sql-postgres () | |
3263 "Run psql by Postgres as an inferior process. | |
3264 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3265 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 3266 If buffer exists and a process is running, just switch to buffer |
3267 `*SQL*'. | |
3268 | |
3269 Interpreter used comes from variable `sql-postgres-program'. Login uses | |
24354
6a438ef0b573
Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents:
24353
diff
changeset
|
3270 the variables `sql-database' and `sql-server' as default, if set. |
36523
e72a04113eac
(sql-sybase): Fix typo (was: query user about server two
Gerd Moellmann <gerd@gnu.org>
parents:
34704
diff
changeset
|
3271 Additional command line parameters can be stored in the list |
e72a04113eac
(sql-sybase): Fix typo (was: query user about server two
Gerd Moellmann <gerd@gnu.org>
parents:
34704
diff
changeset
|
3272 `sql-postgres-options'. |
24050 | 3273 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3274 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 3275 input. See `sql-interactive-mode'. |
3276 | |
3277 To specify a coding system for converting non-ASCII characters | |
3278 in the input and output to the process, use \\[universal-coding-system-argument] | |
3279 before \\[sql-postgres]. You can also specify this with \\[set-buffer-process-coding-system] | |
3280 in the SQL buffer, after you start the process. | |
3281 The default comes from `process-coding-system-alist' and | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
3282 `default-process-coding-system'. If your output lines end with ^M, |
24050 | 3283 your might try undecided-dos as a coding system. If this doesn't help, |
3284 Try to set `comint-output-filter-functions' like this: | |
3285 | |
3286 \(setq comint-output-filter-functions (append comint-output-filter-functions | |
3287 '(comint-strip-ctrl-m))) | |
3288 | |
3289 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
3290 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3291 (sql-product-interactive 'postgres)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3292 |
108381 | 3293 (defun sql-connect-postgres (product options) |
3294 "Create comint buffer and connect to Postgres." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3295 ;; username and password are ignored. Mark Stosberg suggest to add |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3296 ;; the database at the end. Jason Beegan suggest using --pset and |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3297 ;; pager=off instead of \\o|cat. The later was the solution by |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3298 ;; Gregor Zych. Jason's suggestion is the default value for |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3299 ;; sql-postgres-options. |
108381 | 3300 (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3301 (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3302 (setq params (append params (list sql-database)))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3303 (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3304 (setq params (append (list "-h" sql-server) params))) |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
3305 (if (not (string= "" sql-user)) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
3306 (setq params (append (list "-U" sql-user) params))) |
108381 | 3307 (sql-connect product params))) |
24050 | 3308 |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3309 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3310 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3311 ;;;###autoload |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3312 (defun sql-interbase () |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3313 "Run isql by Interbase as an inferior process. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3314 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3315 If buffer `*SQL*' exists but no process is running, make a new process. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3316 If buffer exists and a process is running, just switch to buffer |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3317 `*SQL*'. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3318 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3319 Interpreter used comes from variable `sql-interbase-program'. Login |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3320 uses the variables `sql-user', `sql-password', and `sql-database' as |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3321 defaults, if set. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3322 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3323 The buffer is put in SQL interactive mode, giving commands for sending |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3324 input. See `sql-interactive-mode'. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3325 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3326 To specify a coding system for converting non-ASCII characters |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3327 in the input and output to the process, use \\[universal-coding-system-argument] |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3328 before \\[sql-interbase]. You can also specify this with \\[set-buffer-process-coding-system] |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3329 in the SQL buffer, after you start the process. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3330 The default comes from `process-coding-system-alist' and |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3331 `default-process-coding-system'. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3332 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3333 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3334 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3335 (sql-product-interactive 'interbase)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3336 |
108381 | 3337 (defun sql-connect-interbase (product options) |
3338 "Create comint buffer and connect to Interbase." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3339 ;; Put all parameters to the program (if defined) in a list and call |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3340 ;; make-comint. |
108381 | 3341 (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3342 (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3343 (setq params (append (list "-u" sql-user) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3344 (if (not (string= "" sql-password)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3345 (setq params (append (list "-p" sql-password) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3346 (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3347 (setq params (cons sql-database params))) ; add to the front! |
108381 | 3348 (sql-connect product params))) |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3349 |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3350 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3351 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3352 ;;;###autoload |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3353 (defun sql-db2 () |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3354 "Run db2 by IBM as an inferior process. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3355 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3356 If buffer `*SQL*' exists but no process is running, make a new process. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3357 If buffer exists and a process is running, just switch to buffer |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3358 `*SQL*'. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3359 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3360 Interpreter used comes from variable `sql-db2-program'. There is not |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3361 automatic login. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3362 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3363 The buffer is put in SQL interactive mode, giving commands for sending |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3364 input. See `sql-interactive-mode'. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3365 |
38872 | 3366 If you use \\[sql-accumulate-and-indent] to send multiline commands to |
3367 db2, newlines will be escaped if necessary. If you don't want that, set | |
3368 `comint-input-sender' back to `comint-simple-send' by writing an after | |
3369 advice. See the elisp manual for more information. | |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3370 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3371 To specify a coding system for converting non-ASCII characters |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3372 in the input and output to the process, use \\[universal-coding-system-argument] |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3373 before \\[sql-db2]. You can also specify this with \\[set-buffer-process-coding-system] |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3374 in the SQL buffer, after you start the process. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3375 The default comes from `process-coding-system-alist' and |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3376 `default-process-coding-system'. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3377 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3378 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3379 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3380 (sql-product-interactive 'db2)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3381 |
108381 | 3382 (defun sql-connect-db2 (product options) |
3383 "Create comint buffer and connect to DB2." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3384 ;; Put all parameters to the program (if defined) in a list and call |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3385 ;; make-comint. |
108381 | 3386 (sql-connect product options) |
3387 ) | |
3388 ;; ;; Properly escape newlines when DB2 is interactive. | |
3389 ;; (setq comint-input-sender 'sql-escape-newlines-and-send)) | |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3390 |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3391 ;;;###autoload |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3392 (defun sql-linter () |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3393 "Run inl by RELEX as an inferior process. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3394 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3395 If buffer `*SQL*' exists but no process is running, make a new process. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3396 If buffer exists and a process is running, just switch to buffer |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3397 `*SQL*'. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3398 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3399 Interpreter used comes from variable `sql-linter-program' - usually `inl'. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3400 Login uses the variables `sql-user', `sql-password', `sql-database' and |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3401 `sql-server' as defaults, if set. Additional command line parameters |
108381 | 3402 can be stored in the list `sql-linter-options'. Run inl -h to get help on |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3403 parameters. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3404 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3405 `sql-database' is used to set the LINTER_MBX environment variable for |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3406 local connections, `sql-server' refers to the server name from the |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3407 `nodetab' file for the network connection (dbc_tcp or friends must run |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3408 for this to work). If `sql-password' is an empty string, inl will use |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3409 an empty password. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3410 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3411 The buffer is put in SQL interactive mode, giving commands for sending |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3412 input. See `sql-interactive-mode'. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3413 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3414 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3415 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3416 (sql-product-interactive 'linter)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3417 |
108381 | 3418 (defun sql-connect-linter (product options) |
3419 "Create comint buffer and connect to Linter." | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3420 ;; Put all parameters to the program (if defined) in a list and call |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3421 ;; make-comint. |
108381 | 3422 (let ((params options) |
3423 (login nil) | |
3424 (old-mbx (getenv "LINTER_MBX"))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3425 (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3426 (setq login (concat sql-user "/" sql-password))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3427 (setq params (append (list "-u" login) params)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3428 (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3429 (setq params (append (list "-n" sql-server) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3430 (if (string= "" sql-database) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3431 (setenv "LINTER_MBX" nil) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3432 (setenv "LINTER_MBX" sql-database)) |
108381 | 3433 (sql-connect product params) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3434 (setenv "LINTER_MBX" old-mbx))) |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3435 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3436 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3437 |
24050 | 3438 (provide 'sql) |
3439 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
3440 ;; arch-tag: 7e1fa1c4-9ca2-402e-87d2-83a5eccb7ac3 |
24050 | 3441 ;;; sql.el ends here |
108381 | 3442 |