annotate lisp/progmodes/sql.el @ 35737:1dedd00219d5

*** empty log message ***
author Gerd Moellmann <gerd@gnu.org>
date Tue, 30 Jan 2001 15:09:25 +0000
parents 7cb3b80e66b8
children e72a04113eac
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
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000 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>
34704
7cb3b80e66b8 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32621
diff changeset
7 ;; Version: 1.4.24
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
8 ;; Keywords: comm languages processes
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; 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
14 ;; the Free Software Foundation; either version 2, or (at your option)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; any later version.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; 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
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; Boston, MA 02111-1307, USA.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;; Commentary:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
24354
6a438ef0b573 Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents: 24353
diff changeset
29 ;; 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
30 ;; 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
31 ;; 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
32 ;; LASTNAME' in the mail body.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; 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
35 ;; were two simple modes providing syntactic hilighting. The
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; interactive mode had to provide a command-line history; the other
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; mode had to provide "send region/buffer to SQL interpreter"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; 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
39 ;; maintain and little or no bells and whistles.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; 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
42 ;; 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
43 ;; this proves to be difficult, please suggest changes that will
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; facilitate your plans.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; 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
47 ;; 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
48 ;; 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
49 ;; *not* call sql-interactive-mode by itself.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; 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
52 ;; entry function used to create the SQLi buffers is shown with
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;; `sql-help' (M-x sql-help).
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; Since sql-interactive-mode is built on top of the general
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; command-interpreter-in-a-buffer mode (comint mode), it shares a
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;; common base functionality, and a common set of bindings, with all
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;; modes derived from comint mode. This makes these modes easier to
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; use.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
61 ;; 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
62 ;; 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
63
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;; For documentation on the functionality provided by comint mode, and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;; the hooks available for customising it, see the file `comint.el'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
67 ;; 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
68 ;; `imenu-add-menubar-index'.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;;; Requirements for Emacs 19.34:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;; 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
73 ;; the file regexp-opt.el
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;; <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
75 ;; and the custom package
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;; <URL:http://www.dina.kvl.dk/~abraham/custom/>.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ;;; Bugs:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ;; Using sql-ms (isql by Microsoft): When commands with syntax errors
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ;; or execution errors are executed, there is no server feedback.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;; This happens in stored procedures for example. The server messages
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 ;; only appear after the process is exited. This makes things
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;; somewhat unreliable.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
86 ;; ChangeLog available on request.
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
87
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 ;;; To Do:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;; Add better hilight support for other brands; there is a bias towards
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 ;; Oracle because that's what I use at work. Anybody else just send in
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
92 ;; your lists of reserved words, keywords and builtin functions! As
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
93 ;; long as I don't receive any feedback, everything is hilighted with
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
94 ;; ANSI keywords only. I received the list of ANSI keywords from a
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
95 ;; user; if you know of any changes, let me know.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ;; Add different hilighting levels.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 ;;; Thanks to all the people who helped me out:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 ;; Kai Blauberg <kai.blauberg@metla.fi>
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 ;; <ibalaban@dalet.com>
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;; Yair Friedman <yfriedma@JohnBryce.Co.Il>
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 ;; 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
105 ;; nino <nino@inform.dk>
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
106 ;; Berend de Boer <berend@pobox.com>
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
107
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108
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 ;;; Code:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (require 'comint)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 ;; Need the following to allow GNU Emacs 19 to compile the file.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (require 'regexp-opt)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (require 'custom)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 ;;; Allow customization
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (defgroup SQL nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 "Running a SQL interpreter from within Emacs buffers"
24556
cfdf441b1331 Add defgroup :version.
Dave Love <fx@gnu.org>
parents: 24354
diff changeset
121 :version "20.4"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 :group 'processes)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 ;; These three variables will be used as defaults, if set.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (defcustom sql-user ""
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 "*Default username."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 :type 'string
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (defcustom sql-password ""
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 "*Default password.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 Storing your password in a textfile such as ~/.emacs could be dangerous.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 Customizing your password will store it in your ~/.emacs file."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 :type 'string
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (defcustom sql-database ""
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 "*Default database."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 :type 'string
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (defcustom sql-server ""
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
145 "*Default server or host."
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 :type 'string
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
149 ;; misc customization of sql.el behaviour
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
150
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
151 (defcustom sql-electric-stuff nil
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
152 "Treat some input as electric.
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
153 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
154 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
155 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
156 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
157 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
158 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
159 :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
160 (const :tag "The semikolon `;'" semicolon)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
161 (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
162 :version "20.8"
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
163 :group 'SQL)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
164
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (defcustom sql-pop-to-buffer-after-send-region nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 "*If t, pop to the buffer SQL statements are sent to.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 After a call to `sql-send-region' or `sql-send-buffer',
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 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
170 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
171 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
172 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
173 :type 'boolean
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
174 :group 'SQL)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
175
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
176 ;; imenu support for sql-mode.
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
177
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
178 (defvar sql-imenu-generic-expression
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
179 '(("Tables" "^\\s-*create\\s-+table\\s-+\\(\\w+\\)" 1)
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
180 ("Indexes" "^\\s-*create\\s-+index\\s-+\\(\\w+\\)" 1))
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
181 "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
182
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
183 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
184 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
185 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
186 local variable.")
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
187
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
188 ;; history file
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
189
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
190 (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
191 "*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
192
24861
0d593aa15c0f (sql-input-ring-file-name): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 24591
diff changeset
193 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
194 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
195 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
196 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
197 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
198
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
199 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
200
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
201 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
202 `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
203 :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
204 (file))
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
205 :group 'SQL)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
206
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
207 (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
208 "*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
209
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
210 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
211 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
212 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
213
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
214 This variable used to initialize `comint-input-ring-separator'.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
215 `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
216 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
217 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
218 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
219 `sql-input-ring-separator' to \"\\n\"."
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 :type 'string
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 ;; The usual hooks
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 (defcustom sql-interactive-mode-hook '()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 "*Hook for customising `sql-interactive-mode'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 :type 'hook
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 (defcustom sql-mode-hook '()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 "*Hook for customising `sql-mode'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 :type 'hook
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
235 (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
236 "*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
237
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
238 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
239 is changed."
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
240 :type 'hook
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
241 :group 'SQL)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
242
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 ;; Customisation for Oracle
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 (defcustom sql-oracle-program "sqlplus"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 "*Command to start sqlplus by Oracle.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 Under NT, \"sqlplus\" usually starts the sqlplus \"GUI\". In order to
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 start the sqlplus console, use \"plus33\" or something similar. You
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 will find the file in your Orant\\bin directory.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
258 (defcustom sql-oracle-options nil
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
259 "*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
260 :type '(repeat string)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
261 :version "20.8"
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
262 :group 'SQL)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
263
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
264 ;; Customisation for MySql
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
265
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
266 (defcustom sql-mysql-program "mysql"
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
267 "*Command to start mysql by TcX.
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
268
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
269 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
270
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
271 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
272 :type 'file
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
273 :group 'SQL)
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
274
32169
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
275 (defcustom sql-mysql-options nil
34704
7cb3b80e66b8 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32621
diff changeset
276 "*List of additional options for `sql-mysql-program'.
7cb3b80e66b8 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32621
diff changeset
277 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
278 on Windows: \"-C\" \"-t\" \"-f\" \"-n\"."
32169
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
279 :type '(repeat string)
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
280 :version "20.8"
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
281 :group 'SQL)
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
282
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
283 ;; Customisation for Solid
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
284
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
285 (defcustom sql-solid-program "solsql"
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
286 "*Command to start SOLID SQL Editor.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
287
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
288 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
289
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
290 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
291 :type 'file
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
292 :group 'SQL)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
293
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 ;; Customisation for SyBase
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 (defcustom sql-sybase-program "isql"
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
297 "*Command to start isql by SyBase.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304
32621
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
305 (defcustom sql-sybase-options nil
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
306 "*List of additional options for `sql-sybase-program'.
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
307 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
308 :type '(repeat string)
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
309 :version "20.8"
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
310 :group 'SQL)
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
311
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 ;; Customisation for Informix
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (defcustom sql-informix-program "dbaccess"
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
315 "*Command to start dbaccess by Informix.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 Starts `sql-interactive-mode' after doing some setup.
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 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 ;; Customisation for Ingres
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 (defcustom sql-ingres-program "sql"
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
326 "*Command to start sql by Ingres.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 :group 'SQL)
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 ;; Customisation for Microsoft
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 (defcustom sql-ms-program "isql"
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
337 "*Command to start isql by Microsoft.
24050
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 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 :group 'SQL)
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 ;; Customisation for Postgres
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 (defcustom sql-postgres-program "psql"
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
348 "Command to start psql by Postgres.
24050
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 Starts `sql-interactive-mode' after doing some setup.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 The program can also specify a TCP connection. See `make-comint'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 :type 'file
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 :group 'SQL)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355
34704
7cb3b80e66b8 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32621
diff changeset
356 (defcustom sql-postgres-options '("-P" "pager=off")
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
357 "*List of additional options for `sql-postgres-program'.
34704
7cb3b80e66b8 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32621
diff changeset
358 The default setting includes the -P option which breaks
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
359 older versions of the psql client (such as version 6.5.3).
34704
7cb3b80e66b8 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32621
diff changeset
360 The -P option is equivalent to the --pset option.
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
361 If you want the psql to prompt you for a user name, add the
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
362 string \"-u\" to the list of options."
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
363 :type '(repeat string)
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
364 :version "20.8"
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
365 :group 'SQL)
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
366
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 ;;; Variables which do not need customization
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 (defvar sql-user-history nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 "History of usernames used.")
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 (defvar sql-database-history nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 "History of databases used.")
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 (defvar sql-server-history nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 "History of servers used.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 ;; Passwords are not kept in a history.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (defvar sql-buffer nil
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
383 "Current SQLi buffer.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
384
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
385 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
386 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
387 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
388 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
389 the local value of `sql-buffer' using \\[sql-set-sqli-buffer].")
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 (defvar sql-prompt-regexp nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 "Prompt used to initialize `comint-prompt-regexp'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 You can change `comint-prompt-regexp' on `sql-interactive-mode-hook'.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
396 (defvar sql-prompt-length 0
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
397 "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
398
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
399 You can change it on `sql-interactive-mode-hook'.")
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
400
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
401 (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
402 "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
403
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
404 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
405
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
406 ;; Keymap for sql-interactive-mode.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
408 (defvar sql-interactive-mode-map
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
409 (let ((map (make-sparse-keymap)))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
410 (if (functionp 'set-keymap-parent)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
411 (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
412 (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
413 (if (functionp 'set-keymap-name)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
414 (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
415 (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
416 (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
417 (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
418 (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
419 (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
420 map)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
421 "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
422 Based on `comint-mode-map'.")
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 ;; Keymap for sql-mode.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 (defvar sql-mode-map
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 (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
428 (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
429 (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
430 (define-key map (kbd "C-c C-b") 'sql-send-buffer)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 map)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 "Mode map used for `sql-mode'.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 ;; easy menu for sql-mode.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
436 (easy-menu-define
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
437 sql-mode-menu sql-mode-map
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 "Menu for `sql-mode'."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 '("SQL"
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
440 ["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
441 (get-buffer-process sql-buffer))]
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
442 ["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
443 mark-active)
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
444 (mark)); XEmacs
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
445 (buffer-live-p sql-buffer)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
446 (get-buffer-process sql-buffer))]
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
447 ["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
448 (get-buffer-process sql-buffer))]
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
449 ["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
450 ["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
451 ["Pop to SQLi buffer after send"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 sql-toggle-pop-to-buffer-after-send-region
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 :style toggle
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 :selected sql-pop-to-buffer-after-send-region]))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
456 ;; 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
457
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
458 (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
459 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
460 "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
461 '("SQL"
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
462 ["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
463
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 ;; Abbreviations -- if you want more of them, define them in your
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 ;; ~/.emacs file. Abbrevs have to be enabled in your ~/.emacs, too.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 (defvar sql-mode-abbrev-table nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 "Abbrev table used in `sql-mode' and `sql-interactive-mode'.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 (if sql-mode-abbrev-table
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 (let ((wrapper))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 (define-abbrev-table 'sql-mode-abbrev-table ())
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 (define-abbrev sql-mode-abbrev-table "ins" "insert" nil)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (define-abbrev sql-mode-abbrev-table "upd" "update" nil)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 (define-abbrev sql-mode-abbrev-table "del" "delete" nil)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 (define-abbrev sql-mode-abbrev-table "sel" "select" nil)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 ;; Syntax Table
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
480 (defvar sql-mode-syntax-table
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 (let ((table (make-syntax-table)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 ;; C-style comments /**/ (see elisp manual "Syntax Flags"))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 (modify-syntax-entry ?/ ". 14" table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 (modify-syntax-entry ?* ". 23" table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 ;; 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
486 (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
487 (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
488 (modify-syntax-entry ?- ". 12b" table))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 ;; newline and formfeed end coments
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 (modify-syntax-entry ?\n "> b" table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 (modify-syntax-entry ?\f "> b" table)
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
492 ;; single quotes (') quotes delimit strings
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
493 (modify-syntax-entry ?' "\"" table)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 "Syntax table used in `sql-mode' and `sql-interactive-mode'.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 ;; Font lock support
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 (defvar sql-mode-ansi-font-lock-keywords nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 "ANSI SQL keywords used by font-lock.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 This variable is used by `sql-mode' and `sql-interactive-mode'. The
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 regular expressions are created during compilation by calling the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 function `regexp-opt'. Therefore, take a look at the source before
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 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
506 add functions and PL/SQL keywords.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 (if sql-mode-ansi-font-lock-keywords
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 (let ((ansi-keywords (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 (regexp-opt '(
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 "authorization" "avg" "begin" "close" "cobol" "commit"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 "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
514 "exec" "fetch" "foreign" "fortran" "found" "go" "goto" "indicator"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 "key" "language" "max" "min" "module" "numeric" "open" "pascal" "pli"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 "precision" "primary" "procedure" "references" "rollback"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 "schema" "section" "some" "sqlcode" "sqlerror" "sum" "work") t) "\\b")))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 (ansi-reserved-words (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 (regexp-opt '(
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 "all" "and" "any" "as" "asc" "between" "by" "check" "create"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 "current" "default" "delete" "desc" "distinct" "exists" "float" "for"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 "from" "grant" "group" "having" "in" "insert" "into" "is"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 "like" "not" "null" "of" "on" "option" "or" "order" "privileges"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 "public" "select" "set" "table" "to" "union" "unique"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526 "update" "user" "values" "view" "where" "with") t) "\\b")))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 (ansi-types (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 (regexp-opt '(
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
530 ;; ANSI Keywords that look like types
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
531 "character" "cursor" "dec" "int" "real"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 ;; ANSI Reserved Word that look like types
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 "char" "integer" "smallint" ) t) "\\b"))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 (setq 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
535 (list (cons ansi-keywords 'font-lock-function-name-face)
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
536 (cons ansi-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
537 (cons ansi-types 'font-lock-type-face)))))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 (defvar sql-mode-oracle-font-lock-keywords nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 "Oracle SQL keywords used by font-lock.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 This variable is used by `sql-mode' and `sql-interactive-mode'. The
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 regular expressions are created during compilation by calling the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 function `regexp-opt'. Therefore, take a look at the source before
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 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
546 to add functions and PL/SQL keywords.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 (if sql-mode-oracle-font-lock-keywords
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 (let ((oracle-keywords (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 (regexp-opt '(
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 "admin" "after" "allocate" "analyze" "archive" "archivelog" "backup"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 "become" "before" "block" "body" "cache" "cancel" "cascade" "change"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 "checkpoint" "compile" "constraint" "constraints" "contents"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 "controlfile" "cycle" "database" "datafile" "dba" "disable" "dismount"
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
556 "dump" "each" "else" "elsif" "enable" "events" "except" "exceptions"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
557 "execute" "exit" "explain" "extent" "externally" "false" "flush" "force"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
558 "freelist" "freelists" "function" "groups" "if" "including" "initrans"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
559 "instance" "layer" "link" "lists" "logfile" "loop" "manage" "manual"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
560 "maxdatafiles" "maxinistances" "maxlogfiles" "maxloghistory"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
561 "maxlogmembers" "maxtrans" "maxvalue" "minextents" "minvalue" "mount"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
562 "new" "next" "noarchivelog" "nocache" "nocycle" "nomaxvalue"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
563 "nominvalue" "none" "noorder" "noresetlogs" "normal" "nosort" "off"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
564 "old" "only" "optimal" "others" "out" "own" "package" "parallel"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
565 "pctincrease" "pctused" "plan" "pragma" "private" "profile" "quota"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
566 "raise" "read" "recover" "referencing" "resetlogs" "restrict_references"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
567 "restricted" "return" "returning" "reuse" "rnds" "rnps" "role" "roles"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
568 "savepoint" "scn" "segment" "sequence" "shared" "snapshot" "sort"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
569 "statement_id" "statistics" "stop" "storage" "subtype" "switch" "system"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 "tables" "tablespace" "temporary" "thread" "time" "tracing"
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
571 "transaction" "triggers" "true" "truncate" "type" "under" "unlimited"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
572 "until" "use" "using" "when" "while" "wnds" "wnps" "write") t) "\\b")))
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
573 (oracle-warning-words (eval-when-compile
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
574 (concat "\\b"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
575 (regexp-opt '(
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
576 "cursor_already_open" "dup_val_on_index" "exception" "invalid_cursor"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
577 "invalid_number" "login_denied" "no_data_found" "not_logged_on"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
578 "notfound" "others" "pragma" "program_error" "storage_error"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
579 "timeout_on_resource" "too_many_rows" "transaction_backed_out"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
580 "value_error" "zero_divide") t) "\\b")))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 (oracle-reserved-words (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 (regexp-opt '(
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 "access" "add" "alter" "audit" "cluster" "column" "comment" "compress"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 "connect" "drop" "else" "exclusive" "file" "grant"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 "identified" "immediate" "increment" "index" "initial" "intersect"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 "level" "lock" "long" "maxextents" "minus" "mode" "modify" "noaudit"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 "nocompress" "nowait" "number" "offline" "online" "pctfree" "prior"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 "raw" "rename" "resource" "revoke" "row" "rowlabel" "rownum"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 "rows" "session" "share" "size" "start" "successful" "synonym" "sysdate"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 "then" "trigger" "uid" "validate" "whenever") t) "\\b")))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592 (oracle-types (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594 (regexp-opt '(
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 ;; Oracle Keywords that look like types
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 ;; Oracle Reserved Words that look like types
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
597 "binary_integer" "blob" "boolean" "constant" "date" "decimal" "rowid"
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
598 "varchar" "varchar2") t) "\\b")))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 (oracle-builtin-functions (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 (regexp-opt '(
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 ;; Misc Oracle builtin functions
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 "abs" "add_months" "ascii" "avg" "ceil" "chartorowid" "chr" "concat"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 "convert" "cos" "cosh" "count" "currval" "decode" "dump" "exp" "floor"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 "glb" "greatest" "greatest_lb" "hextoraw" "initcap" "instr" "instrb"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 "last_day" "least" "least_ub" "length" "lengthb" "ln" "log" "lower"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 "lpad" "ltrim" "lub" "max" "min" "mod" "months_between" "new_time"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608 "next_day" "nextval" "nls_initcap" "nls_lower" "nls_upper" "nlssort"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 "nvl" "power" "rawtohex" "replace" "round" "rowidtochar" "rpad"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 "rtrim" "sign" "sin" "sinh" "soundex" "sqlcode" "sqlerrm" "sqrt"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 "stddev" "sum" "substr" "substrb" "tan" "tanh" "to_char"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 "to_date" "to_label" "to_multi_byte" "to_number" "to_single_byte"
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
613 "translate" "trim" "trunc" "uid" "upper" "userenv" "variance" "vsize") t) "\\b"))))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 (setq sql-mode-oracle-font-lock-keywords
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 (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
616 (list (cons oracle-keywords 'font-lock-function-name-face)
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
617 (cons oracle-warning-words 'font-lock-warning-face)
24058
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
618 (cons oracle-reserved-words 'font-lock-keyword-face)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619 ;; XEmacs doesn't have font-lock-builtin-face
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 (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
621 (cons oracle-builtin-functions 'font-lock-preprocessor-face)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622 ;; GNU Emacs 19 doesn't have it either
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
623 (if (string-match "GNU Emacs 19" emacs-version)
24058
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
624 (cons oracle-builtin-functions 'font-lock-function-name-face)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625 ;; Emacs
24058
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
626 (cons oracle-builtin-functions 'font-lock-builtin-face)))
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
627 (cons oracle-types 'font-lock-type-face))))))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 (defvar sql-mode-postgres-font-lock-keywords nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 "Postgres SQL keywords used by font-lock.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 This variable is used by `sql-mode' and `sql-interactive-mode'. The
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 regular expressions are created during compilation by calling the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 function `regexp-opt'. Therefore, take a look at the source before
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 you define your own sql-mode-postgres-font-lock-keywords.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 (if sql-mode-postgres-font-lock-keywords
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 (let ((postgres-reserved-words (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 (regexp-opt '(
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 "language"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 ) t) "\\b")))
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
644 (postgres-types (eval-when-compile
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
645 (concat "\\b"
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
646 (regexp-opt '(
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
647 "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
648 "float4" "float8" "int2" "int4" "int8" "line" "lseg" "money" "path"
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 "point" "polygon" "serial" "text" "time" "timespan" "timestamp" "varchar"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 ) t)"\\b")))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 (postgres-builtin-functions (eval-when-compile
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 (concat "\\b"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 (regexp-opt '(
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 ;; Misc Postgres builtin functions
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 "abstime" "age" "area" "box" "center" "date_part" "date_trunc"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 "datetime" "dexp" "diameter" "dpow" "float" "float4" "height"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 "initcap" "integer" "isclosed" "isfinite" "isoldpath" "isopen"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 "length" "lower" "lpad" "ltrim" "pclose" "point" "points" "popen"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 "position" "radius" "reltime" "revertpoly" "rpad" "rtrim" "substr"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 "substring" "text" "timespan" "translate" "trim" "upgradepath"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661 "upgradepoly" "upper" "varchar" "width"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 ) t) "\\b"))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 (setq sql-mode-postgres-font-lock-keywords
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 (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
665 (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
666 ;; XEmacs doesn't have 'font-lock-builtin-face
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 (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
668 (cons postgres-builtin-functions 'font-lock-preprocessor-face)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 ;; Emacs
24058
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
670 (cons postgres-builtin-functions 'font-lock-builtin-face))
85622273d1e8 (sql-mode-ansi-font-lock-keywords): Quote font-lock
Karl Heuer <kwzh@gnu.org>
parents: 24050
diff changeset
671 (cons postgres-types 'font-lock-type-face))))))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 (defvar sql-mode-font-lock-keywords sql-mode-ansi-font-lock-keywords
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 "SQL keywords used by font-lock.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 This variable defaults to `sql-mode-ansi-font-lock-keywords'. This is
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678 used for the default `font-lock-defaults' value in `sql-mode'. This
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 can be changed by some entry functions to provide more hilighting.")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681
30905
2069c10bf952 (sql-magic-go): Use comint-bol.
Gerd Moellmann <gerd@gnu.org>
parents: 30838
diff changeset
682
30838
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
683 ;;; Compatibility functions
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
684
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
685 (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
686 ;; 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
687 (defun comint-line-beginning-position ()
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
688 "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
689 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
690 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
691 (save-excursion (comint-bol nil) (point))))
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
692
c9f793802722 Add compatibility definition of comint-line-beginning-position.
Miles Bader <miles@gnu.org>
parents: 30642
diff changeset
693
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 ;;; Small functions
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
697 (defun sql-magic-go (arg)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
698 "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
699 `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
700 (interactive "P")
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
701 (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
702 (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
703 (save-excursion
30642
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
704 (comint-bol nil)
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
705 (looking-at "go\\b")))
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
706 (comint-send-input)))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
707
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
708 (defun sql-magic-semicolon (arg)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
709 "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
710 `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
711 (interactive "P")
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
712 (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
713 (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
714 (comint-send-input)))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
715
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 (defun sql-accumulate-and-indent ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 "Continue SQL statement on the next line."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 (interactive)
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
719 (if (fboundp 'comint-accumulate)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
720 (comint-accumulate)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
721 (newline))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 (indent-according-to-mode))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 ;;;###autoload
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725 (defun sql-help ()
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
726 "Show short help for the SQL modes.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728 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
729 usually named `*SQL*'. The name of the major mode is SQLi.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 Use the following commands to start a specific SQL interpreter:
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
733 PostGres: \\[sql-postgres]
24268
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
734
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
735 Other non-free SQL implementations are also supported:
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
736
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
737 MySQL: \\[sql-mysql]
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
738 Solid: \\[sql-solid]
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
739 Oracle: \\[sql-oracle]
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
740 Informix: \\[sql-informix]
24268
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
741 Sybase: \\[sql-sybase]
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
742 Ingres: \\[sql-ingres]
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
743 Microsoft: \\[sql-ms]
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
744
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
745 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
746
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 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
748 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
749 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
750 that help you navigate through the buffer, the input history, etc.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
751
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
752 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
753 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
754 `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
755 anything. The name of the major mode is SQL.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
756
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
757 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
758 buffer to the interactive SQL buffer (SQLi mode). The results are
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
759 appended to the SQLi buffer without disturbing your SQL buffer."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
760 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
761 (describe-function 'sql-help))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
762
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
763 (defun sql-read-passwd (prompt &optional default)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
764 "Read a password using PROMPT.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
765 Optional DEFAULT is password to start with. This function calls
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
766 `read-passwd' if it is available. If not, function
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
767 `ange-ftp-read-passwd' is called. This should always be available,
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
768 even in old versions of Emacs."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
769 (if (fboundp 'read-passwd)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
770 (read-passwd prompt nil default)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
771 (unless (fboundp 'ange-ftp-read-passwd)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
772 (autoload 'ange-ftp-read-passwd "ange-ftp"))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773 (ange-ftp-read-passwd prompt default)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
774
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
775 (defun sql-get-login (&rest what)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
776 "Get username, password and database from the user.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
777
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
778 The variables `sql-user', `sql-password', `sql-server', and
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
779 `sql-database' can be customised. They are used as the default values.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
780 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
781 `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
782 in a history.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
783
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
784 Parameter WHAT is a list of the arguments passed to this function.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
785 The function asks for the username if WHAT contains symbol `user', for
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
786 the password if it contains symbol `password', for the server if it
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
787 contains symbol `server', and for the database if it contains symbol
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
788 `database'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
789
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
790 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
791 function like this: (sql-get-login 'user 'password 'database)."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
792 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
793 (if (memq 'user what)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
794 (setq sql-user
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
795 (read-from-minibuffer "User: " sql-user nil nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
796 sql-user-history)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
797 (if (memq 'password what)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
798 (setq sql-password
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
799 (sql-read-passwd "Password: " sql-password)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
800 (if (memq 'server what)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
801 (setq sql-server
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
802 (read-from-minibuffer "Server: " sql-server nil nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
803 sql-server-history)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
804 (if (memq 'database what)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
805 (setq sql-database
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
806 (read-from-minibuffer "Database: " sql-database nil nil
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
807 sql-database-history))))
25381
970b18c6803f (sql-sybase): use sql-server instead of sql-database.
Alex Schroeder <alex@gnu.org>
parents: 25183
diff changeset
808
26576
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
809 (defun sql-find-sqli-buffer ()
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
810 "Return the current default SQLi buffer or nil.
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
811 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
812 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
813 (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
814 (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
815 (get-buffer-process default-buffer))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
816 default-buffer
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
817 (save-excursion
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
818 (let ((buflist (buffer-list))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
819 (found))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
820 (while (not (or (null buflist)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
821 found))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
822 (let ((candidate (car buflist)))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
823 (set-buffer candidate)
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
824 (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
825 (get-buffer-process candidate))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
826 (setq found candidate))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
827 (setq buflist (cdr buflist))))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
828 found)))))
26576
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
829
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
830 (defun sql-set-sqli-buffer-generally ()
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
831 "Set SQLi buffer for all SQL buffers that have none.
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
832 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
833 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
834 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
835 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
836 `sql-set-sqli-hook' is run."
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
837 (interactive)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
838 (save-excursion
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
839 (let ((buflist (buffer-list))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
840 (default-sqli-buffer (sql-find-sqli-buffer)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
841 (setq-default sql-buffer default-sqli-buffer)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
842 (while (not (null buflist))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
843 (let ((candidate (car buflist)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
844 (set-buffer candidate)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
845 (if (and (equal major-mode 'sql-mode)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
846 (not (buffer-live-p sql-buffer)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
847 (progn
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
848 (setq sql-buffer default-sqli-buffer)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
849 (run-hooks 'sql-set-sqli-hook))))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
850 (setq buflist (cdr buflist))))))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
851
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
852 (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
853 "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
854
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
855 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
856 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
857 `sql-set-sqli-hook'.
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
858
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
859 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
860 `sql-buffer'.
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
861
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
862 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
863 `sql-buffer'."
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
864 (interactive)
26576
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
865 (let ((default-buffer (sql-find-sqli-buffer)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
866 (if (null default-buffer)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
867 (error "There is no suitable SQLi buffer"))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
868 (let ((new-buffer
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
869 (get-buffer
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
870 (read-buffer "New SQLi buffer: " default-buffer t))))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
871 (if (null (get-buffer-process new-buffer))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
872 (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
873 (if (null (save-excursion
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
874 (set-buffer new-buffer)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
875 (equal major-mode 'sql-interactive-mode)))
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
876 (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
877 (if new-buffer
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
878 (progn
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
879 (setq sql-buffer new-buffer)
0894b3c8dfd6 (sql-find-sqli-buffer): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 25826
diff changeset
880 (run-hooks 'sql-set-sqli-hook))))))
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
881
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
882 (defun sql-show-sqli-buffer ()
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
883 "Show the name of current SQLi buffer.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
884
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
885 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
886 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
887 (interactive)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
888 (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
889 (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
890 (if (null (get-buffer-process sql-buffer))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
891 (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
892 (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
893
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
894 (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
895 "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
896
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
897 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
898 `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
899 (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
900 (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
901 ()
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
902 (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
903 (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
904 (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
905 (if (string= "" sql-server)
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
906 (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
907 sql-server)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
908 sql-database)))
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
909
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
910 (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
911 "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
912 (interactive)
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
913 (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
914
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
915 (defun sql-copy-column ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
916 "Copy current column to the end of buffer.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
917 Inserts SELECT or commas if appropriate."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
918 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
919 (let ((column))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
920 (save-excursion
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
921 (setq column (buffer-substring
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
922 (progn (forward-char 1) (backward-sexp 1) (point))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
923 (progn (forward-sexp 1) (point))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
924 (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
925 (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
926 (cond
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
927 ;; 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
928 ((= bol (point))
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
929 (insert "SELECT "))
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
930 ;; 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
931 ((save-excursion
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
932 (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
933 bol t))
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
934 (insert ", "))
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
935 ;; else insert a space
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
936 (t
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
937 (if (eq (preceding-char) ? )
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
938 nil
ae938744b6b1 (sql-magic-go): Use comint-bol instead of explicitly matching
Miles Bader <miles@gnu.org>
parents: 30513
diff changeset
939 (insert " ")))))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
940 ;; in any case, insert the column
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
941 (insert column)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
942 (message "%s" column))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
943
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
944 ;; 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
945 ;; is not attached to a character device; therefore placeholder
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
946 ;; 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
947 ;; Emacs query for the placeholders.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
948
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
949 (defvar sql-placeholder-history nil
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
950 "History of placeholder values used.")
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
951
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
952 (defun sql-query-placeholders-and-send (proc string)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
953 "Send to PROC input STRING, maybe replacing placeholders.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
954 Placeholders are words starting with and ampersand like &this.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
955 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
956 (while (string-match "&\\(\\sw+\\)" string)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
957 (setq string (replace-match
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
958 (read-from-minibuffer
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
959 (format "Enter value for %s: " (match-string 1 string))
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
960 nil nil nil sql-placeholder-history)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
961 t t string)))
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
962 (comint-send-string proc string)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
963 (comint-send-string proc "\n"))
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
964
24050
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
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
967 ;;; Sending the region to the SQLi buffer.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
968
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
969 (defun sql-send-region (start end)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
970 "Send a region to the SQL process."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
971 (interactive "r")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
972 (if (buffer-live-p sql-buffer)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
973 (save-excursion
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
974 (comint-send-region sql-buffer start end)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
975 (if (string-match "\n$" (buffer-substring start end))
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 (comint-send-string sql-buffer "\n"))
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
978 (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
979 (if sql-pop-to-buffer-after-send-region
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
980 (pop-to-buffer sql-buffer)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
981 (display-buffer sql-buffer)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
982 (message "No SQL process started.")))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
983
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
984 (defun sql-send-paragraph ()
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
985 "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
986 (interactive)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
987 (let ((start (save-excursion
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
988 (backward-paragraph)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
989 (point)))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
990 (end (save-excursion
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
991 (forward-paragraph)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
992 (point))))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
993 (sql-send-region start end)))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
994
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
995 (defun sql-send-buffer ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
996 "Send the buffer contents to the SQL process."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
997 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
998 (sql-send-region (point-min) (point-max)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
999
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1000 (defun sql-toggle-pop-to-buffer-after-send-region (&optional value)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1001 "Toggle `sql-pop-to-buffer-after-send-region'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1002
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1003 If given the optional parameter VALUE, sets
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1004 sql-toggle-pop-to-buffer-after-send-region to VALUE."
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1005 (interactive "P")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1006 (if value
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1007 (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
1008 (setq sql-pop-to-buffer-after-send-region
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1009 (null sql-pop-to-buffer-after-send-region ))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1010
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1011
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1012
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1013 ;;; SQL mode -- uses SQL interactive mode
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1014
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1015 ;;;###autoload
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1016 (defun sql-mode ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1017 "Major mode to edit SQL.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1018
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1019 You can send SQL statements to the SQLi buffer using
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1020 \\[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
1021 See `sql-help' on how to create SQLi buffers.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1022
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1023 \\{sql-mode-map}
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1024 Customization: Entry to this mode runs the `sql-mode-hook'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1025
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1026 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
1027 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
1028 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
1029 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
1030 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
1031 value of `sql-buffer' using \\[sql-set-sqli-buffer].
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1032
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1033 For information on how to create multiple SQLi buffers, see
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1034 `sql-interactive-mode'."
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1035 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1036 (kill-all-local-variables)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1037 (setq major-mode 'sql-mode)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1038 (setq mode-name "SQL")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1039 (use-local-map sql-mode-map)
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
1040 (if sql-mode-menu
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
1041 (easy-menu-add sql-mode-menu)); XEmacs
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1042 (set-syntax-table sql-mode-syntax-table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1043 (make-local-variable 'font-lock-defaults)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1044 ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1045 ;; 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
1046 ;; will have just one quote. Therefore syntactic hilighting is
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1047 ;; disabled for interactive buffers. `_' and `.' are considered part
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1048 ;; of words.
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1049 (setq font-lock-defaults '(sql-mode-font-lock-keywords
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1050 nil t ((?_ . "w") (?. . "w"))))
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1051 (make-local-variable 'comment-start)
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1052 (setq comment-start "--")
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1053 ;; 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
1054 (make-local-variable 'sql-buffer)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1055 ;; 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
1056 ;; 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
1057 ;; case-insensitive, that's why we have to set imenu-case-fold-search.
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1058 ;; imenu-syntax-alist makes sure that `_' is considered part of object
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1059 ;; names.
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1060 (setq imenu-generic-expression sql-imenu-generic-expression
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1061 imenu-case-fold-search t
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1062 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
1063 ;; 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
1064 ;; lines.
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1065 (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
1066 (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
1067 (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
1068 paragraph-start "[\n\f]")
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1069 ;; Abbrevs
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1070 (setq local-abbrev-table sql-mode-abbrev-table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1071 (setq abbrev-all-caps 1)
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1072 ;; Run hook
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1073 (run-hooks 'sql-mode-hook))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1074
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1075
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1076
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1077 ;;; SQL interactive mode
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1078
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1079 (put 'sql-interactive-mode 'mode-class 'special)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1080
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1081 (defun sql-interactive-mode ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1082 "Major mode to use a SQL interpreter interactively.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1083
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1084 Do not call this function by yourself. The environment must be
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1085 initialized by an entry function specific for the SQL interpreter. See
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1086 `sql-help' for a list of available entry functions.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1087
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1088 \\[comint-send-input] after the end of the process' output sends the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1089 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
1090 \\[comint-send-input] before end of process output copies the current
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1091 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
1092 \\[comint-copy-old-input] just copies the current line.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1093 Use \\[sql-accumulate-and-indent] to enter multi-line statements.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1094
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1095 If you want to make multiple SQL buffers, rename the `*SQL*' buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1096 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
1097 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
1098 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
1099 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
1100 their creation. See `sql-mode' for details.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1101
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1102 Sample session using two connections:
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1103
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1104 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
1105 2. Rename buffer \"*SQL*\" to \"*Connection 1*\".
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1106 3. Create a SQL buffer \"test1.sql\".
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1107 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
1108 5. Rename buffer \"*SQL*\" to \"*Connection 2*\".
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1109 6. Create a SQL buffer \"test2.sql\".
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1110
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1111 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
1112 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
1113 will send the region to buffer \"*Connection 2*\".
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1114
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1115 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
1116 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
1117 the signals are not supported.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1118
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1119 \\{sql-interactive-mode-map}
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1120 Customization: Entry to this mode runs the hooks on `comint-mode-hook'
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1121 and `sql-interactive-mode-hook' (in that order). Before each input, the
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1122 hooks on `comint-input-filter-functions' are run. After each SQL
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1123 interpreter output, the hooks on `comint-output-filter-functions' are
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1124 run.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1125
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1126 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
1127 input ring history.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1128
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1129 Variables `comint-output-filter-functions', a hook, and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1130 `comint-scroll-to-bottom-on-input' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1131 `comint-scroll-to-bottom-on-output' control whether input and output
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1132 cause the window to scroll to the end of the buffer.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1133
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1134 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
1135 `comint-truncate-buffer' to `comint-output-filter-functions'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1136
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1137 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
1138 certain length.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1139
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1140 \(add-hook 'sql-interactive-mode-hook
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1141 \(function (lambda ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1142 \(setq comint-output-filter-functions 'comint-truncate-buffer))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1143
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1144 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
1145 you entered, right above the output it created.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1146
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1147 \(setq comint-output-filter-functions
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1148 \(function (lambda (STR) (comint-show-output))))"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1149 (comint-mode)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1150 (setq comint-prompt-regexp sql-prompt-regexp)
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1151 (setq left-margin sql-prompt-length)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1152 (setq major-mode 'sql-interactive-mode)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1153 (setq mode-name "SQLi")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1154 (use-local-map sql-interactive-mode-map)
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
1155 (if sql-interactive-mode-menu
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
1156 (easy-menu-add sql-interactive-mode-menu)); XEmacs
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1157 (set-syntax-table sql-mode-syntax-table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1158 (make-local-variable 'font-lock-defaults)
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1159 ;; 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
1160 ;; 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
1161 ;; will have just one quote. Therefore syntactic hilighting is
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1162 ;; disabled for interactive buffers. `_' and `.' are considered part
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1163 ;; of words.
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1164 (setq font-lock-defaults '(sql-mode-font-lock-keywords
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1165 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
1166 ;; 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
1167 (make-local-variable 'comment-start)
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1168 (setq comment-start "--")
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1169 ;; Abbreviation table init and case-insensitive. It is not activatet
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1170 ;; by default.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1171 (setq local-abbrev-table sql-mode-abbrev-table)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1172 (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
1173 ;; Exiting the process will call sql-stop.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1174 (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
1175 ;; People wanting a different history file for each
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1176 ;; 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
1177 ;; on the sql-interactive-mode-hook.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1178 (setq comint-input-ring-separator sql-input-ring-separator
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1179 comint-input-ring-file-name sql-input-ring-file-name)
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1180 ;; Create a usefull name for renaming this buffer later.
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1181 (make-local-variable 'sql-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
1182 (setq sql-alternate-buffer-name (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
1183 ;; User stuff.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1184 (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
1185 ;; Calling the hook before calling comint-read-input-ring allows users
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1186 ;; 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
1187 (comint-read-input-ring t))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1188
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1189 (defun sql-stop (process event)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1190 "Called when the SQL process is stopped.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1191
24353
1ae2a12a85ee (sql-set-sqli-hook): A hook run when sql-buffer is
Richard M. Stallman <rms@gnu.org>
parents: 24310
diff changeset
1192 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
1193 `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
1194
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1195 This function is a sentinel watching the SQL interpreter process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1196 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
1197 (comint-write-input-ring)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1198 (if (and (eq (current-buffer) sql-buffer)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1199 (not buffer-read-only))
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1200 (insert (format "\nProcess %s %s\n" process event))
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1201 (message "Process %s %s" process event)))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1202
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 ;;; Entry functions for different SQL interpreters.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1206
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1207 ;;;###autoload
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1208 (defun sql-oracle ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1209 "Run sqlplus by Oracle as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1210
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1211 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
1212 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1213 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1214
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1215 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
1216 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
1217 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
1218 the list `sql-oracle-options'.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1219
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1220 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1221 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1222
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1223 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1224 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
1225 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
1226 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1227 The default comes from `process-coding-system-alist' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1228 `default-process-coding-system'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1229
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1230 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1231 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1232 (if (comint-check-proc "*SQL*")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1233 (pop-to-buffer "*SQL*")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1234 (sql-get-login 'user 'password 'database)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1235 (message "Login...")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1236 ;; Produce user/password@database construct. Password without user
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1237 ;; is meaningless; database without user/password is meaningless,
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1238 ;; because "@param" will ask sqlplus to interpret the script
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1239 ;; "param".
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1240 (let ((parameter nil))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1241 (if (not (string= "" sql-user))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1242 (if (not (string= "" sql-password))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1243 (setq parameter (concat sql-user "/" sql-password))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1244 (setq parameter sql-user)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1245 (if (and parameter (not (string= "" sql-database)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1246 (setq parameter (concat parameter "@" sql-database)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1247 (if parameter
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1248 (setq parameter (nconc (list parameter) sql-oracle-options))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1249 (setq parameter sql-oracle-options))
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1250 (if parameter
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1251 (set-buffer (apply 'make-comint "SQL" sql-oracle-program nil
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1252 parameter))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1253 (set-buffer (make-comint "SQL" sql-oracle-program nil))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1254 (setq sql-prompt-regexp "^SQL> ")
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1255 (setq sql-prompt-length 5)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1256 (setq sql-buffer (current-buffer))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1257 ;; set sql-mode-font-lock-keywords to something different before
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1258 ;; calling sql-interactive-mode.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1259 (setq sql-mode-font-lock-keywords sql-mode-oracle-font-lock-keywords)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1260 (sql-interactive-mode)
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1261 ;; If running on NT, make sure we do placeholder replacement ourselves.
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1262 (if (eq window-system 'w32)
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1263 (setq comint-input-sender 'sql-query-placeholders-and-send))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1264 (message "Login...done")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1265 (pop-to-buffer sql-buffer)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1266
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1267
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1268
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1269 ;;;###autoload
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1270 (defun sql-sybase ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1271 "Run isql by SyBase as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1272
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1273 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
1274 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1275 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1276
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1277 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
1278 the variables `sql-server', `sql-user', `sql-password', and
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
1279 `sql-database' as defaults, if set.
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1280
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1281 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1282 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1283
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1284 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1285 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
1286 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
1287 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1288 The default comes from `process-coding-system-alist' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1289 `default-process-coding-system'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1290
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1291 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1292 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1293 (if (comint-check-proc "*SQL*")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1294 (pop-to-buffer "*SQL*")
32621
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
1295 (sql-get-login 'server 'user 'password 'server)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1296 (message "Login...")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1297 ;; Put all parameters to the program (if defined) in a list and call
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1298 ;; make-comint.
32621
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
1299 (let ((params sql-sybase-options))
25381
970b18c6803f (sql-sybase): use sql-server instead of sql-database.
Alex Schroeder <alex@gnu.org>
parents: 25183
diff changeset
1300 (if (not (string= "" sql-server))
970b18c6803f (sql-sybase): use sql-server instead of sql-database.
Alex Schroeder <alex@gnu.org>
parents: 25183
diff changeset
1301 (setq params (append (list "-S" sql-server) params)))
32621
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
1302 (if (not (string= "" sql-database))
50c28d51e0f2 (sql-sybase-options): New option.
Gerd Moellmann <gerd@gnu.org>
parents: 32169
diff changeset
1303 (setq params (append (list "-D" sql-database) params)))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1304 (if (not (string= "" sql-password))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1305 (setq params (append (list "-P" sql-password) params)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1306 (if (not (string= "" sql-user))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1307 (setq params (append (list "-U" sql-user) params)))
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1308 (set-buffer (apply 'make-comint "SQL" sql-sybase-program
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1309 nil params)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1310 (setq sql-prompt-regexp "^SQL> ")
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1311 (setq sql-prompt-length 5)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1312 (setq sql-buffer (current-buffer))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1313 (sql-interactive-mode)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1314 (message "Login...done")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1315 (pop-to-buffer sql-buffer)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1316
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1317
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1318
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1319 ;;;###autoload
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1320 (defun sql-informix ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1321 "Run dbaccess by Informix as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1322
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1323 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
1324 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1325 `*SQL*'.
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 Interpreter used comes from variable `sql-informix-program'. Login uses
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1328 the variable `sql-database' as default, if set.
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 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1331 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1332
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1333 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1334 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
1335 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
1336 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1337 The default comes from `process-coding-system-alist' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1338 `default-process-coding-system'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1339
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1340 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1341 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1342 (if (comint-check-proc "*SQL*")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1343 (pop-to-buffer "*SQL*")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1344 (sql-get-login 'database)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1345 (message "Login...")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1346 ;; username and password are ignored.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1347 (if (string= "" sql-database)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1348 (set-buffer (make-comint "SQL" sql-informix-program nil))
29937
693c2c631d72 (sql-interactive-mode-map): Use `kbd' in calls to
Gerd Moellmann <gerd@gnu.org>
parents: 26576
diff changeset
1349 (set-buffer (make-comint "SQL" sql-informix-program nil sql-database "-")))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1350 (setq sql-prompt-regexp "^SQL> ")
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1351 (setq sql-prompt-length 5)
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1352 (setq sql-buffer (current-buffer))
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1353 (sql-interactive-mode)
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1354 (message "Login...done")
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1355 (pop-to-buffer sql-buffer)))
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1356
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1357
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1358
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1359 ;;;###autoload
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1360 (defun sql-mysql ()
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1361 "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
1362
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1363 Note that the widespread idea that mysql is free software is inaccurate;
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1364 its license is too restrictive. We urge you to use PostGres instead.
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1365
24268
17b13a968841 (sql-help): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 24267
diff changeset
1366 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
1367 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
1368 `*SQL*'.
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1369
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1370 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
1371 the variables `sql-user', `sql-password', `sql-database', and
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1372 `sql-server' as defaults, if set.
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1373
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1374 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
1375 input. See `sql-interactive-mode'.
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1376
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1377 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
1378 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
1379 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
1380 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
1381 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
1382 `default-process-coding-system'.
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1383
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1384 \(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
1385 (interactive)
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1386 (if (comint-check-proc "*SQL*")
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1387 (pop-to-buffer "*SQL*")
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1388 (sql-get-login 'user 'password 'database 'server)
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1389 (message "Login...")
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1390 ;; Put all parameters to the program (if defined) in a list and call
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1391 ;; make-comint.
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1392 (let ((params))
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1393 (if (not (string= "" sql-database))
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1394 (setq params (append (list sql-database) params)))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1395 (if (not (string= "" sql-server))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1396 (setq params (append (list (concat "--host=" sql-server)) params)))
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1397 (if (not (string= "" sql-password))
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1398 (setq params (append (list (concat "--password=" sql-password)) params)))
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1399 (if (not (string= "" sql-user))
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1400 (setq params (append (list (concat "--user=" sql-user)) params)))
32169
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
1401 (if (not (null sql-mysql-options))
5aa8b2b669b7 (sql-mysql-options): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 31392
diff changeset
1402 (setq params (append sql-mysql-options params)))
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1403 (set-buffer (apply 'make-comint "SQL" sql-mysql-program
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1404 nil params)))
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1405 (setq sql-prompt-regexp "^mysql>")
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1406 (setq sql-prompt-length 6)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1407 (setq sql-buffer (current-buffer))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1408 (sql-interactive-mode)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1409 (message "Login...done")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1410 (pop-to-buffer sql-buffer)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1411
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1412
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1413
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1414 ;;;###autoload
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1415 (defun sql-solid ()
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1416 "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
1417
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1418 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
1419 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
1420 `*SQL*'.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1421
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1422 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
1423 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
1424 defaults, if set.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1425
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1426 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
1427 input. See `sql-interactive-mode'.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1428
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1429 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
1430 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
1431 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
1432 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
1433 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
1434 `default-process-coding-system'.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1435
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1436 \(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
1437 (interactive)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1438 (if (comint-check-proc "*SQL*")
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1439 (pop-to-buffer "*SQL*")
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1440 (sql-get-login 'user 'password 'server)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1441 (message "Login...")
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1442 ;; Put all parameters to the program (if defined) in a list and call
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1443 ;; make-comint.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1444 (let ((params))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1445 ;; It only makes sense if both username and password are there.
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1446 (if (not (or (string= "" sql-user)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1447 (string= "" sql-password)))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1448 (setq params (append (list sql-user sql-password) params)))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1449 (if (not (string= "" sql-server))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1450 (setq params (append (list sql-server) params)))
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1451 (set-buffer (apply 'make-comint "SQL" sql-solid-program
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1452 nil params)))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1453 (setq sql-prompt-regexp "^")
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1454 (setq sql-prompt-length 0)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1455 (setq sql-buffer (current-buffer))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1456 (sql-interactive-mode)
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1457 (message "Login...done")
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1458 (pop-to-buffer sql-buffer)))
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1459
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1460
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1461
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1462 ;;;###autoload
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1463 (defun sql-ingres ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1464 "Run sql by Ingres as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1465
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1466 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
1467 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1468 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1469
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1470 Interpreter used comes from variable `sql-ingres-program'. Login uses
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1471 the variable `sql-database' as default, if set.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1472
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1473 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1474 input. See `sql-interactive-mode'.
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 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1477 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
1478 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
1479 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1480 The default comes from `process-coding-system-alist' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1481 `default-process-coding-system'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1482
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1483 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1484 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1485 (if (comint-check-proc "*SQL*")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1486 (pop-to-buffer "*SQL*")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1487 (sql-get-login 'database)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1488 (message "Login...")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1489 ;; username and password are ignored.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1490 (if (string= "" sql-database)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1491 (set-buffer (make-comint "SQL" sql-ingres-program nil))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1492 (set-buffer (make-comint "SQL" sql-ingres-program nil sql-database)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1493 (setq sql-prompt-regexp "^\* ")
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1494 (setq sql-prompt-length 2)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1495 (setq sql-buffer (current-buffer))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1496 (sql-interactive-mode)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1497 (message "Login...done")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1498 (pop-to-buffer sql-buffer)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1499
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1500
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1501
30513
12162d90d9e4 (sql-ms): Added autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 29937
diff changeset
1502 ;;;###autoload
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1503 (defun sql-ms ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1504 "Run isql by Microsoft as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1505
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1506 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
1507 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1508 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1509
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1510 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
1511 variables `sql-user', `sql-password', `sql-database', and `sql-server'
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1512 as defaults, if set.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1513
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1514 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1515 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1516
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1517 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1518 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
1519 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
1520 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1521 The default comes from `process-coding-system-alist' and
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1522 `default-process-coding-system'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1523
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1524 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1525 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1526 (if (comint-check-proc "*SQL*")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1527 (pop-to-buffer "*SQL*")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1528 (sql-get-login 'user 'password 'database 'server)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1529 (message "Login...")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1530 ;; Put all parameters to the program (if defined) in a list and call
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1531 ;; make-comint.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1532 (let ((params '("-w 300")))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1533 (if (not (string= "" sql-server))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1534 (setq params (append (list "-S" sql-server) params)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1535 (if (not (string= "" sql-database))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1536 (setq params (append (list "-d" sql-database) params)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1537 (if (not (string= "" sql-user))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1538 (setq params (append (list "-U" sql-user) params)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1539 (if (not (string= "" sql-password))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1540 (setq params (append (list "-P" sql-password) params))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1541 ;; If -P is passed to ISQL as the last argument without a password,
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1542 ;; it's considered null.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1543 (setq params (append params (list "-P"))))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1544 (set-buffer (apply 'make-comint "SQL" sql-ms-program
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1545 nil params)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1546 (setq sql-prompt-regexp "^[0-9]*>")
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1547 (setq sql-prompt-length 5)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1548 (setq sql-buffer (current-buffer))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1549 (sql-interactive-mode)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1550 (message "Login...done")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1551 (pop-to-buffer sql-buffer)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1552
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1553
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1554
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1555
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1556 ;;;###autoload
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1557 (defun sql-postgres ()
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1558 "Run psql by Postgres as an inferior process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1559
24310
e76bade08723 Added keywords from `finder-by-keyword'.
Richard M. Stallman <rms@gnu.org>
parents: 24268
diff changeset
1560 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
1561 If buffer exists and a process is running, just switch to buffer
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1562 `*SQL*'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1563
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1564 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
1565 the variables `sql-database' and `sql-server' as default, if set.
24050
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 The buffer is put in sql-interactive-mode, giving commands for sending
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1568 input. See `sql-interactive-mode'.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1569
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1570 To specify a coding system for converting non-ASCII characters
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1571 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
1572 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
1573 in the SQL buffer, after you start the process.
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1574 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
1575 `default-process-coding-system'. If your output lines end with ^M,
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1576 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
1577 Try to set `comint-output-filter-functions' like this:
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 \(setq comint-output-filter-functions (append comint-output-filter-functions
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1580 '(comint-strip-ctrl-m)))
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 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1583 (interactive)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1584 (if (comint-check-proc "*SQL*")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1585 (pop-to-buffer "*SQL*")
24354
6a438ef0b573 Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents: 24353
diff changeset
1586 (sql-get-login 'database 'server)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1587 (message "Login...")
30905
2069c10bf952 (sql-magic-go): Use comint-bol.
Gerd Moellmann <gerd@gnu.org>
parents: 30838
diff changeset
1588 ;; username and password are ignored. Jason Beegan suggest using
2069c10bf952 (sql-magic-go): Use comint-bol.
Gerd Moellmann <gerd@gnu.org>
parents: 30838
diff changeset
1589 ;; --pset and pager=off instead of \\o|cat. The later was the
31392
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
1590 ;; solution by Gregor Zych. Jason's suggestion is the default value
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
1591 ;; for sql-postgres-options.
1f97a090ba6d (sql-postgres): Use sql-postgres-options.
Gerd Moellmann <gerd@gnu.org>
parents: 30905
diff changeset
1592 (let ((params sql-postgres-options))
24354
6a438ef0b573 Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents: 24353
diff changeset
1593 (if (not (string= "" sql-database))
6a438ef0b573 Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents: 24353
diff changeset
1594 (setq params (append (list sql-database) params)))
6a438ef0b573 Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents: 24353
diff changeset
1595 (if (not (string= "" sql-server))
6a438ef0b573 Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents: 24353
diff changeset
1596 (setq params (append (list "-h" sql-server) params)))
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1597 (set-buffer (apply 'make-comint "SQL" sql-postgres-program
24354
6a438ef0b573 Set version to 1.4.1. Changed mail address to
Richard M. Stallman <rms@gnu.org>
parents: 24353
diff changeset
1598 nil params)))
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1599 (setq sql-prompt-regexp "^.*> *")
24267
f40837b25999 Changed version to 1.2.1.
Richard M. Stallman <rms@gnu.org>
parents: 24058
diff changeset
1600 (setq sql-prompt-length 5)
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1601 ;; This is a lousy hack to prevent psql from truncating it's output
25826
e55139b50cb6 (sql-imenu-generic-expression): new, used to set
Alex Schroeder <alex@gnu.org>
parents: 25381
diff changeset
1602 ;; and giving stupid warnings. If s.o. knows a way to prevent psql
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1603 ;; from acting this way, then I would be very thankful to
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1604 ;; incorporate this (Gregor Zych <zych@pool.informatik.rwth-aachen.de>)
30905
2069c10bf952 (sql-magic-go): Use comint-bol.
Gerd Moellmann <gerd@gnu.org>
parents: 30838
diff changeset
1605 ;; (comint-send-string "*SQL*" "\\o \| cat\n")
24050
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1606 (setq sql-mode-font-lock-keywords sql-mode-postgres-font-lock-keywords)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1607 (setq sql-buffer (current-buffer))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1608 (sql-interactive-mode)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1609 (message "Login...done")
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1610 (pop-to-buffer sql-buffer)))
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1611
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1612 (provide 'sql)
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1613
e546776e7a76 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1614 ;;; sql.el ends here