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