Mercurial > emacs
annotate lisp/progmodes/sql.el @ 109666:8fc5e1925ae2
* src/lisp.h (fatal_error_signal, emacs_root_dir): Add declaration.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Fri, 06 Aug 2010 11:56:41 -0700 |
parents | b4b02bfd4d95 |
children | 232ba164887b |
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> |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
8 ;; Version: 2.4 |
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." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
155 ;; :type 'sql-login-params |
108381 | 156 ;; :group 'SQL) |
157 ;; | |
158 ;; (sql-set-product-feature 'xyz | |
159 ;; :sqli-login 'my-sql-xyz-login-params) | |
160 | |
161 ;; (defcustom my-sql-xyz-options '("-X" "-Y" "-Z") | |
162 ;; "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
|
163 ;; :type '(repeat string) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
164 ;; :group 'SQL) |
108381 | 165 ;; |
166 ;; (sql-set-product-feature 'xyz | |
167 ;; :sqli-options 'my-sql-xyz-options)) | |
168 | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
169 ;; (defun my-sql-comint-xyz (product options) |
108381 | 170 ;; "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
|
171 ;; |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
172 ;; ;; Do something with `sql-user', `sql-password', |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
173 ;; ;; `sql-database', and `sql-server'. |
108381 | 174 ;; (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
175 ;; (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
176 ;; (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
|
177 ;; (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
178 ;; (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
|
179 ;; (if (not (string= "" sql-password)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
180 ;; (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
|
181 ;; (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
182 ;; (setq params (append (list "-U" sql-user) params))) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
183 ;; (sql-comint product params))) |
108381 | 184 ;; |
185 ;; (sql-set-product-feature 'xyz | |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
186 ;; :sqli-comint-func 'my-sql-comint-xyz) |
108381 | 187 |
188 ;; 6) Define a convienence function to invoke the SQL interpreter. | |
189 | |
190 ;; (defun my-sql-xyz () | |
191 ;; "Run ixyz by XyzDB as an inferior process." | |
192 ;; (interactive) | |
193 ;; (sql-product-interactive 'xyz)) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
194 |
51929
3da2cf447bf9
Revert last change.
Juanma Barranquero <lekktu@gmail.com>
parents:
51893
diff
changeset
|
195 ;;; To Do: |
51893
1a294cfb1636
Version 1.8.0 of sql-mode.
Juanma Barranquero <lekktu@gmail.com>
parents:
51607
diff
changeset
|
196 |
108381 | 197 ;; Improve keyword highlighting for individual products. I have tried |
198 ;; to update those database that I use. Feel free to send me updates, | |
199 ;; or direct me to the reference manuals for your favorite database. | |
200 | |
201 ;; When there are no keywords defined, the ANSI keywords are | |
202 ;; highlighted. ANSI keywords are highlighted even if the keyword is | |
203 ;; not used for your current product. This should help identify | |
204 ;; portability concerns. | |
205 | |
206 ;; Add different highlighting levels. | |
207 | |
208 ;; Add support for listing available tables or the columns in a table. | |
24050 | 209 |
210 ;;; Thanks to all the people who helped me out: | |
211 | |
108381 | 212 ;; Alex Schroeder <alex@gnu.org> -- the original author |
24050 | 213 ;; Kai Blauberg <kai.blauberg@metla.fi> |
214 ;; <ibalaban@dalet.com> | |
215 ;; Yair Friedman <yfriedma@JohnBryce.Co.Il> | |
216 ;; 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
|
217 ;; nino <nino@inform.dk> |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
218 ;; 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
|
219 ;; 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
|
220 ;; 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
|
221 ;; 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
|
222 ;; Harald Maier <maierh@myself.com> -- sql-send-string |
108381 | 223 ;; 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
|
224 |
24050 | 225 |
226 | |
227 ;;; Code: | |
228 | |
229 (require 'comint) | |
230 ;; 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
|
231 (eval-when-compile |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
232 (require 'regexp-opt)) |
24050 | 233 (require 'custom) |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
234 (eval-when-compile ;; needed in Emacs 19, 20 |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
235 (setq max-specpdl-size (max max-specpdl-size 2000))) |
24050 | 236 |
65240
e3995ff46137
(font-lock-keyword-face, font-lock-set-defaults, font-lock-string-face):
Juanma Barranquero <lekktu@gmail.com>
parents:
65198
diff
changeset
|
237 (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
|
238 (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
|
239 (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
|
240 |
24050 | 241 ;;; Allow customization |
242 | |
243 (defgroup SQL nil | |
64052
68f51d595f7f
(SQL): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63410
diff
changeset
|
244 "Running a SQL interpreter from within Emacs buffers." |
24556 | 245 :version "20.4" |
108381 | 246 :group 'languages |
24050 | 247 :group 'processes) |
248 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
249 ;; These four variables will be used as defaults, if set. |
24050 | 250 |
251 (defcustom sql-user "" | |
108381 | 252 "Default username." |
24050 | 253 :type 'string |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
254 :group 'SQL |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
255 :safe 'stringp) |
24050 | 256 |
257 (defcustom sql-password "" | |
108381 | 258 "Default password. |
24050 | 259 |
260 Storing your password in a textfile such as ~/.emacs could be dangerous. | |
261 Customizing your password will store it in your ~/.emacs file." | |
262 :type 'string | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
263 :group 'SQL |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
264 :risky t) |
24050 | 265 |
266 (defcustom sql-database "" | |
108381 | 267 "Default database." |
24050 | 268 :type 'string |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
269 :group 'SQL |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
270 :safe 'stringp) |
24050 | 271 |
272 (defcustom sql-server "" | |
108381 | 273 "Default server or host." |
24050 | 274 :type 'string |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
275 :group 'SQL |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
276 :safe 'stringp) |
108381 | 277 |
278 (defcustom sql-port nil | |
279 "Default server or host." | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
280 :version "24.1" |
108381 | 281 :type 'number |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
282 :group 'SQL |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
283 :safe 'numberp) |
24050 | 284 |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
285 ;; Login parameter type |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
286 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
287 (define-widget 'sql-login-params 'lazy |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
288 "Widget definition of the login parameters list" |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
289 :tag "Login Parameters" |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
290 :type '(repeat (choice |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
291 (const user) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
292 (const password) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
293 (choice :tag "server" |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
294 (const server) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
295 (list :tag "file" |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
296 (const :format "" server) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
297 (const :format "" :file) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
298 regexp) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
299 (list :tag "completion" |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
300 (const :format "" server) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
301 (const :format "" :completion) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
302 (restricted-sexp |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
303 :match-alternatives (listp symbolp)))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
304 (choice :tag "database" |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
305 (const database) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
306 (list :tag "file" |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
307 (const :format "" database) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
308 (const :format "" :file) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
309 regexp) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
310 (list :tag "completion" |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
311 (const :format "" database) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
312 (const :format "" :completion) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
313 (restricted-sexp |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
314 :match-alternatives (listp symbolp)))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
315 (const port)))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
316 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
317 ;; SQL Product support |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
318 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
319 (defvar sql-interactive-product nil |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
320 "Product under `sql-interactive-mode'.") |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
321 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
322 (defvar sql-connection nil |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
323 "Connection name if interactive session started by `sql-connect'.") |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
324 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
325 (defvar sql-product-alist |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
326 '((ansi |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
327 :name "ANSI" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
328 :font-lock sql-mode-ansi-font-lock-keywords) |
108381 | 329 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
330 (db2 |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
331 :name "DB2" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
332 :font-lock sql-mode-db2-font-lock-keywords |
108381 | 333 :sqli-program sql-db2-program |
334 :sqli-options sql-db2-options | |
335 :sqli-login sql-db2-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
336 :sqli-comint-func sql-comint-db2 |
108381 | 337 :prompt-regexp "^db2 => " |
338 :prompt-length 7 | |
339 :input-filter sql-escape-newlines-filter) | |
340 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
341 (informix |
108381 | 342 :name "Informix" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
343 :font-lock sql-mode-informix-font-lock-keywords |
108381 | 344 :sqli-program sql-informix-program |
345 :sqli-options sql-informix-options | |
346 :sqli-login sql-informix-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
347 :sqli-comint-func sql-comint-informix |
108381 | 348 :prompt-regexp "^> " |
349 :prompt-length 2 | |
350 :syntax-alist ((?{ . "<") (?} . ">"))) | |
351 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
352 (ingres |
108381 | 353 :name "Ingres" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
354 :font-lock sql-mode-ingres-font-lock-keywords |
108381 | 355 :sqli-program sql-ingres-program |
356 :sqli-options sql-ingres-options | |
357 :sqli-login sql-ingres-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
358 :sqli-comint-func sql-comint-ingres |
108381 | 359 :prompt-regexp "^\* " |
360 :prompt-length 2) | |
361 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
362 (interbase |
108381 | 363 :name "Interbase" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
364 :font-lock sql-mode-interbase-font-lock-keywords |
108381 | 365 :sqli-program sql-interbase-program |
366 :sqli-options sql-interbase-options | |
367 :sqli-login sql-interbase-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
368 :sqli-comint-func sql-comint-interbase |
108381 | 369 :prompt-regexp "^SQL> " |
370 :prompt-length 5) | |
371 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
372 (linter |
108381 | 373 :name "Linter" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
374 :font-lock sql-mode-linter-font-lock-keywords |
108381 | 375 :sqli-program sql-linter-program |
376 :sqli-options sql-linter-options | |
377 :sqli-login sql-linter-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
378 :sqli-comint-func sql-comint-linter |
108381 | 379 :prompt-regexp "^SQL>" |
380 :prompt-length 4) | |
381 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
382 (ms |
108381 | 383 :name "Microsoft" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
384 :font-lock sql-mode-ms-font-lock-keywords |
108381 | 385 :sqli-program sql-ms-program |
386 :sqli-options sql-ms-options | |
387 :sqli-login sql-ms-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
388 :sqli-comint-func sql-comint-ms |
108381 | 389 :prompt-regexp "^[0-9]*>" |
390 :prompt-length 5 | |
391 :syntax-alist ((?@ . "w")) | |
392 :terminator ("^go" . "go")) | |
393 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
394 (mysql |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
395 :name "MySQL" |
108381 | 396 :free-software t |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
397 :font-lock sql-mode-mysql-font-lock-keywords |
108381 | 398 :sqli-program sql-mysql-program |
399 :sqli-options sql-mysql-options | |
400 :sqli-login sql-mysql-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
401 :sqli-comint-func sql-comint-mysql |
108381 | 402 :prompt-regexp "^mysql> " |
403 :prompt-length 6 | |
404 :input-filter sql-remove-tabs-filter) | |
405 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
406 (oracle |
108381 | 407 :name "Oracle" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
408 :font-lock sql-mode-oracle-font-lock-keywords |
108381 | 409 :sqli-program sql-oracle-program |
410 :sqli-options sql-oracle-options | |
411 :sqli-login sql-oracle-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
412 :sqli-comint-func sql-comint-oracle |
108381 | 413 :prompt-regexp "^SQL> " |
414 :prompt-length 5 | |
415 :syntax-alist ((?$ . "w") (?# . "w")) | |
416 :terminator ("\\(^/\\|;\\)" . "/") | |
417 :input-filter sql-placeholders-filter) | |
418 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
419 (postgres |
108381 | 420 :name "Postgres" |
421 :free-software t | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
422 :font-lock sql-mode-postgres-font-lock-keywords |
108381 | 423 :sqli-program sql-postgres-program |
424 :sqli-options sql-postgres-options | |
425 :sqli-login sql-postgres-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
426 :sqli-comint-func sql-comint-postgres |
108381 | 427 :prompt-regexp "^.*[#>] *" |
428 :prompt-length 5 | |
429 :input-filter sql-remove-tabs-filter | |
430 :terminator ("\\(^[\\]g\\|;\\)" . ";")) | |
431 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
432 (solid |
108381 | 433 :name "Solid" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
434 :font-lock sql-mode-solid-font-lock-keywords |
108381 | 435 :sqli-program sql-solid-program |
436 :sqli-options sql-solid-options | |
437 :sqli-login sql-solid-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
438 :sqli-comint-func sql-comint-solid |
108381 | 439 :prompt-regexp "^" |
440 :prompt-length 0) | |
441 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
442 (sqlite |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
443 :name "SQLite" |
108381 | 444 :free-software t |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
445 :font-lock sql-mode-sqlite-font-lock-keywords |
108381 | 446 :sqli-program sql-sqlite-program |
447 :sqli-options sql-sqlite-options | |
448 :sqli-login sql-sqlite-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
449 :sqli-comint-func sql-comint-sqlite |
108381 | 450 :prompt-regexp "^sqlite> " |
451 :prompt-length 8) | |
452 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
453 (sybase |
108381 | 454 :name "Sybase" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
455 :font-lock sql-mode-sybase-font-lock-keywords |
108381 | 456 :sqli-program sql-sybase-program |
457 :sqli-options sql-sybase-options | |
458 :sqli-login sql-sybase-login-params | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
459 :sqli-comint-func sql-comint-sybase |
108381 | 460 :prompt-regexp "^SQL> " |
461 :prompt-length 5 | |
462 :syntax-alist ((?@ . "w")) | |
463 :terminator ("^go" . "go")) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
464 ) |
108381 | 465 "An alist of product specific configuration settings. |
466 | |
467 Without an entry in this list a product will not be properly | |
468 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
|
469 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
470 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
|
471 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
472 \(PRODUCT FEATURE VALUE ...) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
473 |
108381 | 474 where PRODUCT is the appropriate value of `sql-product'. The |
475 product name is then followed by FEATURE-VALUE pairs. If a | |
476 FEATURE is not specified, its VALUE is treated as nil. FEATURE | |
477 may be any one of the following: | |
478 | |
479 :name string containing the displayable name of | |
480 the product. | |
481 | |
482 :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
|
483 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
484 :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
|
485 specific font lock highlighting patterns. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
486 |
108381 | 487 :sqli-program name of the variable containing the product |
488 specific interactive program name. | |
489 | |
490 :sqli-options name of the variable containing the list | |
491 of product specific options. | |
492 | |
493 :sqli-login name of the variable containing the list of | |
494 login parameters (i.e., user, password, | |
495 database and server) needed to connect to | |
496 the database. | |
497 | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
498 :sqli-comint-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
|
499 parameters that will use the values of |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
500 `sql-user', `sql-password', |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
501 `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
|
502 comint buffer and connect to the |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
503 database. Do product specific |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
504 configuration of comint in this function. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
505 |
108381 | 506 :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
|
507 the prompt issued by the product |
108381 | 508 interpreter. |
509 | |
510 :prompt-length length of the prompt on the line. | |
511 | |
512 :input-filter function which can filter strings sent to | |
513 the command interpreter. It is also used | |
514 by the `sql-send-string', | |
515 `sql-send-region', `sql-send-paragraph' | |
516 and `sql-send-buffer' functions. The | |
517 function is passed the string sent to the | |
518 command interpreter and must return the | |
519 filtered string. | |
520 | |
521 :terminator the terminator to be sent after a | |
522 `sql-send-string', `sql-send-region', | |
523 `sql-send-paragraph' and | |
524 `sql-send-buffer' command. May be the | |
525 literal string or a cons of a regexp to | |
526 match an existing terminator in the | |
527 string and the terminator to be used if | |
528 its absent. By default \";\". | |
529 | |
530 :syntax-alist alist of syntax table entries to enable | |
531 special character treatment by font-lock | |
532 and imenu. | |
533 | |
534 Other features can be stored but they will be ignored. However, | |
535 you can develop new functionality which is product independent by | |
536 using `sql-get-product-feature' to lookup the product specific | |
537 settings.") | |
538 | |
539 (defvar sql-indirect-features | |
540 '(:font-lock :sqli-program :sqli-options :sqli-login)) | |
541 | |
542 ;;;###autoload | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
543 (defcustom sql-connection-alist nil |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
544 "An alist of connection parameters for interacting with a SQL |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
545 product. |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
546 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
547 Each element of the alist is as follows: |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
548 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
549 \(CONNECTION \(SQL-VARIABLE VALUE) ...) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
550 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
551 Where CONNECTION is a symbol identifying the connection, SQL-VARIABLE |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
552 is the symbol name of a SQL mode variable, and VALUE is the value to |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
553 be assigned to the variable. |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
554 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
555 The most common SQL-VARIABLE settings associated with a connection |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
556 are: |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
557 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
558 `sql-product' |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
559 `sql-user' |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
560 `sql-password' |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
561 `sql-port' |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
562 `sql-server' |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
563 `sql-database' |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
564 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
565 If a SQL-VARIABLE is part of the connection, it will not be |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
566 prompted for during login." |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
567 |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
568 :type `(alist :key-type (string :tag "Connection") |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
569 :value-type |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
570 (set |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
571 (group (const :tag "Product" sql-product) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
572 (choice |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
573 ,@(mapcar (lambda (prod-info) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
574 `(const :tag |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
575 ,(or (plist-get (cdr prod-info) :name) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
576 (capitalize (symbol-name (car prod-info)))) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
577 (quote ,(car prod-info)))) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
578 sql-product-alist))) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
579 (group (const :tag "Username" sql-user) string) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
580 (group (const :tag "Password" sql-password) string) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
581 (group (const :tag "Server" sql-server) string) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
582 (group (const :tag "Database" sql-database) string) |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
583 (group (const :tag "Port" sql-port) integer) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
584 (repeat :inline t |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
585 (list :tab "Other" |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
586 (symbol :tag " Variable Symbol") |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
587 (sexp :tag "Value Expression"))))) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
588 :version "24.1" |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
589 :group 'SQL) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
590 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
591 ;;;###autoload |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
592 (defcustom sql-product 'ansi |
108381 | 593 "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
|
594 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
|
595 :type `(choice |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
596 ,@(mapcar (lambda (prod-info) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
597 `(const :tag |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
598 ,(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
|
599 (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
|
600 ,(car prod-info))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
601 sql-product-alist)) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
602 :group 'SQL |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
603 :safe 'symbolp) |
108381 | 604 |
605 ;; 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
|
606 |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
607 (defcustom sql-electric-stuff nil |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
608 "Treat some input as electric. |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
609 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
|
610 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
|
611 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
|
612 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
|
613 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
|
614 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
|
615 :type '(choice (const :tag "Nothing" nil) |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
616 (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
|
617 (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
|
618 :version "20.8" |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
619 :group 'SQL) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
620 |
108381 | 621 (defcustom sql-send-terminator nil |
622 "When non-nil, add a terminator to text sent to the SQL interpreter. | |
623 | |
624 When text is sent to the SQL interpreter (via `sql-send-string', | |
625 `sql-send-region', `sql-send-paragraph' or `sql-send-buffer'), a | |
626 command terminator can be automatically sent as well. The | |
627 terminator is not sent, if the string sent already ends with the | |
628 terminator. | |
629 | |
630 If this value is t, then the default command terminator for the | |
631 SQL interpreter is sent. If this value is a string, then the | |
632 string is sent. | |
633 | |
634 If the value is a cons cell of the form (PAT . TERM), then PAT is | |
635 a regexp used to match the terminator in the string and TERM is | |
636 the terminator to be sent. This form is useful if the SQL | |
637 interpreter has more than one way of submitting a SQL command. | |
638 The PAT regexp can match any of them, and TERM is the way we do | |
639 it automatically." | |
640 | |
641 :type '(choice (const :tag "No Terminator" nil) | |
642 (const :tag "Default Terminator" t) | |
643 (string :tag "Terminator String") | |
644 (cons :tag "Terminator Pattern and String" | |
645 (string :tag "Terminator Pattern") | |
646 (string :tag "Terminator String"))) | |
647 :version "22.2" | |
648 :group 'SQL) | |
649 | |
24050 | 650 (defcustom sql-pop-to-buffer-after-send-region nil |
108381 | 651 "When non-nil, pop to the buffer SQL statements are sent to. |
652 | |
653 After a call to `sql-sent-string', `sql-send-region', | |
654 `sql-send-paragraph' or `sql-send-buffer', the window is split | |
655 and the SQLi buffer is shown. If this variable is not nil, that | |
656 buffer's window will be selected by calling `pop-to-buffer'. If | |
657 this variable is nil, that buffer is shown using | |
658 `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
|
659 :type 'boolean |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
660 :group 'SQL) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
661 |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
662 ;; imenu support for sql-mode. |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
663 |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
664 (defvar sql-imenu-generic-expression |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
665 ;; 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
|
666 '(("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
|
667 ("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
|
668 ("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
|
669 ("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
|
670 ("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
|
671 ("Packages" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*package\\s-+\\(body\\s-+\\)?\\(\\w+\\)" 3) |
108381 | 672 ("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
|
673 ("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
|
674 ("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
|
675 "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
|
676 |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
677 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
|
678 entered. Subsequent changes to `sql-imenu-generic-expression' will |
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
679 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
|
680 a local variable.") |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
681 |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
682 ;; history file |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
683 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
684 (defcustom sql-input-ring-file-name nil |
108381 | 685 "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
|
686 |
24861
0d593aa15c0f
(sql-input-ring-file-name): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24591
diff
changeset
|
687 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
|
688 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
|
689 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
|
690 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
|
691 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
|
692 |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
693 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
|
694 |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
695 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
|
696 `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
|
697 :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
|
698 (file)) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
699 :group 'SQL) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
700 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
701 (defcustom sql-input-ring-separator "\n--\n" |
108381 | 702 "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
|
703 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
704 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
|
705 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
|
706 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
|
707 |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
708 This variable used to initialize `comint-input-ring-separator'. |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
709 `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
|
710 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
|
711 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
|
712 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
|
713 `sql-input-ring-separator' to \"\\n\"." |
24050 | 714 :type 'string |
715 :group 'SQL) | |
716 | |
717 ;; The usual hooks | |
718 | |
719 (defcustom sql-interactive-mode-hook '() | |
108381 | 720 "Hook for customizing `sql-interactive-mode'." |
24050 | 721 :type 'hook |
722 :group 'SQL) | |
723 | |
724 (defcustom sql-mode-hook '() | |
108381 | 725 "Hook for customizing `sql-mode'." |
24050 | 726 :type 'hook |
727 :group 'SQL) | |
728 | |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
729 (defcustom sql-set-sqli-hook '() |
108381 | 730 "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
|
731 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
732 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
|
733 is changed." |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
734 :type 'hook |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
735 :group 'SQL) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
736 |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
737 ;; Customization for Oracle |
24050 | 738 |
739 (defcustom sql-oracle-program "sqlplus" | |
108381 | 740 "Command to start sqlplus by Oracle. |
24050 | 741 |
742 Starts `sql-interactive-mode' after doing some setup. | |
743 | |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
744 On Windows, \"sqlplus\" usually starts the sqlplus \"GUI\". In order |
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
745 to start the sqlplus console, use \"plus33\" or something similar. |
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
746 You will find the file in your Orant\\bin directory." |
24050 | 747 :type 'file |
748 :group 'SQL) | |
749 | |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
750 (defcustom sql-oracle-options nil |
108381 | 751 "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
|
752 :type '(repeat string) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
753 :version "20.8" |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
754 :group 'SQL) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
755 |
108381 | 756 (defcustom sql-oracle-login-params '(user password database) |
757 "List of login parameters needed to connect to Oracle." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
758 :type 'sql-login-params |
108381 | 759 :version "24.1" |
760 :group 'SQL) | |
761 | |
762 (defcustom sql-oracle-scan-on t | |
763 "Non-nil if placeholders should be replaced in Oracle SQLi. | |
764 | |
765 When non-nil, Emacs will scan text sent to sqlplus and prompt | |
766 for replacement text for & placeholders as sqlplus does. This | |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
767 is needed on Windows where sqlplus output is buffered and the |
108381 | 768 prompts are not shown until after the text is entered. |
769 | |
770 You will probably want to issue the following command in sqlplus | |
771 to be safe: | |
772 | |
773 SET SCAN OFF" | |
774 :type 'boolean | |
775 :group 'SQL) | |
776 | |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
777 ;; Customization for SQLite |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
778 |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
779 (defcustom sql-sqlite-program "sqlite3" |
108381 | 780 "Command to start SQLite. |
781 | |
782 Starts `sql-interactive-mode' after doing some setup." | |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
783 :type 'file |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
784 :group 'SQL) |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
785 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
786 (defcustom sql-sqlite-options nil |
108381 | 787 "List of additional options for `sql-sqlite-program'." |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
788 :type '(repeat string) |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
789 :version "20.8" |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
790 :group 'SQL) |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
791 |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
792 (defcustom sql-sqlite-login-params '((database :file ".*\\.db")) |
108381 | 793 "List of login parameters needed to connect to SQLite." |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
794 :type 'sql-login-params |
108381 | 795 :version "24.1" |
796 :group 'SQL) | |
797 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
798 ;; Customization for MySql |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
799 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
800 (defcustom sql-mysql-program "mysql" |
108381 | 801 "Command to start mysql by TcX. |
802 | |
803 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
|
804 :type 'file |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
805 :group 'SQL) |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
806 |
32169
5aa8b2b669b7
(sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31392
diff
changeset
|
807 (defcustom sql-mysql-options nil |
108381 | 808 "List of additional options for `sql-mysql-program'. |
34704
7cb3b80e66b8
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32621
diff
changeset
|
809 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
|
810 on Windows: \"-C\" \"-t\" \"-f\" \"-n\"." |
32169
5aa8b2b669b7
(sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31392
diff
changeset
|
811 :type '(repeat string) |
5aa8b2b669b7
(sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31392
diff
changeset
|
812 :version "20.8" |
5aa8b2b669b7
(sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31392
diff
changeset
|
813 :group 'SQL) |
5aa8b2b669b7
(sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31392
diff
changeset
|
814 |
108381 | 815 (defcustom sql-mysql-login-params '(user password database server) |
816 "List of login parameters needed to connect to MySql." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
817 :type 'sql-login-params |
108381 | 818 :version "24.1" |
819 :group 'SQL) | |
820 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
821 ;; Customization for Solid |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
822 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
823 (defcustom sql-solid-program "solsql" |
108381 | 824 "Command to start SOLID SQL Editor. |
825 | |
826 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
|
827 :type 'file |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
828 :group 'SQL) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
829 |
108381 | 830 (defcustom sql-solid-login-params '(user password server) |
831 "List of login parameters needed to connect to Solid." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
832 :type 'sql-login-params |
108381 | 833 :version "24.1" |
834 :group 'SQL) | |
835 | |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
836 ;; Customization for Sybase |
24050 | 837 |
838 (defcustom sql-sybase-program "isql" | |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
839 "Command to start isql by Sybase. |
108381 | 840 |
841 Starts `sql-interactive-mode' after doing some setup." | |
24050 | 842 :type 'file |
843 :group 'SQL) | |
844 | |
32621
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
845 (defcustom sql-sybase-options nil |
108381 | 846 "List of additional options for `sql-sybase-program'. |
32621
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
847 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
|
848 :type '(repeat string) |
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
849 :version "20.8" |
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
850 :group 'SQL) |
50c28d51e0f2
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32169
diff
changeset
|
851 |
108381 | 852 (defcustom sql-sybase-login-params '(server user password database) |
853 "List of login parameters needed to connect to Sybase." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
854 :type 'sql-login-params |
108381 | 855 :version "24.1" |
856 :group 'SQL) | |
857 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
858 ;; Customization for Informix |
24050 | 859 |
860 (defcustom sql-informix-program "dbaccess" | |
108381 | 861 "Command to start dbaccess by Informix. |
862 | |
863 Starts `sql-interactive-mode' after doing some setup." | |
24050 | 864 :type 'file |
865 :group 'SQL) | |
866 | |
108381 | 867 (defcustom sql-informix-login-params '(database) |
868 "List of login parameters needed to connect to Informix." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
869 :type 'sql-login-params |
108381 | 870 :version "24.1" |
871 :group 'SQL) | |
872 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
873 ;; Customization for Ingres |
24050 | 874 |
875 (defcustom sql-ingres-program "sql" | |
108381 | 876 "Command to start sql by Ingres. |
877 | |
878 Starts `sql-interactive-mode' after doing some setup." | |
24050 | 879 :type 'file |
880 :group 'SQL) | |
881 | |
108381 | 882 (defcustom sql-ingres-login-params '(database) |
883 "List of login parameters needed to connect to Ingres." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
884 :type 'sql-login-params |
108381 | 885 :version "24.1" |
886 :group 'SQL) | |
887 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
888 ;; Customization for Microsoft |
24050 | 889 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
890 (defcustom sql-ms-program "osql" |
108381 | 891 "Command to start osql by Microsoft. |
892 | |
893 Starts `sql-interactive-mode' after doing some setup." | |
24050 | 894 :type 'file |
895 :group 'SQL) | |
896 | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
897 (defcustom sql-ms-options '("-w" "300" "-n") |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
898 ;; -w is the linesize |
108381 | 899 "List of additional options for `sql-ms-program'." |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
900 :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
|
901 :version "22.1" |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
902 :group 'SQL) |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
903 |
108381 | 904 (defcustom sql-ms-login-params '(user password server database) |
905 "List of login parameters needed to connect to Microsoft." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
906 :type 'sql-login-params |
108381 | 907 :version "24.1" |
908 :group 'SQL) | |
909 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
910 ;; Customization for Postgres |
24050 | 911 |
912 (defcustom sql-postgres-program "psql" | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
913 "Command to start psql by Postgres. |
24050 | 914 |
108381 | 915 Starts `sql-interactive-mode' after doing some setup." |
24050 | 916 :type 'file |
917 :group 'SQL) | |
918 | |
34704
7cb3b80e66b8
(sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
32621
diff
changeset
|
919 (defcustom sql-postgres-options '("-P" "pager=off") |
108381 | 920 "List of additional options for `sql-postgres-program'. |
38872 | 921 The default setting includes the -P option which breaks older versions |
922 of the psql client (such as version 6.5.3). The -P option is equivalent | |
923 to the --pset option. If you want the psql to prompt you for a user | |
924 name, add the string \"-u\" to the list of options. If you want to | |
925 provide a user name on the command line (newer versions such as 7.1), | |
926 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
|
927 :type '(repeat string) |
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
928 :version "20.8" |
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
929 :group 'SQL) |
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
930 |
108381 | 931 (defcustom sql-postgres-login-params '(user database server) |
932 "List of login parameters needed to connect to Postgres." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
933 :type 'sql-login-params |
108381 | 934 :version "24.1" |
935 :group 'SQL) | |
936 | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
937 ;; Customization for Interbase |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
938 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
939 (defcustom sql-interbase-program "isql" |
108381 | 940 "Command to start isql by Interbase. |
941 | |
942 Starts `sql-interactive-mode' after doing some setup." | |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
943 :type 'file |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
944 :group 'SQL) |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
945 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
946 (defcustom sql-interbase-options nil |
108381 | 947 "List of additional options for `sql-interbase-program'." |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
948 :type '(repeat string) |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
949 :version "20.8" |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
950 :group 'SQL) |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
951 |
108381 | 952 (defcustom sql-interbase-login-params '(user password database) |
953 "List of login parameters needed to connect to Interbase." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
954 :type 'sql-login-params |
108381 | 955 :version "24.1" |
956 :group 'SQL) | |
957 | |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
958 ;; Customization for DB2 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
959 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
960 (defcustom sql-db2-program "db2" |
108381 | 961 "Command to start db2 by IBM. |
962 | |
963 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
|
964 :type 'file |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
965 :group 'SQL) |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
966 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
967 (defcustom sql-db2-options nil |
108381 | 968 "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
|
969 :type '(repeat string) |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
970 :version "20.8" |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
971 :group 'SQL) |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
972 |
108381 | 973 (defcustom sql-db2-login-params nil |
974 "List of login parameters needed to connect to DB2." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
975 :type 'sql-login-params |
108381 | 976 :version "24.1" |
977 :group 'SQL) | |
978 | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
979 ;; Customization for Linter |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
980 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
981 (defcustom sql-linter-program "inl" |
108381 | 982 "Command to start inl by RELEX. |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
983 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
984 Starts `sql-interactive-mode' after doing some setup." |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
985 :type 'file |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
986 :group 'SQL) |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
987 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
988 (defcustom sql-linter-options nil |
108381 | 989 "List of additional options for `sql-linter-program'." |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
990 :type '(repeat string) |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
991 :version "21.3" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
992 :group 'SQL) |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
993 |
108381 | 994 (defcustom sql-linter-login-params '(user password database server) |
995 "Login parameters to needed to connect to Linter." | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
996 :type 'sql-login-params |
108381 | 997 :version "24.1" |
998 :group 'SQL) | |
999 | |
24050 | 1000 |
1001 | |
1002 ;;; Variables which do not need customization | |
1003 | |
1004 (defvar sql-user-history nil | |
1005 "History of usernames used.") | |
1006 | |
1007 (defvar sql-database-history nil | |
1008 "History of databases used.") | |
1009 | |
1010 (defvar sql-server-history nil | |
1011 "History of servers used.") | |
1012 | |
108381 | 1013 (defvar sql-port-history nil |
1014 "History of ports used.") | |
1015 | |
24050 | 1016 ;; Passwords are not kept in a history. |
1017 | |
1018 (defvar sql-buffer nil | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1019 "Current SQLi buffer. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1020 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1021 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
|
1022 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
|
1023 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
|
1024 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
|
1025 the local value of `sql-buffer' using \\[sql-set-sqli-buffer].") |
24050 | 1026 |
1027 (defvar sql-prompt-regexp nil | |
1028 "Prompt used to initialize `comint-prompt-regexp'. | |
1029 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1030 You can change `sql-prompt-regexp' on `sql-interactive-mode-hook'.") |
24050 | 1031 |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
1032 (defvar sql-prompt-length 0 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
1033 "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
|
1034 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1035 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
|
1036 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1037 (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
|
1038 "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
|
1039 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1040 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
|
1041 |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1042 ;; Keymap for sql-interactive-mode. |
24050 | 1043 |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1044 (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
|
1045 (let ((map (make-sparse-keymap))) |
64837
f80fef683ab5
(sql-interactive-mode-map): Use fboundp.
Richard M. Stallman <rms@gnu.org>
parents:
64699
diff
changeset
|
1046 (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
|
1047 (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
|
1048 (if (fboundp 'set-keymap-parents) |
f80fef683ab5
(sql-interactive-mode-map): Use fboundp.
Richard M. Stallman <rms@gnu.org>
parents:
64699
diff
changeset
|
1049 (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
|
1050 (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
|
1051 (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
|
1052 (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
|
1053 (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
|
1054 (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
|
1055 (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
|
1056 (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
|
1057 map) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
1058 "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
|
1059 Based on `comint-mode-map'.") |
24050 | 1060 |
1061 ;; Keymap for sql-mode. | |
1062 | |
1063 (defvar sql-mode-map | |
1064 (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
|
1065 (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
|
1066 (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
|
1067 (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
|
1068 (define-key map (kbd "C-c C-b") 'sql-send-buffer) |
108381 | 1069 (define-key map (kbd "C-c C-i") 'sql-product-interactive) |
24050 | 1070 map) |
1071 "Mode map used for `sql-mode'.") | |
1072 | |
1073 ;; easy menu for sql-mode. | |
1074 | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
1075 (easy-menu-define |
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
1076 sql-mode-menu sql-mode-map |
24050 | 1077 "Menu for `sql-mode'." |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1078 `("SQL" |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1079 ["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
|
1080 (get-buffer-process sql-buffer))] |
108381 | 1081 ["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
|
1082 (buffer-live-p sql-buffer) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1083 (get-buffer-process sql-buffer))] |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1084 ["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
|
1085 (get-buffer-process sql-buffer))] |
108381 | 1086 ["Send String" sql-send-string (and (buffer-live-p sql-buffer) |
1087 (get-buffer-process sql-buffer))] | |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1088 "--" |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1089 ["Start SQLi session" sql-product-interactive |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1090 :visible (not sql-connection-alist) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1091 :enable (sql-get-product-feature sql-product :sqli-comint-func)] |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1092 ("Start..." |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1093 :visible sql-connection-alist |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1094 :filter sql-connection-menu-filter |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1095 "--" |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1096 ["New SQLi Session" sql-product-interactive (sql-get-product-feature sql-product :sqli-comint-func)]) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1097 ["--" |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1098 :visible sql-connection-alist] |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
1099 ["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
|
1100 ["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
|
1101 ["Pop to SQLi buffer after send" |
24050 | 1102 sql-toggle-pop-to-buffer-after-send-region |
1103 :style toggle | |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
1104 :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
|
1105 ["--" nil nil] |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1106 ("Product" |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1107 ,@(mapcar (lambda (prod-info) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1108 (let* ((prod (pop prod-info)) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1109 (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
|
1110 (capitalize (symbol-name prod)))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1111 (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
|
1112 (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
|
1113 (interactive) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1114 (sql-set-product ',prod))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1115 (vector name cmd |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1116 :style 'radio |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1117 :selected `(eq sql-product ',prod)))) |
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
1118 sql-product-alist)))) |
24050 | 1119 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1120 ;; 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
|
1121 |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
1122 (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
|
1123 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
|
1124 "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
|
1125 '("SQL" |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1126 ["Rename Buffer" sql-rename-buffer t] |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
1127 ["Save Connection" sql-save-connection (not sql-connection)])) |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
1128 |
24050 | 1129 ;; Abbreviations -- if you want more of them, define them in your |
1130 ;; ~/.emacs file. Abbrevs have to be enabled in your ~/.emacs, too. | |
1131 | |
1132 (defvar sql-mode-abbrev-table nil | |
1133 "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
|
1134 (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
|
1135 (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
|
1136 |
84922
1b6b77d0f75a
(top): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
1137 (mapc |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1138 ;; 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
|
1139 '(lambda (abbrev) |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1140 (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
|
1141 (expansion (cdr abbrev))) |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1142 (condition-case nil |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1143 (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
|
1144 (error |
89cf360cc26e
(sql-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
68773
diff
changeset
|
1145 (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
|
1146 '(("ins" . "insert") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1147 ("upd" . "update") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1148 ("del" . "delete") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1149 ("sel" . "select") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1150 ("proc" . "procedure") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1151 ("func" . "function") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1152 ("cr" . "create"))) |
24050 | 1153 |
1154 ;; Syntax Table | |
1155 | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
1156 (defvar sql-mode-syntax-table |
24050 | 1157 (let ((table (make-syntax-table))) |
1158 ;; C-style comments /**/ (see elisp manual "Syntax Flags")) | |
1159 (modify-syntax-entry ?/ ". 14" table) | |
1160 (modify-syntax-entry ?* ". 23" table) | |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1161 ;; 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
|
1162 (modify-syntax-entry ?- ". 12b" table) |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1163 ;; newline and formfeed end comments |
24050 | 1164 (modify-syntax-entry ?\n "> b" table) |
1165 (modify-syntax-entry ?\f "> b" table) | |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1166 ;; single quotes (') delimit strings |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
1167 (modify-syntax-entry ?' "\"" table) |
74898
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1168 ;; double quotes (") don't delimit strings |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1169 (modify-syntax-entry ?\" "." table) |
40971
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
1170 ;; backslash is no escape character |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
1171 (modify-syntax-entry ?\\ "." table) |
24050 | 1172 table) |
1173 "Syntax table used in `sql-mode' and `sql-interactive-mode'.") | |
1174 | |
1175 ;; Font lock support | |
1176 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1177 (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
|
1178 (eval-when-compile |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1179 (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
|
1180 "\\(?:\\w+\\s-+\\)*" ;; optional intervening keywords |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1181 "\\(?: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
|
1182 "\\|function\\|trigger\\|sequence\\|rule\\|default\\)\\s-+" |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1183 "\\(\\w+\\)") |
60595cfe604f
(sql-mode-abbrev-table): Corrected initialization.
Richard M. Stallman <rms@gnu.org>
parents:
74433
diff
changeset
|
1184 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
|
1185 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1186 "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
|
1187 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1188 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
|
1189 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
|
1190 `font-lock-keywords' entry.") |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1191 |
108381 | 1192 ;; While there are international and American standards for SQL, they |
1193 ;; are not followed closely, and most vendors offer significant | |
1194 ;; capabilities beyond those defined in the standard specifications. | |
1195 | |
1196 ;; SQL mode provides support for hilighting based on the product. In | |
1197 ;; addition to hilighting the product keywords, any ANSI keywords not | |
1198 ;; used by the product are also hilighted. This will help identify | |
1199 ;; keywords that could be restricted in future versions of the product | |
1200 ;; or might be a problem if ported to another product. | |
1201 | |
1202 ;; To reduce the complexity and size of the regular expressions | |
1203 ;; generated to match keywords, ANSI keywords are filtered out of | |
1204 ;; product keywords if they are equivalent. To do this, we define a | |
1205 ;; function `sql-font-lock-keywords-builder' that removes any keywords | |
1206 ;; that are matched by the ANSI patterns and results in the same face | |
1207 ;; being applied. For this to work properly, we must play some games | |
1208 ;; with the execution and compile time behavior. This code is a | |
1209 ;; little tricky but works properly. | |
1210 | |
1211 ;; When defining the keywords for individual products you should | |
1212 ;; include all of the keywords that you want matched. The filtering | |
1213 ;; against the ANSI keywords will be automatic if you use the | |
1214 ;; `sql-font-lock-keywords-builder' function and follow the | |
1215 ;; implementation pattern used for the other products in this file. | |
1216 | |
1217 (eval-when-compile | |
1218 (defvar sql-mode-ansi-font-lock-keywords) | |
1219 (setq sql-mode-ansi-font-lock-keywords nil)) | |
1220 | |
1221 (eval-and-compile | |
1222 (defun sql-font-lock-keywords-builder (face boundaries &rest keywords) | |
1223 "Generation of regexp matching any one of KEYWORDS." | |
1224 | |
1225 (let ((bdy (or boundaries '("\\b" . "\\b"))) | |
1226 kwd) | |
1227 | |
1228 ;; Remove keywords that are defined in ANSI | |
1229 (setq kwd keywords) | |
1230 (dolist (k keywords) | |
1231 (catch 'next | |
1232 (dolist (a sql-mode-ansi-font-lock-keywords) | |
1233 (when (and (eq face (cdr a)) | |
1234 (eq (string-match (car a) k 0) 0) | |
1235 (eq (match-end 0) (length k))) | |
1236 (setq kwd (delq k kwd)) | |
1237 (throw 'next nil))))) | |
1238 | |
1239 ;; Create a properly formed font-lock-keywords item | |
1240 (cons (concat (car bdy) | |
1241 (regexp-opt kwd t) | |
1242 (cdr bdy)) | |
1243 face)))) | |
1244 | |
1245 (eval-when-compile | |
1246 (setq sql-mode-ansi-font-lock-keywords | |
1247 (list | |
1248 ;; ANSI Non Reserved keywords | |
1249 (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
|
1250 "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
|
1251 "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
|
1252 "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
|
1253 "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
|
1254 "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
|
1255 "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
|
1256 "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
|
1257 "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
|
1258 "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
|
1259 "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
|
1260 "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
|
1261 "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
|
1262 "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
|
1263 "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
|
1264 "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
|
1265 "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
|
1266 "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
|
1267 "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
|
1268 "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
|
1269 "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
|
1270 "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
|
1271 "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
|
1272 "transaction_active" "transactions_committed" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1273 "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
|
1274 "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
|
1275 "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
|
1276 "user_defined_type_schema" |
108381 | 1277 ) |
1278 ;; ANSI Reserved keywords | |
1279 (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
|
1280 "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
|
1281 "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
|
1282 "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
|
1283 "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
|
1284 "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
|
1285 "connection" "constraint" "constraints" "constructor" "continue" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1286 "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
|
1287 "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
|
1288 "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
|
1289 "destructor" "deterministic" "diagnostics" "dictionary" "disconnect" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1290 "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
|
1291 "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
|
1292 "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
|
1293 "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
|
1294 "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
|
1295 "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
|
1296 "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
|
1297 "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
|
1298 "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
|
1299 "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
|
1300 "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
|
1301 "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
|
1302 "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
|
1303 "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
|
1304 "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
|
1305 "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
|
1306 "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
|
1307 "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
|
1308 "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
|
1309 "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
|
1310 "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
|
1311 "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
|
1312 "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
|
1313 "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
|
1314 "where" "with" "without" "work" "write" "year" |
108381 | 1315 ) |
1316 | |
1317 ;; ANSI Functions | |
1318 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | |
1319 "abs" "avg" "bit_length" "cardinality" "cast" "char_length" | |
1320 "character_length" "coalesce" "convert" "count" "current_date" | |
1321 "current_path" "current_role" "current_time" "current_timestamp" | |
1322 "current_user" "extract" "localtime" "localtimestamp" "lower" "max" | |
1323 "min" "mod" "nullif" "octet_length" "overlay" "placing" "session_user" | |
1324 "substring" "sum" "system_user" "translate" "treat" "trim" "upper" | |
1325 "user" | |
1326 ) | |
1327 ;; ANSI Data Types | |
1328 (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
|
1329 "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
|
1330 "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
|
1331 "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
|
1332 "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
|
1333 "varying" "zone" |
108381 | 1334 )))) |
1335 | |
1336 (defvar sql-mode-ansi-font-lock-keywords | |
1337 (eval-when-compile sql-mode-ansi-font-lock-keywords) | |
24050 | 1338 "ANSI SQL keywords used by font-lock. |
1339 | |
1340 This variable is used by `sql-mode' and `sql-interactive-mode'. The | |
1341 regular expressions are created during compilation by calling the | |
1342 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
|
1343 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
|
1344 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
|
1345 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1346 (defvar sql-mode-oracle-font-lock-keywords |
108381 | 1347 (eval-when-compile |
1348 (list | |
1349 ;; Oracle SQL*Plus Commands | |
1350 (cons | |
1351 (concat | |
1352 "^\\(?:\\(?:" (regexp-opt '( | |
1353 "@" "@@" "accept" "append" "archive" "attribute" "break" | |
1354 "btitle" "change" "clear" "column" "connect" "copy" "define" | |
1355 "del" "describe" "disconnect" "edit" "execute" "exit" "get" "help" | |
1356 "host" "input" "list" "password" "pause" "print" "prompt" "recover" | |
1357 "remark" "repfooter" "repheader" "run" "save" "show" "shutdown" | |
1358 "spool" "start" "startup" "store" "timing" "ttitle" "undefine" | |
1359 "variable" "whenever" | |
1360 ) t) | |
1361 | |
1362 "\\)\\|" | |
1363 "\\(?:compute\\s-+\\(?:avg\\|cou\\|min\\|max\\|num\\|sum\\|std\\|var\\)\\)\\|" | |
1364 "\\(?:set\\s-+\\(" | |
1365 | |
1366 (regexp-opt | |
1367 '("appi" "appinfo" "array" "arraysize" "auto" "autocommit" | |
1368 "autop" "autoprint" "autorecovery" "autot" "autotrace" "blo" | |
1369 "blockterminator" "buffer" "closecursor" "cmds" "cmdsep" | |
1370 "colsep" "com" "compatibility" "con" "concat" "constraint" | |
1371 "constraints" "copyc" "copycommit" "copytypecheck" "database" | |
1372 "def" "define" "document" "echo" "editf" "editfile" "emb" | |
1373 "embedded" "esc" "escape" "feed" "feedback" "flagger" "flu" | |
1374 "flush" "hea" "heading" "heads" "headsep" "instance" "lin" | |
1375 "linesize" "lobof" "loboffset" "logsource" "long" "longc" | |
1376 "longchunksize" "maxdata" "newp" "newpage" "null" "num" | |
1377 "numf" "numformat" "numwidth" "pages" "pagesize" "pau" | |
1378 "pause" "recsep" "recsepchar" "role" "scan" "serveroutput" | |
1379 "shift" "shiftinout" "show" "showmode" "space" "sqlbl" | |
1380 "sqlblanklines" "sqlc" "sqlcase" "sqlco" "sqlcontinue" "sqln" | |
1381 "sqlnumber" "sqlp" "sqlpluscompat" "sqlpluscompatibility" | |
1382 "sqlpre" "sqlprefix" "sqlprompt" "sqlt" "sqlterminator" | |
1383 "statement_id" "suf" "suffix" "tab" "term" "termout" "ti" | |
1384 "time" "timi" "timing" "transaction" "trim" "trimout" "trims" | |
1385 "trimspool" "truncate" "und" "underline" "ver" "verify" "wra" | |
1386 "wrap")) "\\)\\)" | |
1387 | |
1388 "\\)\\b.*" | |
1389 ) | |
1390 'font-lock-doc-face) | |
1391 '("^[ \t]*rem\\(?:ark\\)?.*" . font-lock-comment-face) | |
1392 | |
1393 ;; Oracle Functions | |
1394 (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
|
1395 "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
|
1396 "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
|
1397 "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
|
1398 "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
|
1399 "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
|
1400 "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
|
1401 "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
|
1402 "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
|
1403 "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
|
1404 "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
|
1405 "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
|
1406 "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
|
1407 "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
|
1408 "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
|
1409 "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
|
1410 "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
|
1411 "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
|
1412 "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
|
1413 "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
|
1414 "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
|
1415 "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
|
1416 "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
|
1417 "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
|
1418 "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
|
1419 "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
|
1420 "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
|
1421 "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
|
1422 "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
|
1423 "xmlagg" "xmlattribute" "xmlcolattval" "xmlconcat" "xmlelement" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1424 "xmlforest" "xmlsequence" "xmltransform" |
108381 | 1425 ) |
1426 ;; Oracle Keywords | |
1427 (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
|
1428 "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
|
1429 "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
|
1430 "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
|
1431 "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
|
1432 "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
|
1433 "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
|
1434 "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
|
1435 "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
|
1436 "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
|
1437 "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
|
1438 "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
|
1439 "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
|
1440 "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
|
1441 "constraint" "constraints" "constructor" "contents" "context" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1442 "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
|
1443 "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
|
1444 "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
|
1445 "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
|
1446 "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
|
1447 "dictionary" "dimension" "directory" "disable" "disassociate" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1448 "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
|
1449 "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
|
1450 "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
|
1451 "expire" "explain" "extent" "external" "externally" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1452 "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
|
1453 "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
|
1454 "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
|
1455 "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
|
1456 "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
|
1457 "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
|
1458 "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
|
1459 "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
|
1460 "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
|
1461 "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
|
1462 "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
|
1463 "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
|
1464 "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
|
1465 "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
|
1466 "mapping" "master" "matched" "materialized" "maxdatafiles" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1467 "maxextents" "maximize" "maxinstances" "maxlogfiles" "maxloghistory" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1468 "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
|
1469 "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
|
1470 "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
|
1471 "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
|
1472 "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
|
1473 "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
|
1474 "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
|
1475 "noresetlogs" "noreverse" "normal" "norowdependencies" "nosort" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1476 "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
|
1477 "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
|
1478 "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
|
1479 "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
|
1480 "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
|
1481 "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
|
1482 "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
|
1483 "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
|
1484 "pctincrease" "pctthreshold" "pctused" "pctversion" "percent" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1485 "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
|
1486 "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
|
1487 "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
|
1488 "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
|
1489 "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
|
1490 "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
|
1491 "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
|
1492 "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
|
1493 "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
|
1494 "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
|
1495 "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
|
1496 "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
|
1497 "selectivity" "self" "sequence" "serializable" "session" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1498 "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
|
1499 "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
|
1500 "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
|
1501 "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
|
1502 "structure" "subpartition" "subpartitions" "substitutable" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1503 "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
|
1504 "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
|
1505 "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
|
1506 "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
|
1507 "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
|
1508 "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
|
1509 "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
|
1510 "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
|
1511 "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
|
1512 "without" "wnds" "wnps" "work" "write" "xmldata" "xmlschema" "xmltype" |
108381 | 1513 ) |
1514 ;; Oracle Data Types | |
1515 (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
|
1516 "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
|
1517 "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
|
1518 "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
|
1519 "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
|
1520 "varchar2" "varying" "year" "zone" |
108381 | 1521 ) |
1522 | |
1523 ;; Oracle PL/SQL Attributes | |
1524 (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
|
1525 "%bulk_rowcount" "%found" "%isopen" "%notfound" "%rowcount" "%rowtype" |
108381 | 1526 "%type" |
1527 ) | |
1528 | |
1529 ;; Oracle PL/SQL Functions | |
1530 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | |
1531 "extend" "prior" | |
1532 ) | |
1533 | |
1534 ;; Oracle PL/SQL Keywords | |
1535 (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
|
1536 "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
|
1537 "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
|
1538 "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
|
1539 "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
|
1540 "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
|
1541 "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
|
1542 "timezone_region" "true" "varrying" "while" |
108381 | 1543 ) |
1544 | |
1545 ;; Oracle PL/SQL Data Types | |
1546 (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
|
1547 "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
|
1548 "positiven" "record" "signtype" "string" |
108381 | 1549 ) |
1550 | |
1551 ;; Oracle PL/SQL Exceptions | |
1552 (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
|
1553 "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
|
1554 "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
|
1555 "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
|
1556 "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
|
1557 "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
|
1558 "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
|
1559 "exception" "notfound" |
108381 | 1560 ))) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1561 |
24050 | 1562 "Oracle SQL keywords used by font-lock. |
1563 | |
1564 This variable is used by `sql-mode' and `sql-interactive-mode'. The | |
1565 regular expressions are created during compilation by calling the | |
1566 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
|
1567 you define your own `sql-mode-oracle-font-lock-keywords'. You may want |
24050 | 1568 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
|
1569 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1570 (defvar sql-mode-postgres-font-lock-keywords |
108381 | 1571 (eval-when-compile |
1572 (list | |
1573 ;; Postgres Functions | |
1574 (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
|
1575 "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
|
1576 "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
|
1577 "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
|
1578 "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
|
1579 "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
|
1580 "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
|
1581 "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
|
1582 "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
|
1583 "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
|
1584 "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
|
1585 "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
|
1586 "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
|
1587 "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
|
1588 "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
|
1589 "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
|
1590 "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
|
1591 "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
|
1592 "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
|
1593 "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
|
1594 "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
|
1595 "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
|
1596 "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
|
1597 "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
|
1598 "trunc" "upper" "variance" "version" "width" |
108381 | 1599 ) |
1600 ;; Postgres Reserved | |
1601 (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
|
1602 "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
|
1603 "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
|
1604 "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
|
1605 "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
|
1606 "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
|
1607 "committed" "commutator" "constraint" "constraints" "conversion" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1608 "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
|
1609 "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
|
1610 "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
|
1611 "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
|
1612 "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
|
1613 "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
|
1614 "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
|
1615 "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
|
1616 "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
|
1617 "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
|
1618 "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
|
1619 "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
|
1620 "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
|
1621 "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
|
1622 "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
|
1623 "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
|
1624 "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
|
1625 "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
|
1626 "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
|
1627 "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
|
1628 "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
|
1629 "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
|
1630 "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
|
1631 "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
|
1632 "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
|
1633 "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
|
1634 "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
|
1635 "work" |
108381 | 1636 ) |
1637 | |
1638 ;; Postgres Data Types | |
1639 (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
|
1640 "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
|
1641 "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
|
1642 "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
|
1643 "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
|
1644 "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
|
1645 "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
|
1646 "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
|
1647 "timestamp" "varchar" "varying" "void" "zone" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1648 ))) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1649 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1650 "Postgres SQL keywords used by font-lock. |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1651 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1652 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
|
1653 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
|
1654 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
|
1655 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
|
1656 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1657 (defvar sql-mode-linter-font-lock-keywords |
108381 | 1658 (eval-when-compile |
1659 (list | |
1660 ;; Linter Keywords | |
1661 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1662 "autocommit" "autoinc" "autorowid" "cancel" "cascade" "channel" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1663 "committed" "count" "countblob" "cross" "current" "data" "database" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1664 "datafile" "datafiles" "datesplit" "dba" "dbname" "default" "deferred" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1665 "denied" "description" "device" "difference" "directory" "error" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1666 "escape" "euc" "exclusive" "external" "extfile" "false" "file" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1667 "filename" "filesize" "filetime" "filter" "findblob" "first" "foreign" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1668 "full" "fuzzy" "global" "granted" "ignore" "immediate" "increment" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1669 "indexes" "indexfile" "indexfiles" "indextime" "initial" "integrity" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1670 "internal" "key" "last_autoinc" "last_rowid" "limit" "linter" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1671 "linter_file_device" "linter_file_size" "linter_name_length" "ln" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1672 "local" "login" "maxisn" "maxrow" "maxrowid" "maxvalue" "message" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1673 "minvalue" "module" "names" "national" "natural" "new" "new_table" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1674 "no" "node" "noneuc" "nulliferror" "numbers" "off" "old" "old_table" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1675 "only" "operation" "optimistic" "option" "page" "partially" "password" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1676 "phrase" "plan" "precision" "primary" "priority" "privileges" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1677 "proc_info_size" "proc_par_name_len" "protocol" "quant" "range" "raw" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1678 "read" "record" "records" "references" "remote" "rename" "replication" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1679 "restart" "rewrite" "root" "row" "rule" "savepoint" "security" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1680 "sensitive" "sequence" "serializable" "server" "since" "size" "some" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1681 "startup" "statement" "station" "success" "sys_guid" "tables" "test" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1682 "timeout" "trace" "transaction" "translation" "trigger" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1683 "trigger_info_size" "true" "trunc" "uncommitted" "unicode" "unknown" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1684 "unlimited" "unlisted" "user" "utf8" "value" "varying" "volumes" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1685 "wait" "windows_code" "workspace" "write" "xml" |
108381 | 1686 ) |
1687 | |
1688 ;; Linter Reserved | |
1689 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1690 "access" "action" "add" "address" "after" "all" "alter" "always" "and" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1691 "any" "append" "as" "asc" "ascic" "async" "at_begin" "at_end" "audit" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1692 "aud_obj_name_len" "backup" "base" "before" "between" "blobfile" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1693 "blobfiles" "blobpct" "brief" "browse" "by" "case" "cast" "check" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1694 "clear" "close" "column" "comment" "commit" "connect" "contains" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1695 "correct" "create" "delete" "desc" "disable" "disconnect" "distinct" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1696 "drop" "each" "ef" "else" "enable" "end" "event" "except" "exclude" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1697 "execute" "exists" "extract" "fetch" "finish" "for" "from" "get" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1698 "grant" "group" "having" "identified" "in" "index" "inner" "insert" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1699 "instead" "intersect" "into" "is" "isolation" "join" "left" "level" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1700 "like" "lock" "mode" "modify" "not" "nowait" "null" "of" "on" "open" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1701 "or" "order" "outer" "owner" "press" "prior" "procedure" "public" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1702 "purge" "rebuild" "resource" "restrict" "revoke" "right" "role" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1703 "rollback" "rownum" "select" "session" "set" "share" "shutdown" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1704 "start" "stop" "sync" "synchronize" "synonym" "sysdate" "table" "then" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1705 "to" "union" "unique" "unlock" "until" "update" "using" "values" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1706 "view" "when" "where" "with" "without" |
108381 | 1707 ) |
1708 | |
1709 ;; Linter Functions | |
1710 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1711 "abs" "acos" "asin" "atan" "atan2" "avg" "ceil" "cos" "cosh" "divtime" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1712 "exp" "floor" "getbits" "getblob" "getbyte" "getlong" "getraw" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1713 "getstr" "gettext" "getword" "hextoraw" "lenblob" "length" "log" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1714 "lower" "lpad" "ltrim" "max" "min" "mod" "monthname" "nvl" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1715 "octet_length" "power" "rand" "rawtohex" "repeat_string" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1716 "right_substr" "round" "rpad" "rtrim" "sign" "sin" "sinh" "soundex" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1717 "sqrt" "sum" "tan" "tanh" "timeint_to_days" "to_char" "to_date" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1718 "to_gmtime" "to_localtime" "to_number" "trim" "upper" "decode" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1719 "substr" "substring" "chr" "dayname" "days" "greatest" "hex" "initcap" |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
1720 "instr" "least" "multime" "replace" "width" |
108381 | 1721 ) |
1722 | |
1723 ;; Linter Data Types | |
1724 (sql-font-lock-keywords-builder 'font-lock-type-face nil | |
1725 "bigint" "bitmap" "blob" "boolean" "char" "character" "date" | |
1726 "datetime" "dec" "decimal" "double" "float" "int" "integer" "nchar" | |
1727 "number" "numeric" "real" "smallint" "varbyte" "varchar" "byte" | |
1728 "cursor" "long" | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1729 ))) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1730 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1731 "Linter SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1732 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1733 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
|
1734 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
|
1735 function `regexp-opt'.") |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1736 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1737 (defvar sql-mode-ms-font-lock-keywords |
108381 | 1738 (eval-when-compile |
1739 (list | |
1740 ;; MS isql/osql Commands | |
1741 (cons | |
1742 (concat | |
1743 "^\\(?:\\(?:set\\s-+\\(?:" | |
1744 (regexp-opt '( | |
1745 "datefirst" "dateformat" "deadlock_priority" "lock_timeout" | |
1746 "concat_null_yields_null" "cursor_close_on_commit" | |
1747 "disable_def_cnst_chk" "fips_flagger" "identity_insert" "language" | |
1748 "offsets" "quoted_identifier" "arithabort" "arithignore" "fmtonly" | |
1749 "nocount" "noexec" "numeric_roundabort" "parseonly" | |
1750 "query_governor_cost_limit" "rowcount" "textsize" "ansi_defaults" | |
1751 "ansi_null_dflt_off" "ansi_null_dflt_on" "ansi_nulls" "ansi_padding" | |
1752 "ansi_warnings" "forceplan" "showplan_all" "showplan_text" | |
1753 "statistics" "implicit_transactions" "remote_proc_transactions" | |
1754 "transaction" "xact_abort" | |
1755 ) t) | |
1756 "\\)\\)\\|go\\s-*\\|use\\s-+\\|setuser\\s-+\\|dbcc\\s-+\\).*$") | |
1757 'font-lock-doc-face) | |
1758 | |
1759 ;; MS Reserved | |
1760 (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
|
1761 "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
|
1762 "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
|
1763 "cascade" "case" "check" "checkpoint" "close" "clustered" "coalesce" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1764 "column" "commit" "committed" "compute" "confirm" "constraint" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1765 "contains" "containstable" "continue" "controlrow" "convert" "count" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1766 "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
|
1767 "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
|
1768 "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
|
1769 "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
|
1770 "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
|
1771 "fillfactor" "first" "floppy" "for" "foreign" "freetext" |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1772 "freetexttable" "from" "full" "goto" "grant" "group" "having" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1773 "holdlock" "identity" "identity_insert" "identitycol" "if" "in" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1774 "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
|
1775 "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
|
1776 "mirrorexit" "national" "next" "nocheck" "nolock" "nonclustered" "not" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1777 "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
|
1778 "opendatasource" "openquery" "openrowset" "option" "or" "order" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1779 "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
|
1780 "plan" "precision" "prepare" "primary" "print" "prior" "privileges" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1781 "proc" "procedure" "processexit" "public" "raiserror" "read" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1782 "readcommitted" "readpast" "readtext" "readuncommitted" "reconfigure" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1783 "references" "relative" "repeatable" "repeatableread" "replication" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1784 "restore" "restrict" "return" "revoke" "right" "rollback" "rowcount" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1785 "rowguidcol" "rowlock" "rule" "save" "schema" "select" "serializable" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1786 "session_user" "set" "shutdown" "some" "statistics" "sum" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1787 "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
|
1788 "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
|
1789 "tsequal" "uncommitted" "union" "unique" "update" "updatetext" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1790 "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
|
1791 "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
|
1792 "returns" |
108381 | 1793 ) |
1794 | |
1795 ;; MS Functions | |
1796 (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
|
1797 "@@connections" "@@cpu_busy" "@@cursor_rows" "@@datefirst" "@@dbts" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1798 "@@error" "@@fetch_status" "@@identity" "@@idle" "@@io_busy" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1799 "@@langid" "@@language" "@@lock_timeout" "@@max_connections" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1800 "@@max_precision" "@@nestlevel" "@@options" "@@pack_received" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1801 "@@pack_sent" "@@packet_errors" "@@procid" "@@remserver" "@@rowcount" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1802 "@@servername" "@@servicename" "@@spid" "@@textsize" "@@timeticks" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1803 "@@total_errors" "@@total_read" "@@total_write" "@@trancount" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1804 "@@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
|
1805 "avg" "case" "cast" "ceiling" "char" "charindex" "coalesce" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1806 "col_length" "col_name" "columnproperty" "containstable" "convert" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1807 "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
|
1808 "databaseproperty" "datalength" "dateadd" "datediff" "datename" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1809 "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
|
1810 "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
|
1811 "filegroupproperty" "fileproperty" "floor" "formatmessage" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1812 "freetexttable" "fulltextcatalogproperty" "fulltextserviceproperty" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1813 "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
|
1814 "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
|
1815 "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
|
1816 "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
|
1817 "object_id" "object_name" "objectproperty" "openquery" "openrowset" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1818 "parsename" "patindex" "patindex" "permissions" "pi" "power" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1819 "quotename" "radians" "rand" "replace" "replicate" "reverse" "right" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1820 "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
|
1821 "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
|
1822 "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
|
1823 "textptr" "textvalid" "typeproperty" "unicode" "upper" "user" |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1824 "user_id" "user_name" "var" "varp" "year" |
108381 | 1825 ) |
1826 | |
1827 ;; MS Variables | |
1828 '("\\b@[a-zA-Z0-9_]*\\b" . font-lock-variable-name-face) | |
1829 | |
1830 ;; MS Types | |
1831 (sql-font-lock-keywords-builder 'font-lock-type-face nil | |
1832 "binary" "bit" "char" "character" "cursor" "datetime" "dec" "decimal" | |
1833 "double" "float" "image" "int" "integer" "money" "national" "nchar" | |
1834 "ntext" "numeric" "numeric" "nvarchar" "precision" "real" | |
1835 "smalldatetime" "smallint" "smallmoney" "text" "timestamp" "tinyint" | |
1836 "uniqueidentifier" "varbinary" "varchar" "varying" | |
1837 ))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1838 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1839 "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
|
1840 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1841 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
|
1842 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
|
1843 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
|
1844 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
|
1845 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1846 (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
|
1847 "Sybase SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1848 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1849 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
|
1850 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
|
1851 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
|
1852 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
|
1853 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1854 (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
|
1855 "Informix SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1856 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1857 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
|
1858 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
|
1859 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
|
1860 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
|
1861 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1862 (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
|
1863 "Interbase SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1864 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1865 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
|
1866 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
|
1867 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
|
1868 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
|
1869 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1870 (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
|
1871 "Ingres SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1872 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1873 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
|
1874 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
|
1875 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
|
1876 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
|
1877 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1878 (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
|
1879 "Solid SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1880 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1881 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
|
1882 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
|
1883 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
|
1884 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
|
1885 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1886 (defvar sql-mode-mysql-font-lock-keywords |
108381 | 1887 (eval-when-compile |
1888 (list | |
1889 ;; MySQL Functions | |
1890 (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
|
1891 "ascii" "avg" "bdmpolyfromtext" "bdmpolyfromwkb" "bdpolyfromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1892 "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
|
1893 "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
|
1894 "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
|
1895 "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
|
1896 "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
|
1897 "geomcollfromtext" "geomcollfromwkb" "geometrycollectionfromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1898 "geometrycollectionfromwkb" "geometryfromtext" "geometryfromwkb" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1899 "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
|
1900 "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
|
1901 "length" "linefromtext" "linefromwkb" "linestringfromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1902 "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
|
1903 "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
|
1904 "mlinefromwkb" "mpointfromtext" "mpointfromwkb" "mpolyfromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1905 "mpolyfromwkb" "multilinestringfromtext" "multilinestringfromwkb" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1906 "multipointfromtext" "multipointfromwkb" "multipolygonfromtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1907 "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
|
1908 "pointfromtext" "pointfromwkb" "polyfromtext" "polyfromwkb" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1909 "polygonfromtext" "polygonfromwkb" "position" "quote" "rand" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1910 "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
|
1911 "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
|
1912 "trailing" "trim" "ucase" "unix_timestamp" "upper" "user" "variance" |
108381 | 1913 ) |
1914 | |
1915 ;; MySQL Keywords | |
1916 (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
|
1917 "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
|
1918 "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
|
1919 "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
|
1920 "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
|
1921 "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
|
1922 "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
|
1923 "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
|
1924 "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
|
1925 "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
|
1926 "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
|
1927 "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
|
1928 "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
|
1929 "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
|
1930 "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
|
1931 "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
|
1932 "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
|
1933 "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
|
1934 "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
|
1935 "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
|
1936 "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
|
1937 "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
|
1938 "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
|
1939 "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
|
1940 "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
|
1941 "with" "write" "xor" |
108381 | 1942 ) |
1943 | |
1944 ;; MySQL Data Types | |
1945 (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
|
1946 "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
|
1947 "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
|
1948 "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
|
1949 "longblob" "longtext" "mediumblob" "mediumint" "mediumtext" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1950 "multicurve" "multilinestring" "multipoint" "multipolygon" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1951 "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
|
1952 "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
|
1953 "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
|
1954 "zerofill" |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1955 ))) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1956 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1957 "MySQL SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1958 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1959 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
|
1960 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
|
1961 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
|
1962 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
|
1963 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1964 (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
|
1965 "SQLite SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1966 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1967 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
|
1968 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
|
1969 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
|
1970 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
|
1971 |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
1972 (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
|
1973 "DB2 SQL keywords used by font-lock. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1974 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1975 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
|
1976 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
|
1977 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
|
1978 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
|
1979 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1980 (defvar sql-mode-font-lock-keywords nil |
24050 | 1981 "SQL keywords used by font-lock. |
1982 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1983 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
|
1984 `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
|
1985 highlighting rules in SQL mode.") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1986 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1987 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1988 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1989 ;;; SQL Product support functions |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
1990 |
108381 | 1991 (defun sql-add-product (product display &rest plist) |
1992 "Add support for a database product in `sql-mode'. | |
1993 | |
1994 Add PRODUCT to `sql-product-alist' which enables `sql-mode' to | |
1995 properly support syntax highlighting and interactive interaction. | |
1996 DISPLAY is the name of the SQL product that will appear in the | |
1997 menu bar and in messages. PLIST initializes the product | |
1998 configuration." | |
1999 | |
2000 ;; Don't do anything if the product is already supported | |
2001 (if (assoc product sql-product-alist) | |
2002 (message "Product `%s' is already defined" product) | |
2003 | |
2004 ;; Add product to the alist | |
2005 (add-to-list 'sql-product-alist `((,product :name ,display . ,plist))) | |
2006 ;; Add a menu item to the SQL->Product menu | |
2007 (easy-menu-add-item sql-mode-menu '("Product") | |
2008 ;; Each product is represented by a radio | |
2009 ;; button with it's display name. | |
2010 `[,display | |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
2011 (sql-set-product ',product) |
108381 | 2012 :style radio |
2013 :selected (eq sql-product ',product)] | |
2014 ;; Maintain the product list in | |
2015 ;; (case-insensitive) alphabetic order of the | |
2016 ;; display names. Loop thru each keymap item | |
2017 ;; looking for an item whose display name is | |
2018 ;; after this product's name. | |
2019 (let ((next-item) | |
2020 (down-display (downcase display))) | |
2021 (map-keymap (lambda (k b) | |
2022 (when (and (not next-item) | |
2023 (string-lessp down-display | |
2024 (downcase (cadr b)))) | |
2025 (setq next-item k))) | |
2026 (easy-menu-get-map sql-mode-menu '("Product"))) | |
2027 next-item)) | |
2028 product)) | |
2029 | |
2030 (defun sql-del-product (product) | |
2031 "Remove support for PRODUCT in `sql-mode'." | |
2032 | |
2033 ;; Remove the menu item based on the display name | |
2034 (easy-menu-remove-item sql-mode-menu '("Product") (sql-get-product-feature product :name)) | |
2035 ;; Remove the product alist item | |
2036 (setq sql-product-alist (assq-delete-all product sql-product-alist)) | |
2037 nil) | |
2038 | |
2039 (defun sql-set-product-feature (product feature newvalue) | |
2040 "Set FEATURE of database PRODUCT to NEWVALUE. | |
2041 | |
2042 The PRODUCT must be a symbol which identifies the database | |
2043 product. The product must have already exist on the product | |
2044 list. See `sql-add-product' to add new products. The FEATURE | |
2045 argument must be a plist keyword accepted by | |
2046 `sql-product-alist'." | |
2047 | |
2048 (let* ((p (assoc product sql-product-alist)) | |
2049 (v (plist-get (cdr p) feature))) | |
2050 (if p | |
2051 (if (and | |
2052 (member feature sql-indirect-features) | |
2053 (symbolp v)) | |
2054 (set v newvalue) | |
2055 (setcdr p (plist-put (cdr p) feature newvalue))) | |
2056 (message "`%s' is not a known product; use `sql-add-product' to add it first." product)))) | |
2057 | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2058 (defun sql-get-product-feature (product feature &optional fallback not-indirect) |
108381 | 2059 "Lookup FEATURE associated with a SQL PRODUCT. |
2060 | |
2061 If the FEATURE is nil for PRODUCT, and FALLBACK is specified, | |
2062 then the FEATURE associated with the FALLBACK product is | |
2063 returned. | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2064 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2065 If the FEATURE is in the list `sql-indirect-features', and the |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2066 NOT-INDIRECT parameter is not set, then the value of the symbol |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2067 stored in the connect alist is returned. |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2068 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2069 See `sql-product-alist' for a list of products and supported features." |
108381 | 2070 (let* ((p (assoc product sql-product-alist)) |
2071 (v (plist-get (cdr p) feature))) | |
2072 | |
2073 (if p | |
2074 ;; If no value and fallback, lookup feature for fallback | |
2075 (if (and (not v) | |
2076 fallback | |
2077 (not (eq product fallback))) | |
2078 (sql-get-product-feature fallback feature) | |
2079 | |
2080 (if (and | |
2081 (member feature sql-indirect-features) | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2082 (not not-indirect) |
108381 | 2083 (symbolp v)) |
2084 (symbol-value v) | |
2085 v)) | |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
2086 (message "`%s' is not a known product; use `sql-add-product' to add it first." product) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
2087 nil))) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2088 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2089 (defun sql-product-font-lock (keywords-only imenu) |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
2090 "Configure font-lock and imenu with product-specific settings. |
108381 | 2091 |
2092 The KEYWORDS-ONLY flag is passed to font-lock to specify whether | |
2093 only keywords should be hilighted and syntactic hilighting | |
2094 skipped. The IMENU flag indicates whether `imenu-mode' should | |
2095 also be configured." | |
2096 | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2097 (let |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2098 ;; Get the product-specific syntax-alist. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2099 ((syntax-alist |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2100 (append |
108381 | 2101 (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
|
2102 '((?_ . "w") (?. . "w"))))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2103 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2104 ;; Get the product-specific keywords. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2105 (setq sql-mode-font-lock-keywords |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2106 (append |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2107 (unless (eq sql-product 'ansi) |
108381 | 2108 (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
|
2109 ;; Always highlight ANSI keywords |
108381 | 2110 (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
|
2111 ;; 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
|
2112 ;; statements |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2113 (list sql-mode-font-lock-object-name))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2114 |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2115 ;; Setup font-lock. Force re-parsing of `font-lock-defaults'. |
108381 | 2116 (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
|
2117 (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
|
2118 keywords-only t syntax-alist)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2119 |
55370
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2120 ;; 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
|
2121 ;; 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
|
2122 (when (and (fboundp 'font-lock-mode) |
108381 | 2123 (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
|
2124 font-lock-mode) |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2125 (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
|
2126 (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
|
2127 |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2128 (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
|
2129 (lambda () |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2130 ;; 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
|
2131 (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
|
2132 (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
|
2133 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
|
2134 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
|
2135 (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
|
2136 nil t) |
f714f103b48a
(sql-xemacs-p, sql-emacs19-p, sql-emacs20-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55241
diff
changeset
|
2137 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2138 ;; 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
|
2139 (when imenu |
108381 | 2140 (setq imenu-syntax-alist syntax-alist)))) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2141 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2142 ;;;###autoload |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2143 (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
|
2144 "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
|
2145 |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
2146 PRODUCT should be a symbol, the name of a SQL product, such as |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2147 `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
|
2148 `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
|
2149 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
|
2150 `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
|
2151 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
|
2152 of the current highlighting list. |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2153 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2154 For example: |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2155 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2156 (sql-add-product-keywords 'ms |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2157 '((\"\\\\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
|
2158 |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2159 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
|
2160 `_t' as data types." |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2161 |
108381 | 2162 (let* ((sql-indirect-features nil) |
2163 (font-lock-var (sql-get-product-feature product :font-lock)) | |
2164 (old-val)) | |
2165 | |
2166 (setq old-val (symbol-value font-lock-var)) | |
2167 (set font-lock-var | |
55241
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2168 (if (eq append 'set) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2169 keywords |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
2170 (if append |
108381 | 2171 (append old-val keywords) |
2172 (append keywords old-val)))))) | |
24050 | 2173 |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2174 (defun sql-for-each-login (login-params body) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2175 "Iterates through login parameters and returns a list of results." |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2176 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2177 (delq nil |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2178 (mapcar |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2179 (lambda (param) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2180 (let ((token (or (and (listp param) (car param)) param)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2181 (type (or (and (listp param) (nth 1 param)) nil)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2182 (arg (or (and (listp param) (nth 2 param)) nil))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2183 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2184 (funcall body token type arg))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2185 login-params))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2186 |
24050 | 2187 |
30905
2069c10bf952
(sql-magic-go): Use comint-bol.
Gerd Moellmann <gerd@gnu.org>
parents:
30838
diff
changeset
|
2188 |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2189 ;;; Functions to switch highlighting |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2190 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2191 (defun sql-highlight-product () |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
2192 "Turn 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
|
2193 (when (derived-mode-p 'sql-mode) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2194 ;; Setup font-lock |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2195 (sql-product-font-lock nil t) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2196 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2197 ;; Set the mode name to include the product. |
108381 | 2198 (setq mode-name (concat "SQL[" (or (sql-get-product-feature sql-product :name) |
2199 (symbol-name sql-product)) "]")))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2200 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2201 (defun sql-set-product (product) |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
2202 "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
|
2203 (interactive |
108381 | 2204 (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
|
2205 (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
|
2206 sql-product-alist) |
108381 | 2207 nil 'require-match |
2208 (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
|
2209 (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
|
2210 (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
|
2211 (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
|
2212 (setq product 'ansi)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2213 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2214 ;; Save product setting and fontify. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2215 (setq sql-product product) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2216 (sql-highlight-product)) |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2217 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2218 |
30838
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2219 ;;; Compatibility functions |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2220 |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2221 (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
|
2222 ;; 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
|
2223 (defun comint-line-beginning-position () |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2224 "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
|
2225 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
|
2226 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
|
2227 (save-excursion (comint-bol nil) (point)))) |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2228 |
c9f793802722
Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents:
30642
diff
changeset
|
2229 |
24050 | 2230 |
2231 ;;; Small functions | |
2232 | |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2233 (defun sql-magic-go (arg) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2234 "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
|
2235 `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
|
2236 (interactive "P") |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2237 (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
|
2238 (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
|
2239 (save-excursion |
30642
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2240 (comint-bol nil) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2241 (looking-at "go\\b"))) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2242 (comint-send-input))) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2243 |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2244 (defun sql-magic-semicolon (arg) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2245 "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
|
2246 `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
|
2247 (interactive "P") |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2248 (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
|
2249 (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
|
2250 (comint-send-input))) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2251 |
24050 | 2252 (defun sql-accumulate-and-indent () |
2253 "Continue SQL statement on the next line." | |
2254 (interactive) | |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
2255 (if (fboundp 'comint-accumulate) |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2256 (comint-accumulate) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2257 (newline)) |
24050 | 2258 (indent-according-to-mode)) |
2259 | |
108381 | 2260 (defun sql-help-list-products (indent freep) |
2261 "Generate listing of products available for use under SQLi. | |
2262 | |
2263 List products with :free-softare attribute set to FREEP. Indent | |
2264 each line with INDENT." | |
2265 | |
2266 (let (sqli-func doc) | |
2267 (setq doc "") | |
2268 (dolist (p sql-product-alist) | |
2269 (setq sqli-func (intern (concat "sql-" (symbol-name (car p))))) | |
2270 | |
2271 (if (and (fboundp sqli-func) | |
2272 (eq (sql-get-product-feature (car p) :free-software) freep)) | |
2273 (setq doc | |
2274 (concat doc | |
2275 indent | |
2276 (or (sql-get-product-feature (car p) :name) | |
2277 (symbol-name (car p))) | |
2278 ":\t" | |
2279 "\\[" | |
2280 (symbol-name sqli-func) | |
2281 "]\n")))) | |
2282 doc)) | |
2283 | |
24050 | 2284 ;;;###autoload |
2285 (defun sql-help () | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2286 "Show short help for the SQL modes. |
24050 | 2287 |
2288 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
|
2289 usually named `*SQL*'. The name of the major mode is SQLi. |
24050 | 2290 |
2291 Use the following commands to start a specific SQL interpreter: | |
2292 | |
108381 | 2293 \\\\FREE |
24268 | 2294 |
2295 Other non-free SQL implementations are also supported: | |
2296 | |
108381 | 2297 \\\\NONFREE |
24268 | 2298 |
2299 But we urge you to choose a free implementation instead of these. | |
24050 | 2300 |
108381 | 2301 You can also use \\[sql-product-interactive] to invoke the |
2302 interpreter for the current `sql-product'. | |
2303 | |
24050 | 2304 Once you have the SQLi buffer, you can enter SQL statements in the |
2305 buffer. The output generated is appended to the buffer and a new prompt | |
2306 is generated. See the In/Out menu in the SQLi buffer for some functions | |
2307 that help you navigate through the buffer, the input history, etc. | |
2308 | |
2309 If you have a really complex SQL statement or if you are writing a | |
2310 procedure, you can do this in a separate buffer. Put the new buffer in | |
2311 `sql-mode' by calling \\[sql-mode]. The name of this buffer can be | |
2312 anything. The name of the major mode is SQL. | |
2313 | |
2314 In this SQL buffer (SQL mode), you can send the region or the entire | |
2315 buffer to the interactive SQL buffer (SQLi mode). The results are | |
2316 appended to the SQLi buffer without disturbing your SQL buffer." | |
2317 (interactive) | |
108381 | 2318 |
2319 ;; Insert references to loaded products into the help buffer string | |
2320 (let ((doc (documentation 'sql-help t)) | |
2321 changedp) | |
2322 (setq changedp nil) | |
2323 | |
2324 ;; Insert FREE software list | |
2325 (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]FREE\\s-*\n" doc 0) | |
2326 (setq doc (replace-match (sql-help-list-products (match-string 1 doc) t) | |
2327 t t doc 0) | |
2328 changedp t)) | |
2329 | |
2330 ;; Insert non-FREE software list | |
2331 (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]NONFREE\\s-*\n" doc 0) | |
2332 (setq doc (replace-match (sql-help-list-products (match-string 1 doc) nil) | |
2333 t t doc 0) | |
2334 changedp t)) | |
2335 | |
2336 ;; If we changed the help text, save the change so that the help | |
2337 ;; sub-system will see it | |
2338 (when changedp | |
2339 (put 'sql-help 'function-documentation doc))) | |
2340 | |
2341 ;; Call help on this function | |
24050 | 2342 (describe-function 'sql-help)) |
2343 | |
2344 (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
|
2345 "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
|
2346 (read-passwd prompt nil default)) |
24050 | 2347 |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2348 (defun sql-get-login-ext (prompt last-value history-var type arg) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2349 "Prompt user with extended login parameters. |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2350 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2351 If TYPE is nil, then the user is simply prompted for a string |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2352 value. |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2353 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2354 If TYPE is `:file', then the user is prompted for a file |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2355 name that must match the regexp pattern specified in the ARG |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2356 argument. |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2357 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2358 If TYPE is `:completion', then the user is prompted for a string |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2359 specified by ARG. (ARG is used as the PREDICATE argument to |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2360 `completing-read'.)" |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2361 (cond |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2362 ((eq type nil) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2363 (read-from-minibuffer prompt last-value nil nil history-var)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2364 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2365 ((eq type :file) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2366 (let ((use-dialog-box nil)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2367 (expand-file-name |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2368 (read-file-name prompt |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2369 (file-name-directory last-value) nil t |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2370 (file-name-nondirectory last-value) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2371 (if arg |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2372 `(lambda (f) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2373 (string-match (concat "\\<" ,arg "\\>") |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2374 (file-name-nondirectory f))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2375 nil))))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2376 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2377 ((eq type :completion) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2378 (completing-read prompt arg nil t last-value history-var)))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2379 |
24050 | 2380 (defun sql-get-login (&rest what) |
2381 "Get username, password and database from the user. | |
2382 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2383 The variables `sql-user', `sql-password', `sql-server', and |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
2384 `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
|
2385 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
|
2386 `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
|
2387 in a history. |
24050 | 2388 |
108381 | 2389 Parameter WHAT is a list of tokens passed as arguments in the |
2390 function call. The function asks for the username if WHAT | |
2391 contains the symbol `user', for the password if it contains the | |
2392 symbol `password', for the server if it contains the symbol | |
2393 `server', and for the database if it contains the symbol | |
2394 `database'. The members of WHAT are processed in the order in | |
2395 which they are provided. | |
24050 | 2396 |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2397 The tokens for `database' and `server' may also be lists to |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2398 control or limit the values that can be supplied. These can be |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2399 of the form: |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2400 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2401 \(database :file \".+\\\\.EXT\") |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2402 \(database :completion FUNCTION) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2403 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2404 The `server' token supports the same forms. |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2405 |
24050 | 2406 In order to ask the user for username, password and database, call the |
2407 function like this: (sql-get-login 'user 'password 'database)." | |
2408 (interactive) | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2409 (mapcar |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2410 (lambda (w) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2411 (let ((token (or (and (listp w) (car w)) w)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2412 (type (or (and (listp w) (nth 1 w)) nil)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2413 (arg (or (and (listp w) (nth 2 w)) nil))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2414 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2415 (cond |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2416 ((eq token 'user) ; user |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2417 (setq sql-user |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2418 (read-from-minibuffer "User: " sql-user nil nil |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2419 'sql-user-history))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2420 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2421 ((eq token 'password) ; password |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2422 (setq sql-password |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2423 (sql-read-passwd "Password: " sql-password))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2424 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2425 ((eq token 'server) ; server |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2426 (setq sql-server |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2427 (sql-get-login-ext "Server: " sql-server |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2428 'sql-server-history type arg))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2429 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2430 ((eq token 'database) ; database |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2431 (setq sql-database |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2432 (sql-get-login-ext "Database: " sql-database |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2433 'sql-database-history type arg))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2434 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2435 ((eq token 'port) ; port |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2436 (setq sql-port |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2437 (read-number "Port: " sql-port)))))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2438 what)) |
25381
970b18c6803f
(sql-sybase): use sql-server instead of sql-database.
Alex Schroeder <alex@gnu.org>
parents:
25183
diff
changeset
|
2439 |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2440 (defun sql-find-sqli-buffer () |
108381 | 2441 "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
|
2442 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
|
2443 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
|
2444 (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
|
2445 (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
|
2446 (get-buffer-process default-buffer)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2447 default-buffer |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2448 (save-current-buffer |
29937
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2449 (let ((buflist (buffer-list)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2450 (found)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2451 (while (not (or (null buflist) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2452 found)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2453 (let ((candidate (car buflist))) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2454 (set-buffer candidate) |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2455 (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
|
2456 (get-buffer-process candidate)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2457 (setq found candidate)) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2458 (setq buflist (cdr buflist)))) |
693c2c631d72
(sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents:
26576
diff
changeset
|
2459 found))))) |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2460 |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2461 (defun sql-set-sqli-buffer-generally () |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
2462 "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
|
2463 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
|
2464 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
|
2465 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
|
2466 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
|
2467 `sql-set-sqli-hook' is run." |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2468 (interactive) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2469 (save-excursion |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2470 (let ((buflist (buffer-list)) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2471 (default-sqli-buffer (sql-find-sqli-buffer))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2472 (setq-default sql-buffer default-sqli-buffer) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2473 (while (not (null buflist)) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2474 (let ((candidate (car buflist))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2475 (set-buffer candidate) |
104304
35fbb27750a7
(sql-product-alist): Add :name tag to entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102020
diff
changeset
|
2476 (if (and (derived-mode-p 'sql-mode) |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2477 (not (buffer-live-p sql-buffer))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2478 (progn |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2479 (setq sql-buffer default-sqli-buffer) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2480 (run-hooks 'sql-set-sqli-hook)))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2481 (setq buflist (cdr buflist)))))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2482 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2483 (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
|
2484 "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
|
2485 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2486 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
|
2487 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
|
2488 `sql-set-sqli-hook'. |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2489 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2490 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
|
2491 `sql-buffer'. |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2492 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2493 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
|
2494 `sql-buffer'." |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2495 (interactive) |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2496 (let ((default-buffer (sql-find-sqli-buffer))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2497 (if (null default-buffer) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2498 (error "There is no suitable SQLi buffer")) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2499 (let ((new-buffer |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2500 (get-buffer |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2501 (read-buffer "New SQLi buffer: " default-buffer t)))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2502 (if (null (get-buffer-process new-buffer)) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2503 (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
|
2504 (if (null (with-current-buffer new-buffer |
26576
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2505 (equal major-mode 'sql-interactive-mode))) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2506 (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
|
2507 (if new-buffer |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2508 (progn |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2509 (setq sql-buffer new-buffer) |
0894b3c8dfd6
(sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
25826
diff
changeset
|
2510 (run-hooks 'sql-set-sqli-hook)))))) |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2511 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2512 (defun sql-show-sqli-buffer () |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2513 "Show the name of current SQLi buffer. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2514 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2515 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
|
2516 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
|
2517 (interactive) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2518 (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
|
2519 (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
|
2520 (if (null (get-buffer-process sql-buffer)) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2521 (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
|
2522 (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
|
2523 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2524 (defun sql-make-alternate-buffer-name () |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
2525 "Return 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
|
2526 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2527 This is used to set `sql-alternate-buffer-name' within |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2528 `sql-interactive-mode'. |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2529 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2530 If the session was started with `sql-connect' then the alternate |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2531 name would be the name of the connection. |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2532 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2533 Otherwise, it uses the parameters identified by the :sqlilogin |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2534 parameter. |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2535 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2536 If all else fails, the alternate name would be the user and |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2537 server/database name." |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2538 |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
2539 (let ((name "")) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
2540 |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2541 ;; Build a name using the :sqli-login setting |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2542 (setq name |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2543 (apply 'concat |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2544 (apply 'append nil |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2545 (sql-for-each-login |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2546 (sql-get-product-feature sql-product :sqli-login) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2547 (lambda (token type arg) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2548 (cond |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2549 ((eq token 'user) (list "/" sql-user)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2550 ((eq token 'port) (list ":" sql-port)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2551 ((eq token 'server) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2552 (list "." (if (eq type :file) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2553 (file-name-nondirectory sql-server) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2554 sql-server))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2555 ((eq token 'database) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2556 (list "@" (if (eq type :file) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2557 (file-name-nondirectory sql-database) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2558 sql-database))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2559 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2560 ((eq token 'password) nil) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2561 (t nil))))))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2562 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2563 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2564 ;; If there's a connection, use it and the name thus far |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
2565 (if sql-connection |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
2566 (format "<%s>%s" sql-connection (or name "")) |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2567 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2568 ;; If there is no name, try to create something meaningful |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2569 (if (string= "" (or name "")) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2570 (concat |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2571 (if (string= "" sql-user) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2572 (if (string= "" (user-login-name)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2573 () |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2574 (concat (user-login-name) "/")) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2575 (concat sql-user "/")) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2576 (if (string= "" sql-database) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2577 (if (string= "" sql-server) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2578 (system-name) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2579 sql-server) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2580 sql-database)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2581 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2582 ;; We've got a name, go with it (without the first punctuation char) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2583 (substring name 1))))) |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2584 |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2585 (defun sql-rename-buffer () |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2586 "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
|
2587 (interactive) |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2588 (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
|
2589 |
24050 | 2590 (defun sql-copy-column () |
2591 "Copy current column to the end of buffer. | |
2592 Inserts SELECT or commas if appropriate." | |
2593 (interactive) | |
2594 (let ((column)) | |
2595 (save-excursion | |
108381 | 2596 (setq column (buffer-substring-no-properties |
24050 | 2597 (progn (forward-char 1) (backward-sexp 1) (point)) |
2598 (progn (forward-sexp 1) (point)))) | |
2599 (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
|
2600 (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
|
2601 (cond |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2602 ;; 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
|
2603 ((= bol (point)) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2604 (insert "SELECT ")) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2605 ;; 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
|
2606 ((save-excursion |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2607 (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
|
2608 bol t)) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2609 (insert ", ")) |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2610 ;; else insert a space |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2611 (t |
64052
68f51d595f7f
(SQL): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63410
diff
changeset
|
2612 (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
|
2613 nil |
ae938744b6b1
(sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents:
30513
diff
changeset
|
2614 (insert " "))))) |
24050 | 2615 ;; in any case, insert the column |
2616 (insert column) | |
2617 (message "%s" column)))) | |
2618 | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2619 ;; 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
|
2620 ;; 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
|
2621 ;; 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
|
2622 ;; Emacs query for the placeholders. |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2623 |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2624 (defvar sql-placeholder-history nil |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2625 "History of placeholder values used.") |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2626 |
108381 | 2627 (defun sql-placeholders-filter (string) |
2628 "Replace placeholders in STRING. | |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
2629 Placeholders are words starting with an ampersand like &this." |
108381 | 2630 |
2631 (when sql-oracle-scan-on | |
2632 (while (string-match "&\\(\\sw+\\)" string) | |
2633 (setq string (replace-match | |
2634 (read-from-minibuffer | |
2635 (format "Enter value for %s: " (match-string 1 string)) | |
2636 nil nil nil 'sql-placeholder-history) | |
2637 t t string)))) | |
2638 string) | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2639 |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2640 ;; 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
|
2641 ;; The space before the backslash is relevant. |
108381 | 2642 (defun sql-escape-newlines-filter (string) |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
2643 "Escape newlines in STRING. |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2644 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
|
2645 (let ((result "") (start 0) mb me) |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2646 (while (string-match "\n" string start) |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2647 (setq mb (match-beginning 0) |
108381 | 2648 me (match-end 0) |
2649 result (concat result | |
2650 (substring string start mb) | |
2651 (if (and (> mb 1) | |
2652 (string-equal " \\" (substring string (- mb 2) mb))) | |
2653 "" " \\\n")) | |
2654 start me)) | |
2655 (concat result (substring string start)))) | |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
2656 |
24050 | 2657 |
2658 | |
108381 | 2659 ;;; Input sender for SQLi buffers |
2660 | |
2661 (defun sql-input-sender (proc string) | |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
2662 "Send STRING to PROC after applying filters." |
108381 | 2663 |
2664 (let* ((product (with-current-buffer (process-buffer proc) sql-product)) | |
2665 (filter (sql-get-product-feature product :input-filter))) | |
2666 | |
2667 ;; Send the string | |
2668 (comint-simple-send proc (if filter (funcall filter string) string)))) | |
2669 | |
24050 | 2670 ;;; Sending the region to the SQLi buffer. |
2671 | |
108381 | 2672 (defun sql-send-string (str) |
2673 "Send the string STR to the SQL process." | |
2674 (interactive "sSQL Text: ") | |
2675 | |
2676 (let (comint-input-sender-no-newline proc) | |
2677 (if (buffer-live-p sql-buffer) | |
2678 (progn | |
2679 ;; Ignore the hoping around... | |
2680 (save-excursion | |
2681 ;; Get the process | |
2682 (setq proc (get-buffer-process sql-buffer)) | |
2683 | |
2684 ;; Set product context | |
2685 (with-current-buffer sql-buffer | |
2686 ;; Send the string | |
2687 (sql-input-sender proc str) | |
2688 | |
2689 ;; Send a newline if there wasn't one on the end of the string | |
2690 (unless (string-equal "\n" (substring str (1- (length str)))) | |
2691 (comint-send-string proc "\n")) | |
2692 | |
2693 ;; Send a command terminator if we must | |
2694 (if sql-send-terminator | |
2695 (sql-send-magic-terminator sql-buffer str sql-send-terminator)) | |
2696 | |
2697 (message "Sent string to buffer %s." (buffer-name sql-buffer)))) | |
2698 | |
2699 ;; Display the sql buffer | |
2700 (if sql-pop-to-buffer-after-send-region | |
2701 (pop-to-buffer sql-buffer) | |
2702 (display-buffer sql-buffer))) | |
2703 | |
2704 ;; We don't have no stinkin' sql | |
2705 (message "No SQL process started.")))) | |
2706 | |
24050 | 2707 (defun sql-send-region (start end) |
2708 "Send a region to the SQL process." | |
2709 (interactive "r") | |
108381 | 2710 (sql-send-string (buffer-substring-no-properties start end))) |
24050 | 2711 |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2712 (defun sql-send-paragraph () |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2713 "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
|
2714 (interactive) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2715 (let ((start (save-excursion |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2716 (backward-paragraph) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2717 (point))) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2718 (end (save-excursion |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2719 (forward-paragraph) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2720 (point)))) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2721 (sql-send-region start end))) |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2722 |
24050 | 2723 (defun sql-send-buffer () |
2724 "Send the buffer contents to the SQL process." | |
2725 (interactive) | |
2726 (sql-send-region (point-min) (point-max))) | |
2727 | |
108381 | 2728 (defun sql-send-magic-terminator (buf str terminator) |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
2729 "Send TERMINATOR to buffer BUF if its not present in STR." |
108381 | 2730 (let (pat term) |
2731 ;; If flag is merely on(t), get product-specific terminator | |
2732 (if (eq terminator t) | |
2733 (setq terminator (sql-get-product-feature sql-product :terminator))) | |
2734 | |
2735 ;; If there is no terminator specified, use default ";" | |
2736 (unless terminator | |
2737 (setq terminator ";")) | |
2738 | |
2739 ;; Parse the setting into the pattern and the terminator string | |
2740 (cond ((stringp terminator) | |
2741 (setq pat (regexp-quote terminator) | |
2742 term terminator)) | |
2743 ((consp terminator) | |
2744 (setq pat (car terminator) | |
2745 term (cdr terminator))) | |
2746 (t | |
2747 nil)) | |
2748 | |
2749 ;; Check to see if the pattern is present in the str already sent | |
2750 (unless (and pat term | |
2751 (string-match (concat pat "\n?\\'") str)) | |
2752 (comint-send-string buf (concat term "\n"))))) | |
2753 | |
2754 (defun sql-remove-tabs-filter (str) | |
2755 "Replace tab characters with spaces." | |
2756 (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
|
2757 |
24050 | 2758 (defun sql-toggle-pop-to-buffer-after-send-region (&optional value) |
2759 "Toggle `sql-pop-to-buffer-after-send-region'. | |
2760 | |
2761 If given the optional parameter VALUE, sets | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
2762 `sql-toggle-pop-to-buffer-after-send-region' to VALUE." |
24050 | 2763 (interactive "P") |
2764 (if value | |
2765 (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
|
2766 (setq sql-pop-to-buffer-after-send-region |
108381 | 2767 (null sql-pop-to-buffer-after-send-region)))) |
24050 | 2768 |
2769 | |
2770 | |
2771 ;;; SQL mode -- uses SQL interactive mode | |
2772 | |
2773 ;;;###autoload | |
2774 (defun sql-mode () | |
2775 "Major mode to edit SQL. | |
2776 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2777 You can send SQL statements to the SQLi buffer using |
24050 | 2778 \\[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
|
2779 See `sql-help' on how to create SQLi buffers. |
24050 | 2780 |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2781 \\{sql-mode-map} |
24050 | 2782 Customization: Entry to this mode runs the `sql-mode-hook'. |
2783 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2784 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
|
2785 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
|
2786 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
|
2787 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
|
2788 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
|
2789 value of `sql-buffer' using \\[sql-set-sqli-buffer]. |
24050 | 2790 |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2791 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
|
2792 `sql-interactive-mode'. |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2793 |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2794 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
|
2795 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
|
2796 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
|
2797 |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2798 \(add-hook 'sql-mode-hook |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2799 (lambda () |
fa679d186a7d
(sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents:
40432
diff
changeset
|
2800 (modify-syntax-entry ?\\\\ \".\" sql-mode-syntax-table)))" |
24050 | 2801 (interactive) |
2802 (kill-all-local-variables) | |
2803 (setq major-mode 'sql-mode) | |
2804 (setq mode-name "SQL") | |
2805 (use-local-map sql-mode-map) | |
31392
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
2806 (if sql-mode-menu |
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
2807 (easy-menu-add sql-mode-menu)); XEmacs |
24050 | 2808 (set-syntax-table sql-mode-syntax-table) |
2809 (make-local-variable 'font-lock-defaults) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2810 (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
|
2811 (make-local-variable 'comment-start) |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
2812 (setq comment-start "--") |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2813 ;; 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
|
2814 (make-local-variable 'sql-buffer) |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2815 ;; 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
|
2816 ;; 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
|
2817 ;; 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
|
2818 (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
|
2819 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
|
2820 ;; 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
|
2821 ;; lines. |
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2822 (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
|
2823 (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
|
2824 (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
|
2825 paragraph-start "[\n\f]") |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2826 ;; Abbrevs |
24050 | 2827 (setq local-abbrev-table sql-mode-abbrev-table) |
2828 (setq abbrev-all-caps 1) | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2829 ;; Run hook |
62772
f2892faa87d4
* progmodes/ada-mode.el (ada-mode):
Lute Kamstra <lute@gnu.org>
parents:
59996
diff
changeset
|
2830 (run-mode-hooks 'sql-mode-hook) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2831 ;; 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
|
2832 (sql-highlight-product) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2833 (add-hook 'hack-local-variables-hook 'sql-highlight-product t t)) |
24050 | 2834 |
2835 | |
2836 | |
2837 ;;; SQL interactive mode | |
2838 | |
2839 (put 'sql-interactive-mode 'mode-class 'special) | |
2840 | |
2841 (defun sql-interactive-mode () | |
2842 "Major mode to use a SQL interpreter interactively. | |
2843 | |
2844 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
|
2845 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
|
2846 See `sql-help' for a list of available entry functions. |
24050 | 2847 |
2848 \\[comint-send-input] after the end of the process' output sends the | |
2849 text from the end of process to the end of the current line. | |
2850 \\[comint-send-input] before end of process output copies the current | |
2851 line minus the prompt to the end of the buffer and sends it. | |
2852 \\[comint-copy-old-input] just copies the current line. | |
2853 Use \\[sql-accumulate-and-indent] to enter multi-line statements. | |
2854 | |
2855 If you want to make multiple SQL buffers, rename the `*SQL*' buffer | |
2856 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
|
2857 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
|
2858 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
|
2859 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
|
2860 their creation. See `sql-mode' for details. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2861 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2862 Sample session using two connections: |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2863 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2864 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
|
2865 2. Rename buffer \"*SQL*\" to \"*Connection 1*\". |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2866 3. Create a SQL buffer \"test1.sql\". |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2867 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
|
2868 5. Rename buffer \"*SQL*\" to \"*Connection 2*\". |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2869 6. Create a SQL buffer \"test2.sql\". |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2870 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2871 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
|
2872 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
|
2873 will send the region to buffer \"*Connection 2*\". |
24050 | 2874 |
2875 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
|
2876 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
|
2877 the signals are not supported. |
24050 | 2878 |
2879 \\{sql-interactive-mode-map} | |
2880 Customization: Entry to this mode runs the hooks on `comint-mode-hook' | |
2881 and `sql-interactive-mode-hook' (in that order). Before each input, the | |
2882 hooks on `comint-input-filter-functions' are run. After each SQL | |
2883 interpreter output, the hooks on `comint-output-filter-functions' are | |
2884 run. | |
2885 | |
65198
7fbb366ab47a
(sql-interactive-mode): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
64837
diff
changeset
|
2886 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
|
2887 input ring history. |
24050 | 2888 |
2889 Variables `comint-output-filter-functions', a hook, and | |
2890 `comint-scroll-to-bottom-on-input' and | |
2891 `comint-scroll-to-bottom-on-output' control whether input and output | |
2892 cause the window to scroll to the end of the buffer. | |
2893 | |
2894 If you want to make SQL buffers limited in length, add the function | |
2895 `comint-truncate-buffer' to `comint-output-filter-functions'. | |
2896 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
2897 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
|
2898 certain length. |
24050 | 2899 |
2900 \(add-hook 'sql-interactive-mode-hook | |
2901 \(function (lambda () | |
2902 \(setq comint-output-filter-functions 'comint-truncate-buffer)))) | |
2903 | |
2904 Here is another example. It will always put point back to the statement | |
2905 you entered, right above the output it created. | |
2906 | |
25826
e55139b50cb6
(sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents:
25381
diff
changeset
|
2907 \(setq comint-output-filter-functions |
24050 | 2908 \(function (lambda (STR) (comint-show-output))))" |
63410
37dd5dc2f5ae
(sql-interactive-mode): Use delay-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
62772
diff
changeset
|
2909 (delay-mode-hooks (comint-mode)) |
108381 | 2910 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2911 ;; 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
|
2912 (set (make-local-variable 'sql-product) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2913 (or sql-interactive-product |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2914 sql-product)) |
108381 | 2915 |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2916 ;; Setup the mode. |
24050 | 2917 (setq major-mode 'sql-interactive-mode) |
108381 | 2918 (setq mode-name (concat "SQLi[" (or (sql-get-product-feature sql-product :name) |
2919 (symbol-name sql-product)) "]")) | |
24050 | 2920 (use-local-map sql-interactive-mode-map) |
31392
1f97a090ba6d
(sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents:
30905
diff
changeset
|
2921 (if sql-interactive-mode-menu |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2922 (easy-menu-add sql-interactive-mode-menu)) ; XEmacs |
24050 | 2923 (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
|
2924 (make-local-variable 'sql-mode-font-lock-keywords) |
24050 | 2925 (make-local-variable 'font-lock-defaults) |
108381 | 2926 |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
2927 ;; 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
|
2928 ;; 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
|
2929 ;; 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
|
2930 ;; disabled for interactive buffers. No imenu support. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2931 (sql-product-font-lock t nil) |
108381 | 2932 |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2933 ;; 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
|
2934 (make-local-variable 'comment-start) |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
2935 (setq comment-start "--") |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2936 ;; 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
|
2937 ;; by default. |
24050 | 2938 (setq local-abbrev-table sql-mode-abbrev-table) |
2939 (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
|
2940 ;; Exiting the process will call sql-stop. |
24050 | 2941 (set-process-sentinel (get-buffer-process sql-buffer) 'sql-stop) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2942 ;; Save the connection name |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
2943 (make-local-variable 'sql-connection) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2944 ;; 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
|
2945 (make-local-variable 'sql-alternate-buffer-name) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2946 (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
|
2947 ;; User stuff. Initialize before the hook. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2948 (set (make-local-variable 'sql-prompt-regexp) |
108381 | 2949 (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
|
2950 (set (make-local-variable 'sql-prompt-length) |
108381 | 2951 (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
|
2952 (make-local-variable 'sql-input-ring-separator) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2953 (make-local-variable 'sql-input-ring-file-name) |
108381 | 2954 (setq comint-process-echoes t) |
2955 ;; 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
|
2956 (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
|
2957 ;; Set comint based on user overrides. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2958 (setq comint-prompt-regexp sql-prompt-regexp) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
2959 (setq left-margin sql-prompt-length) |
108381 | 2960 ;; Install input sender |
2961 (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
|
2962 ;; People wanting a different history file for each |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2963 ;; 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
|
2964 ;; on the sql-interactive-mode-hook. |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2965 (setq comint-input-ring-separator sql-input-ring-separator |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2966 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
|
2967 ;; Calling the hook before calling comint-read-input-ring allows users |
24050 | 2968 ;; 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
|
2969 (comint-read-input-ring t)) |
24050 | 2970 |
2971 (defun sql-stop (process event) | |
2972 "Called when the SQL process is stopped. | |
2973 | |
24353
1ae2a12a85ee
(sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents:
24310
diff
changeset
|
2974 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
|
2975 `comint-write-input-ring' and inserts a short message in the SQL buffer. |
24050 | 2976 |
2977 This function is a sentinel watching the SQL interpreter process. | |
2978 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
|
2979 (comint-write-input-ring) |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2980 (if (and (eq (current-buffer) sql-buffer) |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2981 (not buffer-read-only)) |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2982 (insert (format "\nProcess %s %s\n" process event)) |
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
2983 (message "Process %s %s" process event))) |
24050 | 2984 |
2985 | |
2986 | |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2987 ;;; Connection handling |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2988 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2989 ;;;###autoload |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2990 (defun sql-connect (connection) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2991 "Connect to an interactive session using CONNECTION settings. |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2992 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2993 See `sql-connection-alist' to see how to define connections and |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2994 their settings. |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2995 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2996 The user will not be prompted for any login parameters if a value |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2997 is specified in the connection settings." |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2998 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
2999 ;; Prompt for the connection from those defined in the alist |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3000 (interactive |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3001 (if sql-connection-alist |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3002 (list |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3003 (let ((completion-ignore-case t)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3004 (completing-read "Connection: " |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3005 (mapcar (lambda (c) (car c)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3006 sql-connection-alist) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3007 nil t nil nil '(())))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3008 nil)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3009 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3010 ;; Are there connections defined |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3011 (if sql-connection-alist |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3012 ;; Was one selected |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3013 (when connection |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3014 ;; Get connection settings |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3015 (let ((connect-set (assoc connection sql-connection-alist))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3016 ;; Settings are defined |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3017 (if connect-set |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3018 ;; Set the desired parameters |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3019 (eval `(let* |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3020 (,@(cdr connect-set) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3021 ;; :sqli-login params variable |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3022 (param-var (sql-get-product-feature sql-product |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3023 :sqli-login nil t)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3024 ;; :sqli-login params value |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3025 (login-params (sql-get-product-feature sql-product |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3026 :sqli-login)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3027 ;; which params are in the connection |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3028 (set-params (mapcar |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3029 (lambda (v) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3030 (cond |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3031 ((eq (car v) 'sql-user) 'user) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3032 ((eq (car v) 'sql-password) 'password) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3033 ((eq (car v) 'sql-server) 'server) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3034 ((eq (car v) 'sql-database) 'database) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3035 ((eq (car v) 'sql-port) 'port) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3036 (t (car v)))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3037 (cdr connect-set))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3038 ;; the remaining params (w/o the connection params) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3039 (rem-params (sql-for-each-login |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3040 login-params |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3041 (lambda (token type arg) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3042 (unless (member token set-params) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3043 (if (or type arg) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3044 (list token type arg) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3045 token))))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3046 ;; Remember the connection |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3047 (sql-connection connection)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3048 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3049 ;; Set the remaining parameters and start the |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3050 ;; interactive session |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3051 (eval `(let ((,param-var ',rem-params)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3052 (sql-product-interactive sql-product))))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3053 (message "SQL Connection <%s> does not exist" connection) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3054 nil))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3055 (message "No SQL Connections defined") |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3056 nil)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3057 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3058 (defun sql-save-connection (name) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3059 "Captures the connection information of the current SQLi session. |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3060 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3061 The information is appended to `sql-connection-alist' and |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3062 optionally is saved to the user's init file." |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3063 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3064 (interactive "sNew connection name: ") |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3065 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3066 (if sql-connection |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3067 (message "This session was started by a connection; it's already been saved.") |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3068 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3069 (let ((login (sql-get-product-feature sql-product :sqli-login)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3070 (alist sql-connection-alist) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3071 connect) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3072 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3073 ;; Remove the existing connection if the user says so |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3074 (when (and (assoc name alist) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3075 (yes-or-no-p (format "Replace connection definition <%s>? " name))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3076 (setq alist (assq-delete-all name alist))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3077 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3078 ;; Add the new connection if it doesn't exist |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3079 (if (assoc name alist) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3080 (message "Connection <%s> already exists" name) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3081 (setq connect |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3082 (append (list name) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3083 (sql-for-each-login |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3084 `(product ,@login) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3085 (lambda (token type arg) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3086 (cond |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3087 ((eq token 'product) `(sql-product ',sql-product)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3088 ((eq token 'user) `(sql-user ,sql-user)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3089 ((eq token 'database) `(sql-database ,sql-database)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3090 ((eq token 'server) `(sql-server ,sql-server)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3091 ((eq token 'port) `(sql-port ,sql-port))))))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3092 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3093 (setq alist (append alist (list connect))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3094 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3095 ;; confirm whether we want to save the connections |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3096 (if (yes-or-no-p "Save the connections for future sessions? ") |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3097 (customize-save-variable 'sql-connection-alist alist) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3098 (customize-set-variable 'sql-connection-alist alist)))))) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3099 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3100 (defun sql-connection-menu-filter (tail) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3101 "Generates menu entries for using each connection." |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3102 (append |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3103 (mapcar |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3104 (lambda (conn) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3105 (vector |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3106 (format "Connection <%s>" (car conn)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3107 (list 'sql-connect (car conn)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3108 t)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3109 sql-connection-alist) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3110 tail)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3111 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3112 |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3113 |
24050 | 3114 ;;; Entry functions for different SQL interpreters. |
3115 | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3116 ;;;###autoload |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3117 (defun sql-product-interactive (&optional product) |
108381 | 3118 "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
|
3119 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3120 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
|
3121 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
|
3122 |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3123 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
108381 | 3124 (interactive "P") |
3125 | |
3126 (setq product | |
3127 (cond | |
3128 ((equal product '(4)) ; Universal arg, prompt for product | |
3129 (intern (completing-read "SQL product: " | |
3130 (mapcar (lambda (info) (symbol-name (car info))) | |
3131 sql-product-alist) | |
3132 nil 'require-match | |
3133 (or (and sql-product (symbol-name sql-product)) "ansi")))) | |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3134 ((and product ; Product specified |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3135 (symbolp product)) product) |
108381 | 3136 (t sql-product))) ; Default to sql-product |
3137 | |
109482
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3138 (if product |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3139 (when (sql-get-product-feature product :sqli-comint-func) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3140 (if (and sql-buffer |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3141 (buffer-live-p sql-buffer) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3142 (comint-check-proc sql-buffer)) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3143 (pop-to-buffer sql-buffer) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3144 |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3145 ;; Is the current buffer in sql-mode and |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3146 ;; there is a buffer local setting of sql-buffer |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3147 (let* ((start-buffer |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3148 (and (derived-mode-p 'sql-mode) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3149 (current-buffer))) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3150 (start-sql-buffer |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3151 (and start-buffer |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3152 (let (found) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3153 (dolist (var (buffer-local-variables)) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3154 (and (consp var) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3155 (eq (car var) 'sql-buffer) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3156 (buffer-live-p (cdr var)) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3157 (get-buffer-process (cdr var)) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3158 (setq found (cdr var)))) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3159 found))) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3160 new-sqli-buffer) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3161 |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3162 ;; Get credentials. |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3163 (apply 'sql-get-login (sql-get-product-feature product :sqli-login)) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3164 |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3165 ;; Connect to database. |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3166 (message "Login...") |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3167 (funcall (sql-get-product-feature product :sqli-comint-func) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3168 product |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3169 (sql-get-product-feature product :sqli-options)) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3170 |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3171 ;; Set SQLi mode. |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3172 (setq sql-interactive-product product |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3173 new-sqli-buffer (current-buffer) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3174 sql-buffer new-sqli-buffer) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3175 (sql-interactive-mode) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3176 |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3177 ;; Set `sql-buffer' in the start buffer |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3178 (when (and start-buffer (not start-sql-buffer)) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3179 (with-current-buffer start-buffer |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3180 (setq sql-buffer new-sqli-buffer))) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3181 |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3182 ;; All done. |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3183 (message "Login...done") |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3184 (pop-to-buffer sql-buffer)))) |
c9df47f7bbf3
SQL Mode V2.3 - cleanup connection handling
Michael Mauger <mmaug@yahoo.com>
parents:
109460
diff
changeset
|
3185 (message "No default SQL product defined. Set `sql-product'."))) |
108381 | 3186 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3187 (defun sql-comint (product params) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3188 "Set up a comint buffer to run the SQL processor. |
108381 | 3189 |
3190 PRODUCT is the SQL product. PARAMS is a list of strings which are | |
3191 passed as command line arguments." | |
3192 (let ((program (sql-get-product-feature product :sqli-program))) | |
3193 (set-buffer | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3194 (apply 'make-comint "SQL" program nil params)))) |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3195 |
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3196 ;;;###autoload |
24050 | 3197 (defun sql-oracle () |
3198 "Run sqlplus by Oracle as an inferior process. | |
3199 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3200 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 3201 If buffer exists and a process is running, just switch to buffer |
3202 `*SQL*'. | |
3203 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3204 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
|
3205 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
|
3206 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
|
3207 the list `sql-oracle-options'. |
24050 | 3208 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3209 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 3210 input. See `sql-interactive-mode'. |
3211 | |
3212 To specify a coding system for converting non-ASCII characters | |
3213 in the input and output to the process, use \\[universal-coding-system-argument] | |
3214 before \\[sql-oracle]. You can also specify this with \\[set-buffer-process-coding-system] | |
3215 in the SQL buffer, after you start the process. | |
3216 The default comes from `process-coding-system-alist' and | |
3217 `default-process-coding-system'. | |
3218 | |
3219 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
3220 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3221 (sql-product-interactive 'oracle)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3222 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3223 (defun sql-comint-oracle (product options) |
108381 | 3224 "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
|
3225 ;; 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
|
3226 ;; 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
|
3227 ;; 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
|
3228 ;; "param". |
108381 | 3229 (let ((parameter nil)) |
3230 (if (not (string= "" sql-user)) | |
3231 (if (not (string= "" sql-password)) | |
3232 (setq parameter (concat sql-user "/" sql-password)) | |
3233 (setq parameter sql-user))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3234 (if (and parameter (not (string= "" sql-database))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3235 (setq parameter (concat parameter "@" sql-database))) |
108381 | 3236 (if parameter |
3237 (setq parameter (nconc (list parameter) options)) | |
3238 (setq parameter options)) | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3239 (sql-comint product parameter))) |
24050 | 3240 |
3241 | |
3242 | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3243 ;;;###autoload |
24050 | 3244 (defun sql-sybase () |
108569
6e7ebe021a2c
* progmodes/sql.el: Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
108381
diff
changeset
|
3245 "Run isql by Sybase as an inferior process. |
24050 | 3246 |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3247 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 3248 If buffer exists and a process is running, just switch to buffer |
3249 `*SQL*'. | |
3250 | |
3251 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
|
3252 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
|
3253 `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
|
3254 can be stored in the list `sql-sybase-options'. |
24050 | 3255 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3256 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 3257 input. See `sql-interactive-mode'. |
3258 | |
3259 To specify a coding system for converting non-ASCII characters | |
3260 in the input and output to the process, use \\[universal-coding-system-argument] | |
3261 before \\[sql-sybase]. You can also specify this with \\[set-buffer-process-coding-system] | |
3262 in the SQL buffer, after you start the process. | |
3263 The default comes from `process-coding-system-alist' and | |
3264 `default-process-coding-system'. | |
3265 | |
3266 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
3267 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3268 (sql-product-interactive 'sybase)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3269 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3270 (defun sql-comint-sybase (product options) |
108381 | 3271 "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
|
3272 ;; 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
|
3273 ;; make-comint. |
108381 | 3274 (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3275 (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3276 (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
|
3277 (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3278 (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
|
3279 (if (not (string= "" sql-password)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3280 (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
|
3281 (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3282 (setq params (append (list "-U" sql-user) params))) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3283 (sql-comint product params))) |
24050 | 3284 |
3285 | |
3286 | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3287 ;;;###autoload |
24050 | 3288 (defun sql-informix () |
3289 "Run dbaccess by Informix as an inferior process. | |
3290 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3291 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 3292 If buffer exists and a process is running, just switch to buffer |
3293 `*SQL*'. | |
3294 | |
3295 Interpreter used comes from variable `sql-informix-program'. Login uses | |
3296 the variable `sql-database' as default, if set. | |
3297 | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3298 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 3299 input. See `sql-interactive-mode'. |
3300 | |
3301 To specify a coding system for converting non-ASCII characters | |
3302 in the input and output to the process, use \\[universal-coding-system-argument] | |
3303 before \\[sql-informix]. You can also specify this with \\[set-buffer-process-coding-system] | |
3304 in the SQL buffer, after you start the process. | |
3305 The default comes from `process-coding-system-alist' and | |
3306 `default-process-coding-system'. | |
3307 | |
3308 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
3309 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3310 (sql-product-interactive 'informix)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3311 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3312 (defun sql-comint-informix (product options) |
108381 | 3313 "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
|
3314 ;; username and password are ignored. |
108381 | 3315 (let ((db (if (string= "" sql-database) |
3316 "-" | |
3317 (if (string= "" sql-server) | |
3318 sql-database | |
3319 (concat sql-database "@" sql-server))))) | |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3320 (sql-comint product (append `(,db "-") options)))) |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3321 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3322 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3323 |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3324 ;;;###autoload |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3325 (defun sql-sqlite () |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3326 "Run sqlite as an inferior process. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3327 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3328 SQLite is free software. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3329 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3330 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
|
3331 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
|
3332 `*SQL*'. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3333 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3334 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
|
3335 the variables `sql-user', `sql-password', `sql-database', and |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3336 `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
|
3337 can be stored in the list `sql-sqlite-options'. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3338 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3339 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
|
3340 input. See `sql-interactive-mode'. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3341 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3342 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
|
3343 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
|
3344 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
|
3345 in the SQL buffer, after you start the process. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3346 The default comes from `process-coding-system-alist' and |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3347 `default-process-coding-system'. |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3348 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3349 \(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
|
3350 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3351 (sql-product-interactive 'sqlite)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3352 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3353 (defun sql-comint-sqlite (product options) |
108381 | 3354 "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
|
3355 ;; 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
|
3356 ;; make-comint. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3357 (let ((params)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3358 (if (not (string= "" sql-database)) |
109489
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3359 (setq params (append (list (expand-file-name sql-database)) |
b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
Michael Mauger <mmaug@yahoo.com>
parents:
109482
diff
changeset
|
3360 params))) |
108381 | 3361 (setq params (append options params)) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3362 (sql-comint product params))) |
51607
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3363 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3364 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3365 |
ead411a37669
Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents:
48486
diff
changeset
|
3366 ;;;###autoload |
24267
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3367 (defun sql-mysql () |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3368 "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
|
3369 |
40432
225bd38b0ce7
(sql-mysql): Doc change by RMS.
Gerd Moellmann <gerd@gnu.org>
parents:
38872
diff
changeset
|
3370 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
|
3371 |
24268 | 3372 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
|
3373 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
|
3374 `*SQL*'. |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3375 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3376 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
|
3377 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
|
3378 `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
|
3379 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
|
3380 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3381 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
|
3382 input. See `sql-interactive-mode'. |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3383 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3384 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
|
3385 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
|
3386 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
|
3387 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
|
3388 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
|
3389 `default-process-coding-system'. |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3390 |
f40837b25999
Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents:
24058
diff
changeset
|
3391 \(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
|
3392 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3393 (sql-product-interactive 'mysql)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3394 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3395 (defun sql-comint-mysql (product options) |
108381 | 3396 "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
|
3397 ;; 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
|
3398 ;; make-comint. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3399 (let ((params)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3400 (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3401 (setq params (append (list sql-database) params))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3402 (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3403 (setq params (append (list (concat "--host=" sql-server)) params))) |
108991
b2a9d4e48488
* lisp/progmodes/sql.el (sql-connect-mysql): Fix typo.
Glenn Morris <rgm@gnu.org>
parents:
108569
diff
changeset
|
3404 (if (and sql-port (numberp sql-port)) |
108381 | 3405 (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
|
3406 (if (not (string= "" sql-password)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3407 (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
|
3408 (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3409 (setq params (append (list (concat "--user=" sql-user)) params))) |
108381 | 3410 (setq params (append options params)) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3411 (sql-comint product params))) |
24050 | 3412 |
3413 | |
3414 | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3415 ;;;###autoload |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3416 (defun sql-solid () |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3417 "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
|
3418 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3419 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
|
3420 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
|
3421 `*SQL*'. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3422 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3423 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
|
3424 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
|
3425 defaults, if set. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3426 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3427 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
|
3428 input. See `sql-interactive-mode'. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3429 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3430 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
|
3431 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
|
3432 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
|
3433 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
|
3434 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
|
3435 `default-process-coding-system'. |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3436 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3437 \(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
|
3438 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3439 (sql-product-interactive 'solid)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3440 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3441 (defun sql-comint-solid (product options) |
108381 | 3442 "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
|
3443 ;; 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
|
3444 ;; make-comint. |
108381 | 3445 (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3446 ;; 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
|
3447 (if (not (or (string= "" sql-user) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3448 (string= "" sql-password))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3449 (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
|
3450 (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3451 (setq params (append (list sql-server) params))) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3452 (sql-comint product params))) |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3453 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3454 |
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3455 |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3456 ;;;###autoload |
24050 | 3457 (defun sql-ingres () |
3458 "Run sql by Ingres as an inferior process. | |
3459 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3460 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 3461 If buffer exists and a process is running, just switch to buffer |
3462 `*SQL*'. | |
3463 | |
3464 Interpreter used comes from variable `sql-ingres-program'. Login uses | |
3465 the variable `sql-database' as default, if set. | |
3466 | |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3467 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 3468 input. See `sql-interactive-mode'. |
3469 | |
3470 To specify a coding system for converting non-ASCII characters | |
3471 in the input and output to the process, use \\[universal-coding-system-argument] | |
3472 before \\[sql-ingres]. You can also specify this with \\[set-buffer-process-coding-system] | |
3473 in the SQL buffer, after you start the process. | |
3474 The default comes from `process-coding-system-alist' and | |
3475 `default-process-coding-system'. | |
3476 | |
3477 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
3478 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3479 (sql-product-interactive 'ingres)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3480 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3481 (defun sql-comint-ingres (product options) |
108381 | 3482 "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
|
3483 ;; username and password are ignored. |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3484 (sql-comint product |
108381 | 3485 (append (if (string= "" sql-database) |
3486 nil | |
3487 (list sql-database)) | |
3488 options))) | |
24050 | 3489 |
3490 | |
3491 | |
30513
12162d90d9e4
(sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
29937
diff
changeset
|
3492 ;;;###autoload |
24050 | 3493 (defun sql-ms () |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3494 "Run osql by Microsoft as an inferior process. |
24050 | 3495 |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3496 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 3497 If buffer exists and a process is running, just switch to buffer |
3498 `*SQL*'. | |
3499 | |
3500 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
|
3501 variables `sql-user', `sql-password', `sql-database', and `sql-server' |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3502 as defaults, if set. Additional command line parameters can be stored |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3503 in the list `sql-ms-options'. |
24050 | 3504 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3505 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 3506 input. See `sql-interactive-mode'. |
3507 | |
3508 To specify a coding system for converting non-ASCII characters | |
3509 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
|
3510 before \\[sql-ms]. You can also specify this with \\[set-buffer-process-coding-system] |
24050 | 3511 in the SQL buffer, after you start the process. |
3512 The default comes from `process-coding-system-alist' and | |
3513 `default-process-coding-system'. | |
3514 | |
3515 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
3516 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3517 (sql-product-interactive 'ms)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3518 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3519 (defun sql-comint-ms (product options) |
108381 | 3520 "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
|
3521 ;; 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
|
3522 ;; make-comint. |
108381 | 3523 (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3524 (if (not (string= "" sql-server)) |
24050 | 3525 (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
|
3526 (if (not (string= "" sql-database)) |
24050 | 3527 (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
|
3528 (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3529 (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
|
3530 (if (not (string= "" sql-password)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3531 (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
|
3532 (if (string= "" sql-user) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3533 ;; 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
|
3534 ;; credentials. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3535 (setq params (append (list "-E") params)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3536 ;; 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
|
3537 ;; password, it's considered null. |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3538 (setq params (append params (list "-P"))))) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3539 (sql-comint product params))) |
24050 | 3540 |
3541 | |
3542 | |
3543 ;;;###autoload | |
3544 (defun sql-postgres () | |
3545 "Run psql by Postgres as an inferior process. | |
3546 | |
24310
e76bade08723
Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents:
24268
diff
changeset
|
3547 If buffer `*SQL*' exists but no process is running, make a new process. |
24050 | 3548 If buffer exists and a process is running, just switch to buffer |
3549 `*SQL*'. | |
3550 | |
3551 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
|
3552 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
|
3553 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
|
3554 `sql-postgres-options'. |
24050 | 3555 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3556 The buffer is put in SQL interactive mode, giving commands for sending |
24050 | 3557 input. See `sql-interactive-mode'. |
3558 | |
3559 To specify a coding system for converting non-ASCII characters | |
3560 in the input and output to the process, use \\[universal-coding-system-argument] | |
3561 before \\[sql-postgres]. You can also specify this with \\[set-buffer-process-coding-system] | |
3562 in the SQL buffer, after you start the process. | |
3563 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
|
3564 `default-process-coding-system'. If your output lines end with ^M, |
24050 | 3565 your might try undecided-dos as a coding system. If this doesn't help, |
3566 Try to set `comint-output-filter-functions' like this: | |
3567 | |
3568 \(setq comint-output-filter-functions (append comint-output-filter-functions | |
3569 '(comint-strip-ctrl-m))) | |
3570 | |
3571 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | |
3572 (interactive) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3573 (sql-product-interactive 'postgres)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3574 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3575 (defun sql-comint-postgres (product options) |
108381 | 3576 "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
|
3577 ;; 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
|
3578 ;; 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
|
3579 ;; 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
|
3580 ;; 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
|
3581 ;; sql-postgres-options. |
108381 | 3582 (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3583 (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3584 (setq params (append params (list sql-database)))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3585 (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3586 (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
|
3587 (if (not (string= "" sql-user)) |
cebca4e25fae
(sql-product-alist): Rename variable `sql-product-support'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52482
diff
changeset
|
3588 (setq params (append (list "-U" sql-user) params))) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3589 (sql-comint product params))) |
24050 | 3590 |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3591 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3592 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3593 ;;;###autoload |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3594 (defun sql-interbase () |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3595 "Run isql by Interbase as an inferior process. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3596 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3597 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
|
3598 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
|
3599 `*SQL*'. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3600 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3601 Interpreter used comes from variable `sql-interbase-program'. Login |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3602 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
|
3603 defaults, if set. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3604 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3605 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
|
3606 input. See `sql-interactive-mode'. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3607 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3608 To specify a coding system for converting non-ASCII characters |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3609 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
|
3610 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
|
3611 in the SQL buffer, after you start the process. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3612 The default comes from `process-coding-system-alist' and |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3613 `default-process-coding-system'. |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3614 |
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3615 \(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
|
3616 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3617 (sql-product-interactive 'interbase)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3618 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3619 (defun sql-comint-interbase (product options) |
108381 | 3620 "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
|
3621 ;; 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
|
3622 ;; make-comint. |
108381 | 3623 (let ((params options)) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3624 (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3625 (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
|
3626 (if (not (string= "" sql-password)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3627 (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
|
3628 (if (not (string= "" sql-database)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3629 (setq params (cons sql-database params))) ; add to the front! |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3630 (sql-comint product params))) |
36571
54a8a84a22f6
(sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36523
diff
changeset
|
3631 |
37409
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3632 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3633 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3634 ;;;###autoload |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3635 (defun sql-db2 () |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3636 "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
|
3637 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3638 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
|
3639 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
|
3640 `*SQL*'. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3641 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3642 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
|
3643 automatic login. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3644 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3645 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
|
3646 input. See `sql-interactive-mode'. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3647 |
38872 | 3648 If you use \\[sql-accumulate-and-indent] to send multiline commands to |
3649 db2, newlines will be escaped if necessary. If you don't want that, set | |
3650 `comint-input-sender' back to `comint-simple-send' by writing an after | |
3651 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
|
3652 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3653 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
|
3654 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
|
3655 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
|
3656 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
|
3657 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
|
3658 `default-process-coding-system'. |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3659 |
9781f3a3c955
(sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36571
diff
changeset
|
3660 \(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
|
3661 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3662 (sql-product-interactive 'db2)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3663 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3664 (defun sql-comint-db2 (product options) |
108381 | 3665 "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
|
3666 ;; 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
|
3667 ;; make-comint. |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3668 (sql-comint product options) |
108381 | 3669 ) |
3670 ;; ;; Properly escape newlines when DB2 is interactive. | |
3671 ;; (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
|
3672 |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3673 ;;;###autoload |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3674 (defun sql-linter () |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3675 "Run inl by RELEX as an inferior process. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3676 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3677 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
|
3678 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
|
3679 `*SQL*'. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3680 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3681 Interpreter used comes from variable `sql-linter-program' - usually `inl'. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3682 Login uses the variables `sql-user', `sql-password', `sql-database' and |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3683 `sql-server' as defaults, if set. Additional command line parameters |
108381 | 3684 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
|
3685 parameters. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3686 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3687 `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
|
3688 local connections, `sql-server' refers to the server name from the |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3689 `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
|
3690 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
|
3691 an empty password. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3692 |
108352
cf2043af9228
* progmodes/sql.el: Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
3693 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
|
3694 input. See `sql-interactive-mode'. |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3695 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3696 \(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
|
3697 (interactive) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3698 (sql-product-interactive 'linter)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3699 |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3700 (defun sql-comint-linter (product options) |
108381 | 3701 "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
|
3702 ;; 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
|
3703 ;; make-comint. |
108381 | 3704 (let ((params options) |
3705 (login nil) | |
3706 (old-mbx (getenv "LINTER_MBX"))) | |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3707 (if (not (string= "" sql-user)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3708 (setq login (concat sql-user "/" sql-password))) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3709 (setq params (append (list "-u" login) params)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3710 (if (not (string= "" sql-server)) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3711 (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
|
3712 (if (string= "" sql-database) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3713 (setenv "LINTER_MBX" nil) |
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3714 (setenv "LINTER_MBX" sql-database)) |
109460
597339bd6bef
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
Michael Mauger <mmaug@yahoo.com>
parents:
108991
diff
changeset
|
3715 (sql-comint product params) |
52242
f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents:
51929
diff
changeset
|
3716 (setenv "LINTER_MBX" old-mbx))) |
48486
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3717 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3718 |
893d44670df9
Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents:
42799
diff
changeset
|
3719 |
24050 | 3720 (provide 'sql) |
3721 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
3722 ;; arch-tag: 7e1fa1c4-9ca2-402e-87d2-83a5eccb7ac3 |
24050 | 3723 ;;; sql.el ends here |
108381 | 3724 |