annotate lisp/progmodes/sql.el @ 89804:109e674576b8

(CHAR_CHARSET_P): Fix for the case that the method is subset or superset.
author Kenichi Handa <handa@m17n.org>
date Fri, 06 Feb 2004 11:05:20 +0000
parents 375f2633d815
children 68c22ea6027c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; sql.el --- specialized comint.el for SQL interpreters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
25381
970b18c6803f (sql-sybase): use sql-server instead of sql-database.
Alex Schroeder <alex@gnu.org>
parents: 25183
diff changeset
5 ;; Author: Alex Schroeder <alex@gnu.org>
970b18c6803f (sql-sybase): use sql-server instead of sql-database.
Alex Schroeder <alex@gnu.org>
parents: 25183
diff changeset
6 ;; Maintainer: Alex Schroeder <alex@gnu.org>
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
7 ;; Version: 1.7.0
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
8 ;; Keywords: comm languages processes
38872
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
9 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; any later version.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; GNU General Public License for more details.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;;; Commentary:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
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
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
31 ;; sql.el@gnu.org. If you want to subscribe to the mailing list, send
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
32 ;; mail to sql.el-request@gnu.org with `subscribe sql.el FIRSTNAME
25381
970b18c6803f (sql-sybase): use sql-server instead of sql-database.
Alex Schroeder <alex@gnu.org>
parents: 25183
diff changeset
33 ;; LASTNAME' in the mail body.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; This file provides a sql-mode and a sql-interactive-mode. My goals
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; were two simple modes providing syntactic hilighting. The
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; interactive mode had to provide a command-line history; the other
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; mode had to provide "send region/buffer to SQL interpreter"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; functions. "simple" in this context means easy to use, easy to
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
40 ;; maintain and little or no bells and whistles.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; If anybody feels like extending this sql mode, take a look at the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; above mentioned modes and write a sqlx-mode on top of this one. If
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; this proves to be difficult, please suggest changes that will
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; facilitate your plans.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; 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
48 ;; process in a SQLi buffer (usually called `*SQL*'). The SQLi buffer
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
49 ;; is created by calling a SQL interpreter-specific entry function. Do
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
50 ;; *not* call sql-interactive-mode by itself.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; 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
53 ;; entry function used to create the SQLi buffers is shown with
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;; `sql-help' (M-x sql-help).
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; Since sql-interactive-mode is built on top of the general
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;; command-interpreter-in-a-buffer mode (comint mode), it shares a
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;; common base functionality, and a common set of bindings, with all
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; modes derived from comint mode. This makes these modes easier to
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; use.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
62 ;; 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
63 ;; statements can be sent to the SQL process in the SQLi buffer.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;; 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
66 ;; the hooks available for customizing it, see the file `comint.el'.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
68 ;; 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
69 ;; `imenu-add-menubar-index'.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;;; Requirements for Emacs 19.34:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;; If you are using Emacs 19.34, you will have to get and install
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;; the file regexp-opt.el
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;; <URL:ftp://ftp.ifi.uio.no/pub/emacs/emacs-20.3/lisp/emacs-lisp/regexp-opt.el>
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;; and the custom package
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ;; <URL:http://www.dina.kvl.dk/~abraham/custom/>.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ;;; Bugs:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
81 ;; Using sql-ms (isql by Microsoft): When commands with syntax errors
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
82 ;; or execution errors are executed, there is no server feedback.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
83 ;; This happens in stored procedures for example. The server messages
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
84 ;; only appear after the process is exited. This makes things
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
85 ;; somewhat unreliable.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
87 ;; ChangeLog available on request.
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
88
51929
3da2cf447bf9 Revert last change.
Juanma Barranquero <lekktu@gmail.com>
parents: 51893
diff changeset
89 ;;; To Do:
51893
1a294cfb1636 Version 1.8.0 of sql-mode.
Juanma Barranquero <lekktu@gmail.com>
parents: 51607
diff changeset
90
51929
3da2cf447bf9 Revert last change.
Juanma Barranquero <lekktu@gmail.com>
parents: 51893
diff changeset
91 ;; Add better hilight support for other brands; there is a bias towards
3da2cf447bf9 Revert last change.
Juanma Barranquero <lekktu@gmail.com>
parents: 51893
diff changeset
92 ;; Oracle because that's what I use at work. Anybody else just send in
3da2cf447bf9 Revert last change.
Juanma Barranquero <lekktu@gmail.com>
parents: 51893
diff changeset
93 ;; your lists of reserved words, keywords and builtin functions! As
3da2cf447bf9 Revert last change.
Juanma Barranquero <lekktu@gmail.com>
parents: 51893
diff changeset
94 ;; long as I don't receive any feedback, everything is hilighted with
3da2cf447bf9 Revert last change.
Juanma Barranquero <lekktu@gmail.com>
parents: 51893
diff changeset
95 ;; ANSI keywords only. I received the list of ANSI keywords from a
3da2cf447bf9 Revert last change.
Juanma Barranquero <lekktu@gmail.com>
parents: 51893
diff changeset
96 ;; user; if you know of any changes, let me know.
51893
1a294cfb1636 Version 1.8.0 of sql-mode.
Juanma Barranquero <lekktu@gmail.com>
parents: 51607
diff changeset
97
51929
3da2cf447bf9 Revert last change.
Juanma Barranquero <lekktu@gmail.com>
parents: 51893
diff changeset
98 ;; Add different hilighting levels.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 ;;; Thanks to all the people who helped me out:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 ;; Kai Blauberg <kai.blauberg@metla.fi>
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;; <ibalaban@dalet.com>
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 ;; Yair Friedman <yfriedma@JohnBryce.Co.Il>
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 ;; 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
106 ;; nino <nino@inform.dk>
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
107 ;; Berend de Boer <berend@pobox.com>
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
108
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 ;;; Code:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (require 'comint)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 ;; Need the following to allow GNU Emacs 19 to compile the file.
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
115 (require 'regexp-opt)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (require 'custom)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 ;;; Allow customization
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (defgroup SQL nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 "Running a SQL interpreter from within Emacs buffers"
24556
cfdf441b1331 Add defgroup :version.
Dave Love <fx@gnu.org>
parents: 24354
diff changeset
122 :version "20.4"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 :group 'processes)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
125 ;; These three variables will be used as defaults, if set.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (defcustom sql-user ""
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 "*Default username."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 :type 'string
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (defcustom sql-password ""
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 "*Default password.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 Storing your password in a textfile such as ~/.emacs could be dangerous.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 Customizing your password will store it in your ~/.emacs file."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 :type 'string
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (defcustom sql-database ""
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 "*Default database."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 :type 'string
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (defcustom sql-server ""
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
146 "*Default server or host."
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 :type 'string
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
150 ;; misc customization of sql.el behaviour
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
151
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
152 (defcustom sql-electric-stuff nil
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
153 "Treat some input as electric.
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
154 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
155 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
156 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
157 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
158 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
159 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
160 :type '(choice (const :tag "Nothing" nil)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
161 (const :tag "The semikolon `;'" semicolon)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
162 (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
163 :version "20.8"
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
164 :group 'SQL)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
165
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (defcustom sql-pop-to-buffer-after-send-region nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 "*If t, pop to the buffer SQL statements are sent to.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 After a call to `sql-send-region' or `sql-send-buffer',
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 the window is split and the SQLi buffer is shown. If this
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
171 variable is not nil, that buffer's window will be selected
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
172 by calling `pop-to-buffer'. If this variable is nil, that
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
173 buffer is shown using `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
174 :type 'boolean
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
175 :group 'SQL)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
176
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
177 ;; imenu support for sql-mode.
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
178
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
179 (defvar sql-imenu-generic-expression
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
180 '(("Tables" "^\\s-*create\\s-+table\\s-+\\(\\w+\\)" 1)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
181 ("Indexes" "^\\s-*create\\s-+index\\s-+\\(\\w+\\)" 1))
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
182 "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
183
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
184 This is used to set `imenu-generic-expression' when SQL mode is
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
185 entered. Subsequent changes to sql-imenu-generic-expression will not
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
186 affect existing SQL buffers because imenu-generic-expression is a
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
187 local variable.")
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
188
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
189 ;; history file
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
190
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
191 (defcustom sql-input-ring-file-name nil
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
192 "*If non-nil, name of the file to read/write input history.
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
193
24861
0d593aa15c0f (sql-input-ring-file-name): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 24591
diff changeset
194 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
195 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
196 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
197 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
198 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
199
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
200 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
201
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
202 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
203 `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
204 :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
205 (file))
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
206 :group 'SQL)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
207
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
208 (defcustom sql-input-ring-separator "\n--\n"
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
209 "*Separator between commands in the history file.
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
210
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
211 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
212 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
213 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
214
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
215 This variable used to initialize `comint-input-ring-separator'.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
216 `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
217 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
218 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
219 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
220 `sql-input-ring-separator' to \"\\n\"."
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 :type 'string
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 ;; The usual hooks
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 (defcustom sql-interactive-mode-hook '()
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
227 "*Hook for customizing `sql-interactive-mode'."
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 :type 'hook
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 (defcustom sql-mode-hook '()
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
232 "*Hook for customizing `sql-mode'."
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 :type 'hook
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
236 (defcustom sql-set-sqli-hook '()
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
237 "*Hook for reacting to changes 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
238
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
239 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
240 is changed."
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
241 :type 'hook
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
242 :group 'SQL)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
243
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
244 ;; Customization for Oracle
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 (defcustom sql-oracle-program "sqlplus"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 "*Command to start sqlplus by Oracle.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 Under NT, \"sqlplus\" usually starts the sqlplus \"GUI\". In order to
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 start the sqlplus console, use \"plus33\" or something similar. You
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 will find the file in your Orant\\bin directory.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
259 (defcustom sql-oracle-options nil
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
260 "*List of additional options for `sql-oracle-program'."
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
261 :type '(repeat string)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
262 :version "20.8"
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
263 :group 'SQL)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
264
51607
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
265 ;; Customization for SQLite
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
266
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
267 (defcustom sql-sqlite-program "sqlite"
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
268 "*Command to start SQLite.
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
269
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
270 Starts `sql-interactive-mode' after doing some setup.
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
271
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
272 The program can also specify a TCP connection. See `make-comint'."
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
273 :type 'file
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
274 :group 'SQL)
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
275
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
276 (defcustom sql-sqlite-options nil
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
277 "*List of additional options for `sql-mysql-program'.
51607
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
278 The following list of options is reported to make things work
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
279 on Windows: \"-C\" \"-t\" \"-f\" \"-n\"."
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
280 :type '(repeat string)
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
281 :version "20.8"
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
282 :group 'SQL)
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
283
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
284 ;; Customization for MySql
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
285
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
286 (defcustom sql-mysql-program "mysql"
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
287 "*Command to start mysql by TcX.
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
288
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
289 Starts `sql-interactive-mode' after doing some setup.
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
290
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
291 The program can also specify a TCP connection. See `make-comint'."
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
292 :type 'file
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
293 :group 'SQL)
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
294
32169
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
295 (defcustom sql-mysql-options nil
34704
7cb3b80e66b8 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32621
diff changeset
296 "*List of additional options for `sql-mysql-program'.
7cb3b80e66b8 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32621
diff changeset
297 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
298 on Windows: \"-C\" \"-t\" \"-f\" \"-n\"."
32169
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
299 :type '(repeat string)
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
300 :version "20.8"
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
301 :group 'SQL)
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
302
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
303 ;; Customization for Solid
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
304
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
305 (defcustom sql-solid-program "solsql"
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
306 "*Command to start SOLID SQL Editor.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
307
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
308 Starts `sql-interactive-mode' after doing some setup.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
309
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
310 The program can also specify a TCP connection. See `make-comint'."
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
311 :type 'file
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
312 :group 'SQL)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
313
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
314 ;; Customization for SyBase
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 (defcustom sql-sybase-program "isql"
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
317 "*Command to start isql by SyBase.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324
32621
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
325 (defcustom sql-sybase-options nil
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
326 "*List of additional options for `sql-sybase-program'.
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
327 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
328 :type '(repeat string)
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
329 :version "20.8"
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
330 :group 'SQL)
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
331
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
332 ;; Customization for Informix
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 (defcustom sql-informix-program "dbaccess"
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
335 "*Command to start dbaccess by Informix.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
343 ;; Customization for Ingres
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 (defcustom sql-ingres-program "sql"
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
346 "*Command to start sql by Ingres.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
354 ;; Customization for Microsoft
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
356 (defcustom sql-ms-program "isql"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
357 "*Command to start isql by Microsoft.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
365 (defcustom sql-ms-options '("-w" "300" "-n")
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
366 ;; -w is the linesize
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
367 "*List of additional options for `sql-ms-program'."
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
368 :type '(repeat string)
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
369 :version "21.4"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
370 :group 'SQL)
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
371
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
372 ;; Customization for Postgres
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 (defcustom sql-postgres-program "psql"
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
375 "Command to start psql by Postgres.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382
34704
7cb3b80e66b8 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32621
diff changeset
383 (defcustom sql-postgres-options '("-P" "pager=off")
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
384 "*List of additional options for `sql-postgres-program'.
38872
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
385 The default setting includes the -P option which breaks older versions
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
386 of the psql client (such as version 6.5.3). The -P option is equivalent
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
387 to the --pset option. If you want the psql to prompt you for a user
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
388 name, add the string \"-u\" to the list of options. If you want to
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
389 provide a user name on the command line (newer versions such as 7.1),
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
390 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
391 :type '(repeat string)
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
392 :version "20.8"
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
393 :group 'SQL)
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
394
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
395 ;; Customization for Interbase
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
396
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
397 (defcustom sql-interbase-program "isql"
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
398 "*Command to start isql by Interbase.
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
399
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
400 Starts `sql-interactive-mode' after doing some setup.
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
401
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
402 The program can also specify a TCP connection. See `make-comint'."
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
403 :type 'file
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
404 :group 'SQL)
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
405
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
406 (defcustom sql-interbase-options nil
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
407 "*List of additional options for `sql-interbase-program'."
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
408 :type '(repeat string)
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
409 :version "20.8"
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
410 :group 'SQL)
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
411
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
412 ;; Customization for DB2
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
413
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
414 (defcustom sql-db2-program "db2"
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
415 "*Command to start db2 by IBM.
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
416
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
417 Starts `sql-interactive-mode' after doing some setup.
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
418
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
419 The program can also specify a TCP connection. See `make-comint'."
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
420 :type 'file
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
421 :group 'SQL)
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
422
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
423 (defcustom sql-db2-options nil
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
424 "*List of additional options for `sql-db2-program'."
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
425 :type '(repeat string)
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
426 :version "20.8"
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
427 :group 'SQL)
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
428
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
429 ;; Customization for Linter
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
430
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
431 (defcustom sql-linter-program "inl"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
432 "*Command to start inl by RELEX.
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
433
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
434 Starts `sql-interactive-mode' after doing some setup."
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
435 :type 'file
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
436 :group 'SQL)
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
437
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
438 (defcustom sql-linter-options nil
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
439 "*List of additional options for `sql-linter-program'."
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
440 :type '(repeat string)
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
441 :version "21.3"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
442 :group 'SQL)
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
443
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 ;;; Variables which do not need customization
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 (defvar sql-user-history nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449 "History of usernames used.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 (defvar sql-database-history nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 "History of databases used.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 (defvar sql-server-history nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 "History of servers used.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 ;; Passwords are not kept in a history.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 (defvar sql-buffer nil
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
460 "Current SQLi buffer.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
461
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
462 The global value of sql-buffer is the name of the latest SQLi buffer
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
463 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
464 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
465 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
466 the local value of `sql-buffer' using \\[sql-set-sqli-buffer].")
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 (defvar sql-prompt-regexp nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 "Prompt used to initialize `comint-prompt-regexp'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
471 You can change `comint-prompt-regexp' on `sql-interactive-mode-hook'.")
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
473 (defvar sql-prompt-length 0
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
474 "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
475
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
476 You can change it on `sql-interactive-mode-hook'.")
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
477
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
478 (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
479 "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
480
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
481 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
482
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
483 ;; Keymap for sql-interactive-mode.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
485 (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
486 (let ((map (make-sparse-keymap)))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
487 (if (functionp 'set-keymap-parent)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
488 (set-keymap-parent map comint-mode-map); Emacs
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
489 (set-keymap-parents map (list comint-mode-map))); XEmacs
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
490 (if (functionp 'set-keymap-name)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
491 (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
492 (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
493 (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
494 (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
495 (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
496 (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
497 map)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
498 "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
499 Based on `comint-mode-map'.")
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 ;; Keymap for sql-mode.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 (defvar sql-mode-map
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 (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
505 (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
506 (define-key map (kbd "C-c C-r") 'sql-send-region)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
507 (define-key map (kbd "C-c C-b") 'sql-send-buffer)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 map)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 "Mode map used for `sql-mode'.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 ;; easy menu for sql-mode.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
513 (easy-menu-define
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
514 sql-mode-menu sql-mode-map
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 "Menu for `sql-mode'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 '("SQL"
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
517 ["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
518 (get-buffer-process sql-buffer))]
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
519 ["Send Region" sql-send-region (and (or (and (boundp 'mark-active); Emacs
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
520 mark-active)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
521 (mark)); XEmacs
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
522 (buffer-live-p sql-buffer)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
523 (get-buffer-process sql-buffer))]
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
524 ["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
525 (get-buffer-process sql-buffer))]
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
526 ["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
527 ["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
528 ["Pop to SQLi buffer after send"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 sql-toggle-pop-to-buffer-after-send-region
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 :style toggle
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
531 :selected sql-pop-to-buffer-after-send-region]
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
532 ("Highlighting"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
533 ["ANSI SQL keywords" sql-highlight-ansi-keywords t]
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
534 ["Oracle keywords" sql-highlight-oracle-keywords t]
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
535 ["Postgres keywords" sql-highlight-postgres-keywords t]
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
536 ["Linter keywords" sql-highlight-linter-keywords t]
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
537 )))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
539 ;; 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
540
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
541 (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
542 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
543 "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
544 '("SQL"
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
545 ["Rename Buffer" sql-rename-buffer t]))
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
546
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 ;; Abbreviations -- if you want more of them, define them in your
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 ;; ~/.emacs file. Abbrevs have to be enabled in your ~/.emacs, too.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 (defvar sql-mode-abbrev-table nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 "Abbrev table used in `sql-mode' and `sql-interactive-mode'.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 (if sql-mode-abbrev-table
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 ()
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
554 (let ((wrapper))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
555 (define-abbrev-table 'sql-mode-abbrev-table ())
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
556 (define-abbrev sql-mode-abbrev-table "ins" "insert")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
557 (define-abbrev sql-mode-abbrev-table "upd" "update")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
558 (define-abbrev sql-mode-abbrev-table "del" "delete")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
559 (define-abbrev sql-mode-abbrev-table "sel" "select")))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 ;; Syntax Table
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
563 (defvar sql-mode-syntax-table
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 (let ((table (make-syntax-table)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 ;; C-style comments /**/ (see elisp manual "Syntax Flags"))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 (modify-syntax-entry ?/ ". 14" table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 (modify-syntax-entry ?* ". 23" table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 ;; double-dash starts comment
24354
6a438ef0b573 Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents: 24353
diff changeset
569 (if (string-match "XEmacs\\|Lucid" emacs-version)
6a438ef0b573 Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents: 24353
diff changeset
570 (modify-syntax-entry ?- ". 56" table)
6a438ef0b573 Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents: 24353
diff changeset
571 (modify-syntax-entry ?- ". 12b" table))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 ;; newline and formfeed end coments
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 (modify-syntax-entry ?\n "> b" table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 (modify-syntax-entry ?\f "> b" table)
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
575 ;; single quotes (') quotes delimit strings
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
576 (modify-syntax-entry ?' "\"" table)
40971
fa679d186a7d (sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents: 40432
diff changeset
577 ;; backslash is no escape character
fa679d186a7d (sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents: 40432
diff changeset
578 (modify-syntax-entry ?\\ "." table)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 "Syntax table used in `sql-mode' and `sql-interactive-mode'.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 ;; Font lock support
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
584 (defvar sql-mode-ansi-font-lock-keywords nil
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 "ANSI SQL keywords used by font-lock.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 This variable is used by `sql-mode' and `sql-interactive-mode'. The
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 regular expressions are created during compilation by calling the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 function `regexp-opt'. Therefore, take a look at the source before
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 you define your own sql-mode-ansi-font-lock-keywords. You may want to
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 add functions and PL/SQL keywords.")
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
592 (if sql-mode-ansi-font-lock-keywords
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
593 ()
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
594 (let ((ansi-keywords (eval-when-compile
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
595 (concat "\\b"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
596 (regexp-opt '(
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 "authorization" "avg" "begin" "close" "cobol" "commit"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 "continue" "count" "declare" "double" "end" "escape"
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
599 "exec" "fetch" "foreign" "fortran" "found" "go" "goto" "indicator"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 "key" "language" "max" "min" "module" "numeric" "open" "pascal" "pli"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 "precision" "primary" "procedure" "references" "rollback"
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
602 "schema" "section" "some" "sqlcode" "sqlerror" "sum" "work") t) "\\b")))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
603 (ansi-reserved-words (eval-when-compile
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
604 (concat "\\b"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
605 (regexp-opt '(
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 "all" "and" "any" "as" "asc" "between" "by" "check" "create"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 "current" "default" "delete" "desc" "distinct" "exists" "float" "for"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608 "from" "grant" "group" "having" "in" "insert" "into" "is"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 "like" "not" "null" "of" "on" "option" "or" "order" "privileges"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 "public" "select" "set" "table" "to" "union" "unique"
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
611 "update" "user" "values" "view" "where" "with") t) "\\b")))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
612 (ansi-types (eval-when-compile
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
613 (concat "\\b"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
614 (regexp-opt '(
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
615 ;; ANSI Keywords that look like types
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
616 "character" "cursor" "dec" "int" "real"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
617 ;; ANSI Reserved Word that look like types
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
618 "char" "integer" "smallint" ) t) "\\b"))))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
619 (setq sql-mode-ansi-font-lock-keywords
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
620 (list (cons ansi-keywords 'font-lock-function-name-face)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
621 (cons ansi-reserved-words 'font-lock-keyword-face)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
622 (cons ansi-types 'font-lock-type-face)))))
52242
f5ada28bb9f0 Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents: 51929
diff changeset
623
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
624 (defvar sql-mode-oracle-font-lock-keywords nil
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625 "Oracle SQL keywords used by font-lock.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 This variable is used by `sql-mode' and `sql-interactive-mode'. The
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628 regular expressions are created during compilation by calling the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 function `regexp-opt'. Therefore, take a look at the source before
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 you define your own sql-mode-oracle-font-lock-keywords. You may want
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631 to add functions and PL/SQL keywords.")
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
632 (if sql-mode-oracle-font-lock-keywords
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
633 ()
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
634 (let ((oracle-keywords (eval-when-compile
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
635 (concat "\\b"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
636 (regexp-opt '(
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
637 "admin" "after" "allocate" "analyze" "archive" "archivelog" "backup"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
638 "become" "before" "block" "body" "cache" "cancel" "cascade" "change"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
639 "checkpoint" "compile" "constraint" "constraints" "contents"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
640 "controlfile" "cycle" "database" "datafile" "dba" "disable" "dismount"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
641 "dump" "each" "else" "elsif" "enable" "events" "except" "exceptions"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
642 "execute" "exit" "explain" "extent" "externally" "false" "flush" "force"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
643 "freelist" "freelists" "function" "groups" "if" "including" "initrans"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
644 "instance" "layer" "link" "lists" "logfile" "loop" "manage" "manual"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
645 "maxdatafiles" "maxinistances" "maxlogfiles" "maxloghistory"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
646 "maxlogmembers" "maxtrans" "maxvalue" "minextents" "minvalue" "mount"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
647 "new" "next" "noarchivelog" "nocache" "nocycle" "nomaxvalue"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
648 "nominvalue" "none" "noorder" "noresetlogs" "normal" "nosort" "off"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
649 "old" "only" "optimal" "others" "out" "own" "package" "parallel"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
650 "pctincrease" "pctused" "plan" "pragma" "private" "profile" "quota"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
651 "raise" "read" "recover" "referencing" "resetlogs" "restrict_references"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
652 "restricted" "return" "returning" "reuse" "rnds" "rnps" "role" "roles"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
653 "savepoint" "scn" "segment" "sequence" "shared" "snapshot" "sort"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
654 "statement_id" "statistics" "stop" "storage" "subtype" "switch" "system"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
655 "tables" "tablespace" "temporary" "thread" "time" "tracing"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
656 "transaction" "triggers" "true" "truncate" "type" "under" "unlimited"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
657 "until" "use" "using" "when" "while" "wnds" "wnps" "write") t) "\\b")))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
658 (oracle-warning-words (eval-when-compile
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
659 (concat "\\b"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
660 (regexp-opt '(
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
661 "cursor_already_open" "dup_val_on_index" "exception" "invalid_cursor"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
662 "invalid_number" "login_denied" "no_data_found" "not_logged_on"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
663 "notfound" "others" "pragma" "program_error" "storage_error"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
664 "timeout_on_resource" "too_many_rows" "transaction_backed_out"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
665 "value_error" "zero_divide") t) "\\b")))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
666 (oracle-reserved-words (eval-when-compile
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
667 (concat "\\b"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
668 (regexp-opt '(
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
669 "access" "add" "alter" "audit" "cluster" "column" "comment" "compress"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
670 "connect" "drop" "else" "exclusive" "file" "grant"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
671 "identified" "immediate" "increment" "index" "initial" "intersect"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
672 "level" "lock" "long" "maxextents" "minus" "mode" "modify" "noaudit"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
673 "nocompress" "nowait" "number" "offline" "online" "pctfree" "prior"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
674 "raw" "rename" "resource" "revoke" "row" "rowlabel" "rownum"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
675 "rows" "session" "share" "size" "start" "successful" "synonym" "sysdate"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
676 "then" "trigger" "uid" "validate" "whenever") t) "\\b")))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
677 (oracle-types (eval-when-compile
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
678 (concat "\\b"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
679 (regexp-opt '(
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
680 ;; Oracle Keywords that look like types
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
681 ;; Oracle Reserved Words that look like types
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
682 "binary_integer" "blob" "boolean" "constant" "date" "decimal" "rowid"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
683 "varchar" "varchar2") t) "\\b")))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
684 (oracle-builtin-functions (eval-when-compile
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
685 (concat "\\b"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
686 (regexp-opt '(
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
687 ;; Misc Oracle builtin functions
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
688 "abs" "add_months" "ascii" "avg" "ceil" "chartorowid" "chr" "concat"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
689 "convert" "cos" "cosh" "count" "currval" "decode" "dump" "exp" "floor"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
690 "glb" "greatest" "greatest_lb" "hextoraw" "initcap" "instr" "instrb"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
691 "last_day" "least" "least_ub" "length" "lengthb" "ln" "log" "lower"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
692 "lpad" "ltrim" "lub" "max" "min" "mod" "months_between" "new_time"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
693 "next_day" "nextval" "nls_initcap" "nls_lower" "nls_upper" "nlssort"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
694 "nvl" "power" "rawtohex" "replace" "round" "rowidtochar" "rpad"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
695 "rtrim" "sign" "sin" "sinh" "soundex" "sqlcode" "sqlerrm" "sqrt"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
696 "stddev" "sum" "substr" "substrb" "tan" "tanh" "to_char"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
697 "to_date" "to_label" "to_multi_byte" "to_number" "to_single_byte"
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
698 "translate" "trim" "trunc" "uid" "upper" "userenv" "variance" "vsize") t) "\\b"))))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
699 (setq sql-mode-oracle-font-lock-keywords
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
700 (append sql-mode-ansi-font-lock-keywords
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
701 (list (cons oracle-keywords 'font-lock-function-name-face)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
702 (cons oracle-warning-words 'font-lock-warning-face)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
703 (cons oracle-reserved-words 'font-lock-keyword-face)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
704 ;; XEmacs doesn't have font-lock-builtin-face
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
705 (if (string-match "XEmacs\\|Lucid" emacs-version)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
706 (cons oracle-builtin-functions 'font-lock-preprocessor-face)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
707 ;; GNU Emacs 19 doesn't have it either
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
708 (if (string-match "GNU Emacs 19" emacs-version)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
709 (cons oracle-builtin-functions 'font-lock-function-name-face)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
710 ;; Emacs
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
711 (cons oracle-builtin-functions 'font-lock-builtin-face)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
712 (cons oracle-types 'font-lock-type-face))))))
52242
f5ada28bb9f0 Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents: 51929
diff changeset
713
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
714 (defvar sql-mode-postgres-font-lock-keywords nil
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
715 "Postgres SQL keywords used by font-lock.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
716
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
717 This variable is used by `sql-mode' and `sql-interactive-mode'. The
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
718 regular expressions are created during compilation by calling the
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
719 function `regexp-opt'. Therefore, take a look at the source before
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
720 you define your own sql-mode-postgres-font-lock-keywords.")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
721
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
722 (if sql-mode-postgres-font-lock-keywords
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
723 ()
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 (let ((postgres-reserved-words (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726 (regexp-opt '(
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727 "language"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728 ) t) "\\b")))
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
729 (postgres-types (eval-when-compile
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
730 (concat "\\b"
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
731 (regexp-opt '(
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
732 "bool" "box" "circle" "char" "char2" "char4" "char8" "char16" "date"
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
733 "float4" "float8" "int2" "int4" "int8" "line" "lseg" "money" "path"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
734 "point" "polygon" "serial" "text" "time" "timespan" "timestamp" "varchar"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
735 ) t)"\\b")))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 (postgres-builtin-functions (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738 (regexp-opt '(
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
739 ;; Misc Postgres builtin functions
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740 "abstime" "age" "area" "box" "center" "date_part" "date_trunc"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 "datetime" "dexp" "diameter" "dpow" "float" "float4" "height"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
742 "initcap" "integer" "isclosed" "isfinite" "isoldpath" "isopen"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743 "length" "lower" "lpad" "ltrim" "pclose" "point" "points" "popen"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744 "position" "radius" "reltime" "revertpoly" "rpad" "rtrim" "substr"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
745 "substring" "text" "timespan" "translate" "trim" "upgradepath"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
746 "upgradepoly" "upper" "varchar" "width"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 ) t) "\\b"))))
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
748 (setq sql-mode-postgres-font-lock-keywords
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749 (append sql-mode-ansi-font-lock-keywords
24058
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
750 (list (cons postgres-reserved-words 'font-lock-keyword-face)
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
751 ;; XEmacs doesn't have 'font-lock-builtin-face
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
752 (if (string-match "XEmacs\\|Lucid" emacs-version)
24058
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
753 (cons postgres-builtin-functions 'font-lock-preprocessor-face)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
754 ;; Emacs
24058
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
755 (cons postgres-builtin-functions 'font-lock-builtin-face))
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
756 (cons postgres-types 'font-lock-type-face))))))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
757
52242
f5ada28bb9f0 Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents: 51929
diff changeset
758
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
759 (defvar sql-mode-linter-font-lock-keywords nil
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
760 "Linter SQL keywords used by font-lock.
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
761
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
762 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
763 regular expressions are created during compilation by calling the
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
764 function `regexp-opt'.")
52242
f5ada28bb9f0 Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents: 51929
diff changeset
765
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
766 (if sql-mode-linter-font-lock-keywords
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
767 ()
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
768 (let ((linter-keywords (eval-when-compile
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
769 (concat "\\b"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
770 (regexp-opt '(
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
771 "autocommit" "autoinc" "autorowid" "cancel" "cascade" "channel"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
772 "committed" "count" "countblob" "cross" "current" "data" "database"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
773 "datafile" "datafiles" "datesplit" "dba" "dbname" "default" "deferred"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
774 "denied" "description" "device" "difference" "directory" "error"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
775 "escape" "euc" "exclusive" "external" "extfile" "false" "file"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
776 "filename" "filesize" "filetime" "filter" "findblob" "first" "foreign"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
777 "full" "fuzzy" "global" "granted" "ignore" "immediate" "increment"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
778 "indexes" "indexfile" "indexfiles" "indextime" "initial" "integrity"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
779 "internal" "key" "last_autoinc" "last_rowid" "limit" "linter"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
780 "linter_file_device" "linter_file_size" "linter_name_length" "ln"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
781 "local" "login" "maxisn" "maxrow" "maxrowid" "maxvalue" "message"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
782 "minvalue" "module" "names" "national" "natural" "new" "new_table"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
783 "no" "node" "noneuc" "nulliferror" "numbers" "off" "old" "old_table"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
784 "only" "operation" "optimistic" "option" "page" "partially" "password"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
785 "phrase" "plan" "precision" "primary" "priority" "privileges"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
786 "proc_info_size" "proc_par_name_len" "protocol" "quant" "range" "raw"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
787 "read" "record" "records" "references" "remote" "rename" "replication"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
788 "restart" "rewrite" "root" "row" "rule" "savepoint" "security"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
789 "sensitive" "sequence" "serializable" "server" "since" "size" "some"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
790 "startup" "statement" "station" "success" "sys_guid" "tables" "test"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
791 "timeout" "trace" "transaction" "translation" "trigger"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
792 "trigger_info_size" "true" "trunc" "uncommitted" "unicode" "unknown"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
793 "unlimited" "unlisted" "user" "utf8" "value" "varying" "volumes"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
794 "wait" "windows_code" "workspace" "write" "xml"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
795 ) t) "\\b")))
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
796 (linter-reserved-words (eval-when-compile
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
797 (concat "\\b"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
798 (regexp-opt '(
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
799 "access" "action" "add" "address" "after" "all" "alter" "always" "and"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
800 "any" "append" "as" "asc" "ascic" "async" "at_begin" "at_end" "audit"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
801 "aud_obj_name_len" "backup" "base" "before" "between" "blobfile"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
802 "blobfiles" "blobpct" "brief" "browse" "by" "case" "cast" "check"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
803 "clear" "close" "column" "comment" "commit" "connect" "contains"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
804 "correct" "create" "delete" "desc" "disable" "disconnect" "distinct"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
805 "drop" "each" "ef" "else" "enable" "end" "event" "except" "exclude"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
806 "execute" "exists" "extract" "fetch" "finish" "for" "from" "get"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
807 "grant" "group" "having" "identified" "in" "index" "inner" "insert"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
808 "instead" "intersect" "into" "is" "isolation" "join" "left" "level"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
809 "like" "lock" "mode" "modify" "not" "nowait" "null" "of" "on" "open"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
810 "or" "order" "outer" "owner" "press" "prior" "procedure" "public"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
811 "purge" "rebuild" "resource" "restrict" "revoke" "right" "role"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
812 "rollback" "rownum" "select" "session" "set" "share" "shutdown"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
813 "start" "stop" "sync" "synchronize" "synonym" "sysdate" "table" "then"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
814 "to" "union" "unique" "unlock" "until" "update" "using" "values"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
815 "view" "when" "where" "with" "without"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
816 ) t) "\\b")))
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
817 (linter-types (eval-when-compile
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
818 (concat "\\b"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
819 (regexp-opt '(
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
820 "bigint" "bitmap" "blob" "boolean" "char" "character" "date"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
821 "datetime" "dec" "decimal" "double" "float" "int" "integer" "nchar"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
822 "number" "numeric" "real" "smallint" "varbyte" "varchar" "byte"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
823 "cursor" "long"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
824 ) t) "\\b")))
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
825 (linter-builtin-functions (eval-when-compile
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
826 (concat "\\b"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
827 (regexp-opt '(
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
828 "abs" "acos" "asin" "atan" "atan2" "avg" "ceil" "cos" "cosh" "divtime"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
829 "exp" "floor" "getbits" "getblob" "getbyte" "getlong" "getraw"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
830 "getstr" "gettext" "getword" "hextoraw" "lenblob" "length" "log"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
831 "lower" "lpad" "ltrim" "max" "min" "mod" "monthname" "nvl"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
832 "octet_length" "power" "rand" "rawtohex" "repeat_string"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
833 "right_substr" "round" "rpad" "rtrim" "sign" "sin" "sinh" "soundex"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
834 "sqrt" "sum" "tan" "tanh" "timeint_to_days" "to_char" "to_date"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
835 "to_gmtime" "to_localtime" "to_number" "trim" "upper" "decode"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
836 "substr" "substring" "chr" "dayname" "days" "greatest" "hex" "initcap"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
837 "instr" "least" "multime" "replace" "width"
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
838 ) t) "\\b"))))
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
839 (setq sql-mode-linter-font-lock-keywords
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
840 (append sql-mode-ansi-font-lock-keywords
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
841 (list (cons linter-keywords 'font-lock-function-name-face)
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
842 (cons linter-reserved-words 'font-lock-keyword-face)
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
843 ;; XEmacs doesn't have font-lock-builtin-face
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
844 (if (string-match "XEmacs\\|Lucid" emacs-version)
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
845 (cons linter-builtin-functions 'font-lock-preprocessor-face)
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
846 ;; GNU Emacs 19 doesn't have it either
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
847 (if (string-match "GNU Emacs 19" emacs-version)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
848 (cons linter-builtin-functions 'font-lock-function-name-face)
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
849 ;; Emacs
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
850 (cons linter-builtin-functions 'font-lock-builtin-face)))
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
851 (cons linter-types 'font-lock-type-face))))))
52242
f5ada28bb9f0 Patch by Michael Mauger <mmaug@yahoo.com>
Alex Schroeder <alex@gnu.org>
parents: 51929
diff changeset
852
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
853 (defvar sql-mode-font-lock-keywords sql-mode-ansi-font-lock-keywords
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
854 "SQL keywords used by font-lock.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
855
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
856 This variable defaults to `sql-mode-ansi-font-lock-keywords'. This is
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
857 used for the default `font-lock-defaults' value in `sql-mode'. This
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
858 can be changed by some entry functions to provide more hilighting.")
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
860
30905
2069c10bf952 (sql-magic-go): Use comint-bol.
Gerd Moellmann <gerd@gnu.org>
parents: 30838
diff changeset
861
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
862 ;;; Functions to switch highlighting
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
863
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
864 (defun sql-highlight-oracle-keywords ()
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
865 "Highlight Oracle keywords.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
866 Basically, this just sets `font-lock-keywords' appropriately."
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
867 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
868 (setq font-lock-keywords sql-mode-oracle-font-lock-keywords)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
869 (font-lock-fontify-buffer))
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
870
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
871 (defun sql-highlight-postgres-keywords ()
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
872 "Highlight Postgres keywords.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
873 Basically, this just sets `font-lock-keywords' appropriately."
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
874 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
875 (setq font-lock-keywords sql-mode-postgres-font-lock-keywords)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
876 (font-lock-fontify-buffer))
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
877
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
878 (defun sql-highlight-linter-keywords ()
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
879 "Highlight LINTER keywords.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
880 Basically, this just sets `font-lock-keywords' appropriately."
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
881 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
882 (setq font-lock-keywords sql-mode-linter-font-lock-keywords)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
883 (font-lock-fontify-buffer))
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
884
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
885 (defun sql-highlight-ansi-keywords ()
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
886 "Highlight ANSI SQL keywords.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
887 Basically, this just sets `font-lock-keywords' appropriately."
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
888 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
889 (setq font-lock-keywords sql-mode-ansi-font-lock-keywords)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
890 (font-lock-fontify-buffer))
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
891
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
892
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
893
30838
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
894 ;;; Compatibility functions
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
895
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
896 (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
897 ;; 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
898 (defun comint-line-beginning-position ()
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
899 "Returns the buffer position of the beginning of the line, after any prompt.
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
900 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
901 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
902 (save-excursion (comint-bol nil) (point))))
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
903
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
904
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
905
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
906 ;;; Small functions
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
907
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
908 (defun sql-magic-go (arg)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
909 "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
910 `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
911 (interactive "P")
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
912 (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
913 (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
914 (save-excursion
30642
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
915 (comint-bol nil)
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
916 (looking-at "go\\b")))
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
917 (comint-send-input)))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
918
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
919 (defun sql-magic-semicolon (arg)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
920 "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
921 `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
922 (interactive "P")
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
923 (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
924 (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
925 (comint-send-input)))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
926
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
927 (defun sql-accumulate-and-indent ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
928 "Continue SQL statement on the next line."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
929 (interactive)
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
930 (if (fboundp 'comint-accumulate)
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
931 (comint-accumulate)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
932 (newline))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
933 (indent-according-to-mode))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
934
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
935 ;;;###autoload
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
936 (defun sql-help ()
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
937 "Show short help for the SQL modes.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
938
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
939 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
940 usually named `*SQL*'. The name of the major mode is SQLi.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
941
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
942 Use the following commands to start a specific SQL interpreter:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
943
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
944 PostGres: \\[sql-postgres]
40432
225bd38b0ce7 (sql-mysql): Doc change by RMS.
Gerd Moellmann <gerd@gnu.org>
parents: 38872
diff changeset
945 MySQL: \\[sql-mysql]
51607
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
946 SQLite: \\[sql-sqlite]
24268
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
947
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
948 Other non-free SQL implementations are also supported:
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
949
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
950 Solid: \\[sql-solid]
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
951 Oracle: \\[sql-oracle]
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
952 Informix: \\[sql-informix]
24268
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
953 Sybase: \\[sql-sybase]
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
954 Ingres: \\[sql-ingres]
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
955 Microsoft: \\[sql-ms]
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
956 Interbase: \\[sql-interbase]
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
957 Linter: \\[sql-linter]
24268
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
958
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
959 But we urge you to choose a free implementation instead of these.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
960
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
961 Once you have the SQLi buffer, you can enter SQL statements in the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
962 buffer. The output generated is appended to the buffer and a new prompt
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
963 is generated. See the In/Out menu in the SQLi buffer for some functions
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
964 that help you navigate through the buffer, the input history, etc.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
965
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
966 If you have a really complex SQL statement or if you are writing a
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
967 procedure, you can do this in a separate buffer. Put the new buffer in
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
968 `sql-mode' by calling \\[sql-mode]. The name of this buffer can be
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
969 anything. The name of the major mode is SQL.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
970
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
971 In this SQL buffer (SQL mode), you can send the region or the entire
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
972 buffer to the interactive SQL buffer (SQLi mode). The results are
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
973 appended to the SQLi buffer without disturbing your SQL buffer."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
974 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
975 (describe-function 'sql-help))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
976
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
977 (defun sql-read-passwd (prompt &optional default)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
978 "Read a password using PROMPT.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
979 Optional DEFAULT is password to start with. This function calls
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
980 `read-passwd' if it is available. If not, function
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
981 `ange-ftp-read-passwd' is called. This should always be available,
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
982 even in old versions of Emacs."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
983 (if (fboundp 'read-passwd)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
984 (read-passwd prompt nil default)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
985 (unless (fboundp 'ange-ftp-read-passwd)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
986 (autoload 'ange-ftp-read-passwd "ange-ftp"))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
987 (ange-ftp-read-passwd prompt default)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
988
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
989 (defun sql-get-login (&rest what)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
990 "Get username, password and database from the user.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
991
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
992 The variables `sql-user', `sql-password', `sql-server', and
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
993 `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
994 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
995 `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
996 in a history.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
997
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
998 Parameter WHAT is a list of the arguments passed to this function.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
999 The function asks for the username if WHAT contains symbol `user', for
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1000 the password if it contains symbol `password', for the server if it
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1001 contains symbol `server', and for the database if it contains symbol
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1002 `database'.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1003
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1004 In order to ask the user for username, password and database, call the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1005 function like this: (sql-get-login 'user 'password 'database)."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1006 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1007 (if (memq 'user what)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1008 (setq sql-user
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1009 (read-from-minibuffer "User: " sql-user nil nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1010 sql-user-history)))
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1011 (if (memq 'password what)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1012 (setq sql-password
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1013 (sql-read-passwd "Password: " sql-password)))
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1014 (if (memq 'server what)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1015 (setq sql-server
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1016 (read-from-minibuffer "Server: " sql-server nil nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1017 sql-server-history)))
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1018 (if (memq 'database what)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1019 (setq sql-database
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1020 (read-from-minibuffer "Database: " sql-database nil nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1021 sql-database-history))))
25381
970b18c6803f (sql-sybase): use sql-server instead of sql-database.
Alex Schroeder <alex@gnu.org>
parents: 25183
diff changeset
1022
26576
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1023 (defun sql-find-sqli-buffer ()
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1024 "Return the current default SQLi buffer or nil.
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1025 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
1026 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
1027 (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
1028 (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
1029 (get-buffer-process default-buffer))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1030 default-buffer
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1031 (save-excursion
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1032 (let ((buflist (buffer-list))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1033 (found))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1034 (while (not (or (null buflist)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1035 found))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1036 (let ((candidate (car buflist)))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1037 (set-buffer candidate)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1038 (if (and (equal major-mode 'sql-interactive-mode)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1039 (get-buffer-process candidate))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1040 (setq found candidate))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1041 (setq buflist (cdr buflist))))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1042 found)))))
26576
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1043
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1044 (defun sql-set-sqli-buffer-generally ()
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
1045 "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
1046 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
1047 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
1048 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
1049 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
1050 `sql-set-sqli-hook' is run."
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1051 (interactive)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1052 (save-excursion
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1053 (let ((buflist (buffer-list))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1054 (default-sqli-buffer (sql-find-sqli-buffer)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1055 (setq-default sql-buffer default-sqli-buffer)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1056 (while (not (null buflist))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1057 (let ((candidate (car buflist)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1058 (set-buffer candidate)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1059 (if (and (equal major-mode 'sql-mode)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1060 (not (buffer-live-p sql-buffer)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1061 (progn
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1062 (setq sql-buffer default-sqli-buffer)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1063 (run-hooks 'sql-set-sqli-hook))))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1064 (setq buflist (cdr buflist))))))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1065
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1066 (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
1067 "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
1068
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1069 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
1070 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
1071 `sql-set-sqli-hook'.
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1072
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1073 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
1074 `sql-buffer'.
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1075
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1076 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
1077 `sql-buffer'."
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1078 (interactive)
26576
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1079 (let ((default-buffer (sql-find-sqli-buffer)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1080 (if (null default-buffer)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1081 (error "There is no suitable SQLi buffer"))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1082 (let ((new-buffer
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1083 (get-buffer
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1084 (read-buffer "New SQLi buffer: " default-buffer t))))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1085 (if (null (get-buffer-process new-buffer))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1086 (error "Buffer %s has no process" (buffer-name new-buffer)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1087 (if (null (save-excursion
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1088 (set-buffer new-buffer)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1089 (equal major-mode 'sql-interactive-mode)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1090 (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
1091 (if new-buffer
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1092 (progn
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1093 (setq sql-buffer new-buffer)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
1094 (run-hooks 'sql-set-sqli-hook))))))
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1095
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1096 (defun sql-show-sqli-buffer ()
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1097 "Show the name of current SQLi buffer.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1098
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1099 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
1100 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
1101 (interactive)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1102 (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
1103 (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
1104 (if (null (get-buffer-process sql-buffer))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1105 (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
1106 (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
1107
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1108 (defun sql-make-alternate-buffer-name ()
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1109 "Return a string that can be used to rename a SQLi buffer.
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1110
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1111 This is used to set `sql-alternate-buffer-name' within
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1112 `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
1113 (concat (if (string= "" sql-user)
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1114 (if (string= "" (user-login-name))
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1115 ()
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1116 (concat (user-login-name) "/"))
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1117 (concat sql-user "/"))
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1118 (if (string= "" sql-database)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1119 (if (string= "" sql-server)
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1120 (system-name)
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1121 sql-server)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1122 sql-database)))
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1123
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1124 (defun 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
1125 "Renames a SQLi buffer."
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1126 (interactive)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1127 (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
1128
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1129 (defun sql-copy-column ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1130 "Copy current column to the end of buffer.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1131 Inserts SELECT or commas if appropriate."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1132 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1133 (let ((column))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1134 (save-excursion
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1135 (setq column (buffer-substring
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1136 (progn (forward-char 1) (backward-sexp 1) (point))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1137 (progn (forward-sexp 1) (point))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1138 (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
1139 (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
1140 (cond
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
1141 ;; 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
1142 ((= bol (point))
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
1143 (insert "SELECT "))
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
1144 ;; 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
1145 ((save-excursion
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
1146 (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
1147 bol t))
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
1148 (insert ", "))
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
1149 ;; else insert a space
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
1150 (t
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
1151 (if (eq (preceding-char) ? )
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
1152 nil
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
1153 (insert " ")))))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1154 ;; in any case, insert the column
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1155 (insert column)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1156 (message "%s" column))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1157
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1158 ;; On NT, SQL*Plus for Oracle turns on full buffering for stdout if it
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1159 ;; is not attached to a character device; therefore placeholder
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1160 ;; 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
1161 ;; Emacs query for the placeholders.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1162
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1163 (defvar sql-placeholder-history nil
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1164 "History of placeholder values used.")
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1165
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1166 (defun sql-query-placeholders-and-send (proc string)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1167 "Send to PROC input STRING, maybe replacing placeholders.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1168 Placeholders are words starting with and ampersand like &this.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1169 This function is used for `comint-input-sender' if using `sql-oracle' on NT."
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1170 (while (string-match "&\\(\\sw+\\)" string)
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
1171 (setq string (replace-match
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1172 (read-from-minibuffer
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1173 (format "Enter value for %s: " (match-string 1 string))
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1174 nil nil nil sql-placeholder-history)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1175 t t string)))
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1176 (comint-send-string proc string)
42694
4664fcfde396 (sql-query-placeholders-and-send): Handle
Richard M. Stallman <rms@gnu.org>
parents: 42440
diff changeset
1177 (if comint-input-sender-no-newline
42799
2f56e7fc793a (sql-escape-newlines-and-send)
Richard M. Stallman <rms@gnu.org>
parents: 42694
diff changeset
1178 (if (not (string-equal string ""))
42694
4664fcfde396 (sql-query-placeholders-and-send): Handle
Richard M. Stallman <rms@gnu.org>
parents: 42440
diff changeset
1179 (process-send-eof))
4664fcfde396 (sql-query-placeholders-and-send): Handle
Richard M. Stallman <rms@gnu.org>
parents: 42440
diff changeset
1180 (comint-send-string proc "\n")))
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1181
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1182 ;; 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
1183 ;; The space before the backslash is relevant.
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1184 (defun sql-escape-newlines-and-send (proc string)
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1185 "Send to PROC input STRING, escaping newlines if necessary.
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1186 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
1187 (let ((result "") (start 0) mb me)
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1188 (while (string-match "\n" string start)
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1189 (setq mb (match-beginning 0)
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1190 me (match-end 0))
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1191 (if (and (> mb 1)
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1192 (string-equal " \\" (substring string (- mb 2) mb)))
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1193 (setq result (concat result (substring string start me)))
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1194 (setq result (concat result (substring string start mb) " \\\n")))
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1195 (setq start me))
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1196 (setq result (concat result (substring string start)))
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1197 (comint-send-string proc result)
42694
4664fcfde396 (sql-query-placeholders-and-send): Handle
Richard M. Stallman <rms@gnu.org>
parents: 42440
diff changeset
1198 (if comint-input-sender-no-newline
42799
2f56e7fc793a (sql-escape-newlines-and-send)
Richard M. Stallman <rms@gnu.org>
parents: 42694
diff changeset
1199 (if (not (string-equal string ""))
42694
4664fcfde396 (sql-query-placeholders-and-send): Handle
Richard M. Stallman <rms@gnu.org>
parents: 42440
diff changeset
1200 (process-send-eof))
4664fcfde396 (sql-query-placeholders-and-send): Handle
Richard M. Stallman <rms@gnu.org>
parents: 42440
diff changeset
1201 (comint-send-string proc "\n"))))
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1202
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1203
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1204
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1205 ;;; Sending the region to the SQLi buffer.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1206
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1207 (defun sql-send-region (start end)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1208 "Send a region to the SQL process."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1209 (interactive "r")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1210 (if (buffer-live-p sql-buffer)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1211 (save-excursion
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1212 (comint-send-region sql-buffer start end)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1213 (if (string-match "\n$" (buffer-substring start end))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1214 ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1215 (comint-send-string sql-buffer "\n"))
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1216 (message "Sent string to buffer %s." (buffer-name sql-buffer))
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1217 (if sql-pop-to-buffer-after-send-region
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1218 (pop-to-buffer sql-buffer)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1219 (display-buffer sql-buffer)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1220 (message "No SQL process started.")))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1221
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1222 (defun sql-send-paragraph ()
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1223 "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
1224 (interactive)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1225 (let ((start (save-excursion
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1226 (backward-paragraph)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1227 (point)))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1228 (end (save-excursion
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1229 (forward-paragraph)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1230 (point))))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1231 (sql-send-region start end)))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1232
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1233 (defun sql-send-buffer ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1234 "Send the buffer contents to the SQL process."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1235 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1236 (sql-send-region (point-min) (point-max)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1237
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1238 (defun sql-toggle-pop-to-buffer-after-send-region (&optional value)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1239 "Toggle `sql-pop-to-buffer-after-send-region'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1240
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1241 If given the optional parameter VALUE, sets
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1242 sql-toggle-pop-to-buffer-after-send-region to VALUE."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1243 (interactive "P")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1244 (if value
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1245 (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
1246 (setq sql-pop-to-buffer-after-send-region
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1247 (null sql-pop-to-buffer-after-send-region ))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1248
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1249
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1250
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1251 ;;; SQL mode -- uses SQL interactive mode
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1252
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1253 ;;;###autoload
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1254 (defun sql-mode ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1255 "Major mode to edit SQL.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1256
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1257 You can send SQL statements to the SQLi buffer using
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1258 \\[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
1259 See `sql-help' on how to create SQLi buffers.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1260
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1261 \\{sql-mode-map}
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1262 Customization: Entry to this mode runs the `sql-mode-hook'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1263
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1264 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
1265 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
1266 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
1267 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
1268 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
1269 value of `sql-buffer' using \\[sql-set-sqli-buffer].
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1270
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1271 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
1272 `sql-interactive-mode'.
fa679d186a7d (sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents: 40432
diff changeset
1273
fa679d186a7d (sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents: 40432
diff changeset
1274 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
1275 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
1276 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
1277
fa679d186a7d (sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents: 40432
diff changeset
1278 \(add-hook 'sql-mode-hook
fa679d186a7d (sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents: 40432
diff changeset
1279 (lambda ()
fa679d186a7d (sql-mode): Doc change.
Richard M. Stallman <rms@gnu.org>
parents: 40432
diff changeset
1280 (modify-syntax-entry ?\\\\ \".\" sql-mode-syntax-table)))"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1281 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1282 (kill-all-local-variables)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1283 (setq major-mode 'sql-mode)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1284 (setq mode-name "SQL")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1285 (use-local-map sql-mode-map)
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
1286 (if sql-mode-menu
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
1287 (easy-menu-add sql-mode-menu)); XEmacs
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1288 (set-syntax-table sql-mode-syntax-table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1289 (make-local-variable 'font-lock-defaults)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1290 ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1291 ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1292 ;; will have just one quote. Therefore syntactic hilighting is
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1293 ;; disabled for interactive buffers. `_' and `.' are considered part
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1294 ;; of words.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1295 (setq font-lock-defaults '(sql-mode-font-lock-keywords
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1296 nil t ((?_ . "w") (?. . "w"))))
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1297 (make-local-variable 'comment-start)
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1298 (setq comment-start "--")
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1299 ;; 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
1300 (make-local-variable 'sql-buffer)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1301 ;; 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
1302 ;; 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
1303 ;; case-insensitive, that's why we have to set imenu-case-fold-search.
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1304 ;; imenu-syntax-alist makes sure that `_' is considered part of object
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1305 ;; names.
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1306 (setq imenu-generic-expression sql-imenu-generic-expression
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1307 imenu-case-fold-search t
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1308 imenu-syntax-alist '(("_" . "w")))
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1309 ;; 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
1310 ;; lines.
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1311 (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
1312 (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
1313 (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
1314 paragraph-start "[\n\f]")
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1315 ;; Abbrevs
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1316 (setq local-abbrev-table sql-mode-abbrev-table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1317 (setq abbrev-all-caps 1)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1318 ;; Run hook
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1319 (run-hooks 'sql-mode-hook))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1320
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1321
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1322
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1323 ;;; SQL interactive mode
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1324
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1325 (put 'sql-interactive-mode 'mode-class 'special)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1326
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1327 (defun sql-interactive-mode ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1328 "Major mode to use a SQL interpreter interactively.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1329
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1330 Do not call this function by yourself. The environment must be
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1331 initialized by an entry function specific for the SQL interpreter. See
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1332 `sql-help' for a list of available entry functions.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1333
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1334 \\[comint-send-input] after the end of the process' output sends the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1335 text from the end of process to the end of the current line.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1336 \\[comint-send-input] before end of process output copies the current
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1337 line minus the prompt to the end of the buffer and sends it.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1338 \\[comint-copy-old-input] just copies the current line.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1339 Use \\[sql-accumulate-and-indent] to enter multi-line statements.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1340
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1341 If you want to make multiple SQL buffers, rename the `*SQL*' buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1342 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
1343 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
1344 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
1345 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
1346 their creation. See `sql-mode' for details.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1347
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1348 Sample session using two connections:
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1349
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1350 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
1351 2. Rename buffer \"*SQL*\" to \"*Connection 1*\".
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1352 3. Create a SQL buffer \"test1.sql\".
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1353 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
1354 5. Rename buffer \"*SQL*\" to \"*Connection 2*\".
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1355 6. Create a SQL buffer \"test2.sql\".
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1356
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1357 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
1358 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
1359 will send the region to buffer \"*Connection 2*\".
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1360
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1361 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
1362 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
1363 the signals are not supported.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1364
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1365 \\{sql-interactive-mode-map}
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1366 Customization: Entry to this mode runs the hooks on `comint-mode-hook'
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1367 and `sql-interactive-mode-hook' (in that order). Before each input, the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1368 hooks on `comint-input-filter-functions' are run. After each SQL
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1369 interpreter output, the hooks on `comint-output-filter-functions' are
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1370 run.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1371
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1372 Variable `sql-input-ring-file-name' controls the initialisation of the
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1373 input ring history.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1374
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1375 Variables `comint-output-filter-functions', a hook, and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1376 `comint-scroll-to-bottom-on-input' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1377 `comint-scroll-to-bottom-on-output' control whether input and output
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1378 cause the window to scroll to the end of the buffer.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1379
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1380 If you want to make SQL buffers limited in length, add the function
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1381 `comint-truncate-buffer' to `comint-output-filter-functions'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1382
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1383 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
1384 certain length.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1385
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1386 \(add-hook 'sql-interactive-mode-hook
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1387 \(function (lambda ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1388 \(setq comint-output-filter-functions 'comint-truncate-buffer))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1389
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1390 Here is another example. It will always put point back to the statement
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1391 you entered, right above the output it created.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1392
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1393 \(setq comint-output-filter-functions
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1394 \(function (lambda (STR) (comint-show-output))))"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1395 (comint-mode)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1396 (setq comint-prompt-regexp sql-prompt-regexp)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1397 (setq left-margin sql-prompt-length)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1398 (setq major-mode 'sql-interactive-mode)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1399 (setq mode-name "SQLi")
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1400 (use-local-map sql-interactive-mode-map)
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
1401 (if sql-interactive-mode-menu
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1402 (easy-menu-add sql-interactive-mode-menu)); XEmacs
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1403 (set-syntax-table sql-mode-syntax-table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1404 (make-local-variable 'font-lock-defaults)
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1405 ;; 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
1406 ;; 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
1407 ;; will have just one quote. Therefore syntactic hilighting is
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1408 ;; disabled for interactive buffers. `_' and `.' are considered part
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1409 ;; of words.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1410 (setq font-lock-defaults '(sql-mode-font-lock-keywords
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1411 t t ((?_ . "w") (?. . "w"))))
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1412 ;; 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
1413 (make-local-variable 'comment-start)
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1414 (setq comment-start "--")
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1415 ;; Abbreviation table init and case-insensitive. It is not activatet
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1416 ;; by default.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1417 (setq local-abbrev-table sql-mode-abbrev-table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1418 (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
1419 ;; Exiting the process will call sql-stop.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1420 (set-process-sentinel (get-buffer-process sql-buffer) 'sql-stop)
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1421 ;; People wanting a different history file for each
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1422 ;; 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
1423 ;; on the sql-interactive-mode-hook.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1424 (setq comint-input-ring-separator sql-input-ring-separator
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1425 comint-input-ring-file-name sql-input-ring-file-name)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1426 ;; Create a usefull name for renaming this buffer later.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1427 (make-local-variable 'sql-alternate-buffer-name)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1428 (setq sql-alternate-buffer-name (sql-make-alternate-buffer-name))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1429 ;; User stuff.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1430 (run-hooks 'sql-interactive-mode-hook)
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1431 ;; Calling the hook before calling comint-read-input-ring allows users
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1432 ;; 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
1433 (comint-read-input-ring t))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1434
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1435 (defun sql-stop (process event)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1436 "Called when the SQL process is stopped.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1437
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1438 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
1439 `comint-write-input-ring' and inserts a short message in the SQL buffer.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1440
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1441 This function is a sentinel watching the SQL interpreter process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1442 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
1443 (comint-write-input-ring)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1444 (if (and (eq (current-buffer) sql-buffer)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1445 (not buffer-read-only))
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1446 (insert (format "\nProcess %s %s\n" process event))
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1447 (message "Process %s %s" process event)))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1448
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1449
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1450
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1451 ;;; Entry functions for different SQL interpreters.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1452
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1453 ;;;###autoload
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1454 (defun sql-oracle ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1455 "Run sqlplus by Oracle as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1456
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1457 If buffer `*SQL*' exists but no process is running, make a new process.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1458 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1459 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1460
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1461 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
1462 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
1463 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
1464 the list `sql-oracle-options'.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1465
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1466 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1467 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1468
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1469 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1470 in the input and output to the process, use \\[universal-coding-system-argument]
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1471 before \\[sql-oracle]. You can also specify this with \\[set-buffer-process-coding-system]
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1472 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1473 The default comes from `process-coding-system-alist' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1474 `default-process-coding-system'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1475
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1476 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1477 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1478 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1479 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1480 (sql-get-login 'user 'password 'database)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1481 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1482 ;; Produce user/password@database construct. Password without user
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1483 ;; is meaningless; database without user/password is meaningless,
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1484 ;; because "@param" will ask sqlplus to interpret the script
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1485 ;; "param".
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1486 (let ((parameter nil))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1487 (if (not (string= "" sql-user))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1488 (if (not (string= "" sql-password))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1489 (setq parameter (concat sql-user "/" sql-password))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1490 (setq parameter sql-user)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1491 (if (and parameter (not (string= "" sql-database)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1492 (setq parameter (concat parameter "@" sql-database)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1493 (if parameter
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1494 (setq parameter (nconc (list parameter) sql-oracle-options))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1495 (setq parameter sql-oracle-options))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1496 (if parameter
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1497 (set-buffer (apply 'make-comint "SQL" sql-oracle-program nil
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1498 parameter))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1499 (set-buffer (make-comint "SQL" sql-oracle-program nil))))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1500 (setq sql-prompt-regexp "^SQL> ")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1501 (setq sql-prompt-length 5)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1502 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1503 ;; set sql-mode-font-lock-keywords to something different before
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1504 ;; calling sql-interactive-mode.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1505 (setq sql-mode-font-lock-keywords sql-mode-oracle-font-lock-keywords)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1506 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1507 ;; If running on NT, make sure we do placeholder replacement
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1508 ;; ourselves. This must come after sql-interactive-mode because all
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1509 ;; local variables will be killed, there.
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1510 (if (eq window-system 'w32)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1511 (setq comint-input-sender 'sql-query-placeholders-and-send))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1512 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1513 (pop-to-buffer sql-buffer)))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1514
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1515
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1516
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1517 ;;;###autoload
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1518 (defun sql-sybase ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1519 "Run isql by SyBase as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1520
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1521 If buffer `*SQL*' exists but no process is running, make a new process.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1522 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1523 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1524
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1525 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
1526 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
1527 `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
1528 can be stored in the list `sql-sybase-options'.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1529
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1530 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1531 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1532
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1533 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1534 in the input and output to the process, use \\[universal-coding-system-argument]
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1535 before \\[sql-sybase]. You can also specify this with \\[set-buffer-process-coding-system]
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1536 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1537 The default comes from `process-coding-system-alist' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1538 `default-process-coding-system'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1539
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1540 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1541 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1542 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1543 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1544 (sql-get-login 'server 'user 'password 'database)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1545 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1546 ;; Put all parameters to the program (if defined) in a list and call
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1547 ;; make-comint.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1548 (let ((params sql-sybase-options))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1549 (if (not (string= "" sql-server))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1550 (setq params (append (list "-S" sql-server) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1551 (if (not (string= "" sql-database))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1552 (setq params (append (list "-D" sql-database) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1553 (if (not (string= "" sql-password))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1554 (setq params (append (list "-P" sql-password) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1555 (if (not (string= "" sql-user))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1556 (setq params (append (list "-U" sql-user) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1557 (set-buffer (apply 'make-comint "SQL" sql-sybase-program
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1558 nil params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1559 (setq sql-prompt-regexp "^SQL> ")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1560 (setq sql-prompt-length 5)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1561 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1562 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1563 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1564 (pop-to-buffer sql-buffer)))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1565
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1566
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1567
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1568 ;;;###autoload
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1569 (defun sql-informix ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1570 "Run dbaccess by Informix as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1571
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1572 If buffer `*SQL*' exists but no process is running, make a new process.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1573 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1574 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1575
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1576 Interpreter used comes from variable `sql-informix-program'. Login uses
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1577 the variable `sql-database' as default, if set.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1578
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1579 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1580 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1581
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1582 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1583 in the input and output to the process, use \\[universal-coding-system-argument]
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1584 before \\[sql-informix]. You can also specify this with \\[set-buffer-process-coding-system]
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1585 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1586 The default comes from `process-coding-system-alist' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1587 `default-process-coding-system'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1588
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1589 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1590 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1591 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1592 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1593 (sql-get-login 'database)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1594 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1595 ;; username and password are ignored.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1596 (if (string= "" sql-database)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1597 (set-buffer (make-comint "SQL" sql-informix-program nil))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1598 (set-buffer (make-comint "SQL" sql-informix-program nil sql-database "-")))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1599 (setq sql-prompt-regexp "^SQL> ")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1600 (setq sql-prompt-length 5)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1601 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1602 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1603 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1604 (pop-to-buffer sql-buffer)))
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1605
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1606
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1607
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1608 ;;;###autoload
51607
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1609 (defun sql-sqlite ()
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1610 "Run sqlite as an inferior process.
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1611
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1612 SQLite is free software.
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1613
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1614 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
1615 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
1616 `*SQL*'.
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1617
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1618 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
1619 the variables `sql-user', `sql-password', `sql-database', and
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1620 `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
1621 can be stored in the list `sql-sqlite-options'.
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1622
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1623 The buffer is put in sql-interactive-mode, giving commands for sending
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1624 input. See `sql-interactive-mode'.
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1625
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1626 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
1627 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
1628 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
1629 in the SQL buffer, after you start the process.
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1630 The default comes from `process-coding-system-alist' and
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1631 `default-process-coding-system'.
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1632
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1633 \(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
1634 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1635 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1636 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1637 (sql-get-login 'database)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1638 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1639 ;; Put all parameters to the program (if defined) in a list and call
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1640 ;; make-comint.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1641 (let ((params))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1642 (if (not (string= "" sql-database))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1643 (setq params (append (list sql-database) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1644 (if (not (string= "" sql-server))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1645 (setq params (append (list (concat "--host=" sql-server)) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1646 (if (not (string= "" sql-password))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1647 (setq params (append (list (concat "--password=" sql-password)) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1648 (if (not (string= "" sql-user))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1649 (setq params (append (list (concat "--user=" sql-user)) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1650 (if (not (null sql-sqlite-options))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1651 (setq params (append sql-sqlite-options params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1652 (set-buffer (apply 'make-comint "SQL" sql-sqlite-program
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1653 nil params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1654 (setq sql-prompt-regexp "^sqlite> ")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1655 (setq sql-prompt-length 8)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1656 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1657 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1658 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1659 (pop-to-buffer sql-buffer)))
51607
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1660
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1661
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1662
ead411a37669 Add support for SQLite interpreter.
Juanma Barranquero <lekktu@gmail.com>
parents: 48486
diff changeset
1663 ;;;###autoload
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1664 (defun sql-mysql ()
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1665 "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
1666
40432
225bd38b0ce7 (sql-mysql): Doc change by RMS.
Gerd Moellmann <gerd@gnu.org>
parents: 38872
diff changeset
1667 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
1668
24268
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
1669 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
1670 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
1671 `*SQL*'.
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1672
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1673 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
1674 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
1675 `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
1676 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
1677
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1678 The buffer is put in sql-interactive-mode, giving commands for sending
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1679 input. See `sql-interactive-mode'.
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1680
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1681 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
1682 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
1683 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
1684 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
1685 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
1686 `default-process-coding-system'.
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1687
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1688 \(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
1689 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1690 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1691 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1692 (sql-get-login 'user 'password 'database 'server)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1693 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1694 ;; Put all parameters to the program (if defined) in a list and call
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1695 ;; make-comint.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1696 (let ((params))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1697 (if (not (string= "" sql-database))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1698 (setq params (append (list sql-database) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1699 (if (not (string= "" sql-server))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1700 (setq params (append (list (concat "--host=" sql-server)) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1701 (if (not (string= "" sql-password))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1702 (setq params (append (list (concat "--password=" sql-password)) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1703 (if (not (string= "" sql-user))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1704 (setq params (append (list (concat "--user=" sql-user)) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1705 (if (not (null sql-mysql-options))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1706 (setq params (append sql-mysql-options params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1707 (set-buffer (apply 'make-comint "SQL" sql-mysql-program
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1708 nil params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1709 (setq sql-prompt-regexp "^mysql>")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1710 (setq sql-prompt-length 6)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1711 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1712 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1713 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1714 (pop-to-buffer sql-buffer)))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1715
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1716
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1717
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1718 ;;;###autoload
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1719 (defun sql-solid ()
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1720 "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
1721
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1722 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
1723 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
1724 `*SQL*'.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1725
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1726 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
1727 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
1728 defaults, if set.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1729
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1730 The buffer is put in sql-interactive-mode, giving commands for sending
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1731 input. See `sql-interactive-mode'.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1732
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1733 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
1734 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
1735 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
1736 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
1737 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
1738 `default-process-coding-system'.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1739
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1740 \(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
1741 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1742 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1743 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1744 (sql-get-login 'user 'password 'server)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1745 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1746 ;; Put all parameters to the program (if defined) in a list and call
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1747 ;; make-comint.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1748 (let ((params))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1749 ;; It only makes sense if both username and password are there.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1750 (if (not (or (string= "" sql-user)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1751 (string= "" sql-password)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1752 (setq params (append (list sql-user sql-password) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1753 (if (not (string= "" sql-server))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1754 (setq params (append (list sql-server) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1755 (set-buffer (apply 'make-comint "SQL" sql-solid-program
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1756 nil params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1757 (setq sql-prompt-regexp "^")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1758 (setq sql-prompt-length 0)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1759 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1760 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1761 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1762 (pop-to-buffer sql-buffer)))
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1763
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1764
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1765
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1766 ;;;###autoload
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1767 (defun sql-ingres ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1768 "Run sql by Ingres as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1769
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1770 If buffer `*SQL*' exists but no process is running, make a new process.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1771 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1772 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1773
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1774 Interpreter used comes from variable `sql-ingres-program'. Login uses
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1775 the variable `sql-database' as default, if set.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1776
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1777 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1778 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1779
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1780 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1781 in the input and output to the process, use \\[universal-coding-system-argument]
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1782 before \\[sql-ingres]. You can also specify this with \\[set-buffer-process-coding-system]
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1783 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1784 The default comes from `process-coding-system-alist' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1785 `default-process-coding-system'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1786
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1787 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1788 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1789 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1790 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1791 (sql-get-login 'database)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1792 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1793 ;; username and password are ignored.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1794 (if (string= "" sql-database)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1795 (set-buffer (make-comint "SQL" sql-ingres-program nil))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1796 (set-buffer (make-comint "SQL" sql-ingres-program nil sql-database)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1797 (setq sql-prompt-regexp "^\* ")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1798 (setq sql-prompt-length 2)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1799 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1800 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1801 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1802 (pop-to-buffer sql-buffer)))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1803
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1804
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1805
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1806 ;;;###autoload
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1807 (defun sql-ms ()
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1808 "Run isql by Microsoft as an inferior process.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1809
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1810 If buffer `*SQL*' exists but no process is running, make a new process.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1811 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1812 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1813
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1814 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
1815 variables `sql-user', `sql-password', `sql-database', and `sql-server'
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
1816 as defaults, if set. Additional command line parameters can be stored
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
1817 in the list `sql-ms-options'.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1818
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1819 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1820 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1821
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1822 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1823 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
1824 before \\[sql-ms]. You can also specify this with \\[set-buffer-process-coding-system]
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1825 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1826 The default comes from `process-coding-system-alist' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1827 `default-process-coding-system'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1828
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1829 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1830 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1831 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1832 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1833 (sql-get-login 'user 'password 'database 'server)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1834 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1835 ;; Put all parameters to the program (if defined) in a list and call
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1836 ;; make-comint.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1837 (let ((params sql-ms-options))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1838 (if (not (string= "" sql-server))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1839 (setq params (append (list "-S" sql-server) params)))
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1840 (if (not (string= "" sql-database))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1841 (setq params (append (list "-d" sql-database) params)))
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1842 (if (not (string= "" sql-user))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1843 (setq params (append (list "-U" sql-user) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1844 (if (not (string= "" sql-password))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1845 (setq params (append (list "-P" sql-password) params))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1846 ;; If -P is passed to ISQL as the last argument without a password,
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1847 ;; it's considered null.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1848 (setq params (append params (list "-P"))))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1849 (set-buffer (apply 'make-comint "SQL" sql-ms-program
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1850 nil params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1851 (setq sql-prompt-regexp "^[0-9]*>")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1852 (setq sql-prompt-length 5)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1853 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1854 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1855 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1856 (pop-to-buffer sql-buffer)))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1857
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1858
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1859
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1860 ;;;###autoload
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1861 (defun sql-postgres ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1862 "Run psql by Postgres as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1863
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1864 If buffer `*SQL*' exists but no process is running, make a new process.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1865 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1866 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1867
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1868 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
1869 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
1870 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
1871 `sql-postgres-options'.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1872
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1873 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1874 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1875
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1876 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1877 in the input and output to the process, use \\[universal-coding-system-argument]
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1878 before \\[sql-postgres]. You can also specify this with \\[set-buffer-process-coding-system]
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1879 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1880 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
1881 `default-process-coding-system'. If your output lines end with ^M,
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1882 your might try undecided-dos as a coding system. If this doesn't help,
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1883 Try to set `comint-output-filter-functions' like this:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1884
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1885 \(setq comint-output-filter-functions (append comint-output-filter-functions
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1886 '(comint-strip-ctrl-m)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1887
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1888 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1889 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1890 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1891 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1892 (sql-get-login 'database 'server)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1893 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1894 ;; username and password are ignored. Mark Stosberg suggest to add
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1895 ;; the database at the end. Jason Beegan suggest using --pset and
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1896 ;; pager=off instead of \\o|cat. The later was the solution by
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1897 ;; Gregor Zych. Jason's suggestion is the default value for
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1898 ;; sql-postgres-options.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1899 (let ((params sql-postgres-options))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1900 (if (not (string= "" sql-database))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1901 (setq params (append params (list sql-database))))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1902 (if (not (string= "" sql-server))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1903 (setq params (append (list "-h" sql-server) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1904 (set-buffer (apply 'make-comint "SQL" sql-postgres-program
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1905 nil params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1906 (setq sql-prompt-regexp "^.*> *")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1907 (setq sql-prompt-length 5)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1908 ;; This is a lousy hack to prevent psql from truncating it's output
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1909 ;; and giving stupid warnings. If s.o. knows a way to prevent psql
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1910 ;; from acting this way, then I would be very thankful to
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1911 ;; incorporate this (Gregor Zych <zych@pool.informatik.rwth-aachen.de>)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1912 ;; (comint-send-string "*SQL*" "\\o \| cat\n")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1913 (setq sql-mode-font-lock-keywords sql-mode-postgres-font-lock-keywords)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1914 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1915 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1916 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1917 (pop-to-buffer sql-buffer)))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1918
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1919
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1920
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1921 ;;;###autoload
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1922 (defun sql-interbase ()
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1923 "Run isql by Interbase as an inferior process.
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1924
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1925 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
1926 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
1927 `*SQL*'.
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1928
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1929 Interpreter used comes from variable `sql-interbase-program'. Login
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1930 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
1931 defaults, if set.
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1932
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1933 The buffer is put in sql-interactive-mode, giving commands for sending
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1934 input. See `sql-interactive-mode'.
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1935
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1936 To specify a coding system for converting non-ASCII characters
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1937 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
1938 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
1939 in the SQL buffer, after you start the process.
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1940 The default comes from `process-coding-system-alist' and
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1941 `default-process-coding-system'.
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1942
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1943 \(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
1944 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1945 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1946 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1947 (sql-get-login 'user 'password 'database)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1948 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1949 ;; Put all parameters to the program (if defined) in a list and call
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1950 ;; make-comint.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1951 (let ((params sql-interbase-options))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1952 (if (not (string= "" sql-user))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1953 (setq params (append (list "-u" sql-user) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1954 (if (not (string= "" sql-password))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1955 (setq params (append (list "-p" sql-password) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1956 (if (not (string= "" sql-database))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1957 (setq params (cons sql-database params))); add to the front!
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1958 (set-buffer (apply 'make-comint "SQL" sql-interbase-program
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1959 nil params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1960 (setq sql-prompt-regexp "^SQL> ")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1961 (setq sql-prompt-length 5)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1962 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1963 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1964 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1965 (pop-to-buffer sql-buffer)))
36571
54a8a84a22f6 (sql-interbase): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36523
diff changeset
1966
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1967
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1968
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1969 ;;;###autoload
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1970 (defun sql-db2 ()
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1971 "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
1972
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1973 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
1974 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
1975 `*SQL*'.
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1976
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1977 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
1978 automatic login.
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1979
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1980 The buffer is put in sql-interactive-mode, giving commands for sending
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1981 input. See `sql-interactive-mode'.
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1982
38872
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
1983 If you use \\[sql-accumulate-and-indent] to send multiline commands to
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
1984 db2, newlines will be escaped if necessary. If you don't want that, set
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
1985 `comint-input-sender' back to `comint-simple-send' by writing an after
56c16908b24f (sql-db2): Doc change.
Gerd Moellmann <gerd@gnu.org>
parents: 37409
diff changeset
1986 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
1987
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1988 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
1989 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
1990 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
1991 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
1992 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
1993 `default-process-coding-system'.
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1994
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
1995 \(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
1996 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1997 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1998 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1999 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2000 ;; Put all parameters to the program (if defined) in a list and call
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2001 ;; make-comint.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2002 (set-buffer (apply 'make-comint "SQL" sql-db2-program
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2003 nil sql-db2-options))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2004 (setq sql-prompt-regexp "^db2 => ")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2005 (setq sql-prompt-length 7)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2006 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2007 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2008 ;; Escape newlines. This must come after sql-interactive-mode
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2009 ;; because all local variables will be killed, there.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2010 (setq comint-input-sender 'sql-escape-newlines-and-send)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2011 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2012 (pop-to-buffer sql-buffer)))
37409
9781f3a3c955 (sql-escape-newlines-and-send): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36571
diff changeset
2013
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2014 ;;;###autoload
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2015 (defun sql-linter ()
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2016 "Run inl by RELEX as an inferior process.
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2017
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2018 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
2019 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
2020 `*SQL*'.
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2021
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2022 Interpreter used comes from variable `sql-linter-program' - usually `inl'.
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2023 Login uses the variables `sql-user', `sql-password', `sql-database' and
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2024 `sql-server' as defaults, if set. Additional command line parameters
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2025 can be stored in the list `sql-linter-options'. Run inl -h to get help on
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2026 parameters.
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2027
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2028 `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
2029 local connections, `sql-server' refers to the server name from the
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2030 `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
2031 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
2032 an empty password.
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2033
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2034 The buffer is put in sql-interactive-mode, giving commands for sending
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2035 input. See `sql-interactive-mode'.
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2036
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2037 To use LINTER font locking by default, put this line into your .emacs :
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2038 (setq sql-mode-font-lock-keywords sql-mode-linter-font-lock-keywords)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2039
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2040 \(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
2041 (interactive)
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2042 (if (comint-check-proc "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2043 (pop-to-buffer "*SQL*")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2044 (sql-get-login 'user 'password 'database 'server)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2045 (message "Login...")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2046 ;; Put all parameters to the program (if defined) in a list and call
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2047 ;; make-comint.
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2048 (let ((params sql-linter-options) (login nil) (old-mbx (getenv "LINTER_MBX")))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2049 (if (not (string= "" sql-user))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2050 (setq login (concat sql-user "/" sql-password)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2051 (setq params (append (list "-u" login) params))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2052 (if (not (string= "" sql-server))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2053 (setq params (append (list "-n" sql-server) params)))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2054 (if (string= "" sql-database)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2055 (setenv "LINTER_MBX" nil)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2056 (setenv "LINTER_MBX" sql-database))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2057 (set-buffer (apply 'make-comint "SQL" sql-linter-program nil
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2058 params))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2059 (setenv "LINTER_MBX" old-mbx)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2060 )
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2061 (setq sql-prompt-regexp "^SQL>")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2062 (setq sql-prompt-length 4)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2063 (setq sql-buffer (current-buffer))
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2064 (sql-interactive-mode)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2065 (message "Login...done")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2066 (pop-to-buffer sql-buffer)))
48486
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2067
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2068
893d44670df9 Added LINTER support.
Juanma Barranquero <lekktu@gmail.com>
parents: 42799
diff changeset
2069
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2070 (provide 'sql)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2071
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2072 ;;; sql.el ends here