aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1999-02-13 12:04:00 +0000
committerRichard M. Stallman1999-02-13 12:04:00 +0000
commitdab100d7ad4316bb701e32deff4f064a816a2a81 (patch)
tree73c1d201de5503a7f94a38d0e936aa431959cee2
parent9d7c4eb5547e75fdda8cf70758deeb45a1362994 (diff)
downloademacs-dab100d7ad4316bb701e32deff4f064a816a2a81.tar.gz
emacs-dab100d7ad4316bb701e32deff4f064a816a2a81.zip
Added keywords from `finder-by-keyword'.
Set version to 1.3.2 (sql-solid-program): Added support for solid. (sql-help): Doc mentions sql-solid. (sql-solid): Entry function for Solid. (sql-buffer): Doc explains the use of the variable and how to change it. (sql-mode-menu): Included entries for sql-show-sqli-buffer and sql-change-sqli-buffer; sql-send-region and sql-send-buffer are disabled if sql-buffer doesn't have a process; sql-send-paragraph is new. (sql-show-sqli-buffer): New function to display the value of sql-buffer. (sql-change-sqli-buffer): New function to change sql-buffer. (sql-mode): Doc explains how to change sql-buffer. (sql-send-paragraph): New function to send a paragraph. (sql-mode-map): Added keybinding for sql-send-paragraph. (sql-mysql): Doc corrected. (sql-ms): Doc corrected. (sql-server): Doc fix. (sql-mysql): Added the use of sql-server to specify the host, sql-database now specifies database instead of host. (sql-mode-menu): Send... menu items are only active if sql-buffer is non-nil. (sql-help): Changed tag of entry functions a bit. (sql-mode): Made sql-buffer a local variable, changed the documentation: removed instructions to add *.sql files to auto-mode-alist, added documentation for having mutliple SQL buffers sending their stuff to different SQLi buffers, each running a different process. (sql-postgres): Quoted *SQL* in doc string. (sql-ms): Likewise. (sql-ingres): Likewise. (sql-ingres): Quoted *SQL* in doc string, added references to sql-user and sql-password used during login. (sql-sybase): Quoted *SQL* in doc string, added comma. (sql-oracle): Likewise. (sql-interactive-mode): Added extensive documentation for having mutliple SQL buffers sending their stuff to different SQLi buffers, each running a different process. (sql-buffer): Changed doc from *SQL* to SQLi. (sql-get-login): Doc fix.
-rw-r--r--lisp/progmodes/sql.el244
1 files changed, 193 insertions, 51 deletions
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 48ae7af0ac3..3a0cb87e861 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -4,8 +4,8 @@
4 4
5;; Author: Alex Schroeder <a.schroeder@bsiag.ch> 5;; Author: Alex Schroeder <a.schroeder@bsiag.ch>
6;; Maintainer: Alex Schroeder <a.schroeder@bsiag.ch> 6;; Maintainer: Alex Schroeder <a.schroeder@bsiag.ch>
7;; Version: 1.2.1 7;; Version: 1.3.2
8;; Keywords: processes SQL 8;; Keywords: comm languages processes
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -45,12 +45,12 @@
45;; facilitate your plans. 45;; facilitate your plans.
46 46
47;; sql-interactive-mode is used to interact with a SQL interpreter 47;; sql-interactive-mode is used to interact with a SQL interpreter
48;; process in the *SQL* buffer. The *SQL* buffer is created by 48;; process in a SQLi buffer (usually called `*SQL*'). The SQLi buffer
49;; calling a SQL interpreter-specific entry function. Do *not* call 49;; is created by calling a SQL interpreter-specific entry function. Do
50;; sql-interactive-mode by itself. 50;; *not* call sql-interactive-mode by itself.
51 51
52;; The list of currently supported interpreters and the corresponding 52;; The list of currently supported interpreters and the corresponding
53;; entry function used to create the *SQL* buffers is shown with 53;; entry function used to create the SQLi buffers is shown with
54;; `sql-help' (M-x sql-help). 54;; `sql-help' (M-x sql-help).
55 55
56;; Since sql-interactive-mode is built on top of the general 56;; Since sql-interactive-mode is built on top of the general
@@ -61,7 +61,7 @@
61 61
62;; sql-mode can be used to enable syntactic hilighting for SQL 62;; sql-mode can be used to enable syntactic hilighting for SQL
63;; statements in another buffer. SQL statements can then be sent to 63;; statements in another buffer. SQL statements can then be sent to
64;; the SQL process in the *SQL* buffer. sql-mode has already been 64;; the SQL process in the SQLi buffer. sql-mode has already been
65;; used as a template to a simple PL/SQL mode. 65;; used as a template to a simple PL/SQL mode.
66 66
67;; For documentation on the functionality provided by comint mode, and 67;; For documentation on the functionality provided by comint mode, and
@@ -89,7 +89,10 @@
89 89
90;; Add better hilight support for other brands; there is a bias towards 90;; Add better hilight support for other brands; there is a bias towards
91;; Oracle because that's what I use at work. Anybody else just send in 91;; Oracle because that's what I use at work. Anybody else just send in
92;; your lists of reserved words, keywords and builtin functions! 92;; your lists of reserved words, keywords and builtin functions! As
93;; long as I don't receive any feedback, everything is hilighted with
94;; ANSI keywords only. I received the list of ANSI keywords from a
95;; user; if you know of any changes, let me know.
93 96
94;; Add different hilighting levels. 97;; Add different hilighting levels.
95 98
@@ -100,6 +103,7 @@
100;; Yair Friedman <yfriedma@JohnBryce.Co.Il> 103;; Yair Friedman <yfriedma@JohnBryce.Co.Il>
101;; Gregor Zych <zych@pool.informatik.rwth-aachen.de> 104;; Gregor Zych <zych@pool.informatik.rwth-aachen.de>
102;; nino <nino@inform.dk> 105;; nino <nino@inform.dk>
106
103 107
104 108
105;;; Code: 109;;; Code:
@@ -136,9 +140,7 @@ Customizing your password will store it in your ~/.emacs file."
136 :group 'SQL) 140 :group 'SQL)
137 141
138(defcustom sql-server "" 142(defcustom sql-server ""
139 "*Default server. 143 "*Default server or host."
140
141Currently, this is only used by MS isql."
142 :type 'string 144 :type 'string
143 :group 'SQL) 145 :group 'SQL)
144 146
@@ -191,6 +193,17 @@ The program can also specify a TCP connection. See `make-comint'."
191 :type 'file 193 :type 'file
192 :group 'SQL) 194 :group 'SQL)
193 195
196;; Customisation for Solid
197
198(defcustom sql-solid-program "solsql"
199 "*Command to start SOLID SQL Editor.
200
201Starts `sql-interactive-mode' after doing some setup.
202
203The program can also specify a TCP connection. See `make-comint'."
204 :type 'file
205 :group 'SQL)
206
194;; Customisation for SyBase 207;; Customisation for SyBase
195 208
196(defcustom sql-sybase-program "isql" 209(defcustom sql-sybase-program "isql"
@@ -262,7 +275,13 @@ The program can also specify a TCP connection. See `make-comint'."
262;; Passwords are not kept in a history. 275;; Passwords are not kept in a history.
263 276
264(defvar sql-buffer nil 277(defvar sql-buffer nil
265 "Current *SQL* buffer.") 278 "Current SQLi buffer.
279
280The global value of sql-buffer is the name of the latest SQLi buffer
281created. Any SQL buffer created will make a local copy of this value.
282See `sql-interactive-mode' for more on multiple sessions. If you want
283to change the SQLi buffer a SQL mode sends its SQL strings to, change
284the local value of sql-buffer using \\[sql-change-sqli-buffer].")
266 285
267(defvar sql-prompt-regexp nil 286(defvar sql-prompt-regexp nil
268 "Prompt used to initialize `comint-prompt-regexp'. 287 "Prompt used to initialize `comint-prompt-regexp'.
@@ -297,6 +316,7 @@ You can change it on `sql-interactive-mode-hook'.")
297 316
298(defvar sql-mode-map 317(defvar sql-mode-map
299 (let ((map (make-sparse-keymap))) 318 (let ((map (make-sparse-keymap)))
319 (define-key map "\C-c\C-c" 'sql-send-paragraph)
300 (define-key map "\C-c\C-r" 'sql-send-region) 320 (define-key map "\C-c\C-r" 'sql-send-region)
301 (define-key map "\C-c\C-b" 'sql-send-buffer) 321 (define-key map "\C-c\C-b" 'sql-send-buffer)
302 (define-key map "\t" 'indent-relative) 322 (define-key map "\t" 'indent-relative)
@@ -309,8 +329,15 @@ You can change it on `sql-interactive-mode-hook'.")
309 sql-mode-menu sql-mode-map 329 sql-mode-menu sql-mode-map
310 "Menu for `sql-mode'." 330 "Menu for `sql-mode'."
311 '("SQL" 331 '("SQL"
312 ["Send Region" sql-send-region mark-active] 332 ["Send Paragraph" sql-send-paragraph (and (buffer-live-p sql-buffer)
313 ["Send Buffer" sql-send-buffer t] 333 (get-buffer-process sql-buffer))]
334 ["Send Region" sql-send-region (and mark-active
335 (buffer-live-p sql-buffer)
336 (get-buffer-process sql-buffer))]
337 ["Send Buffer" sql-send-buffer (and (buffer-live-p sql-buffer)
338 (get-buffer-process sql-buffer))]
339 ["Show SQLi buffer" sql-show-sqli-buffer t]
340 ["Change SQLi buffer" sql-change-sqli-buffer t]
314 ["Pop to SQLi buffer after send" 341 ["Pop to SQLi buffer after send"
315 sql-toggle-pop-to-buffer-after-send-region 342 sql-toggle-pop-to-buffer-after-send-region
316 :style toggle 343 :style toggle
@@ -536,17 +563,18 @@ can be changed by some entry functions to provide more hilighting.")
536 "Shows short help for the SQL modes. 563 "Shows short help for the SQL modes.
537 564
538Use an entry function to open an interactive SQL buffer. This buffer is 565Use an entry function to open an interactive SQL buffer. This buffer is
539usually named *SQL*. The name of the major mode is SQLi. 566usually named `*SQL*'. The name of the major mode is SQLi.
540 567
541Use the following commands to start a specific SQL interpreter: 568Use the following commands to start a specific SQL interpreter:
542 569
543 psql (PostGres): \\[sql-postgres] 570 PostGres: \\[sql-postgres]
544 571
545Other non-free SQL implementations are also supported: 572Other non-free SQL implementations are also supported:
546 573
547 mysql: \\[sql-mysql] 574 MySQL: \\[sql-mysql]
548 SQL*Plus: \\[sql-oracle] 575 Solid: \\[sql-solid]
549 dbaccess Informix: \\[sql-informix] 576 Oracle: \\[sql-oracle]
577 Informix: \\[sql-informix]
550 Sybase: \\[sql-sybase] 578 Sybase: \\[sql-sybase]
551 Ingres: \\[sql-ingres] 579 Ingres: \\[sql-ingres]
552 Microsoft: \\[sql-ms] 580 Microsoft: \\[sql-ms]
@@ -589,11 +617,11 @@ even in old versions of Emacs."
589(defun sql-get-login (&rest what) 617(defun sql-get-login (&rest what)
590 "Get username, password and database from the user. 618 "Get username, password and database from the user.
591 619
592The variables `sql-user', `sql-password', `sql-server' and 620The variables `sql-user', `sql-password', `sql-server', and
593`sql-database' can be customised. They are used as the default 621`sql-database' can be customised. They are used as the default values.
594values. Usernames, servers and databases are stored in 622Usernames, servers and databases are stored in `sql-user-history',
595`sql-user-history', `sql-server-history' and `database-history'. 623`sql-server-history' and `database-history'. Passwords are not stored
596Passwords are not stored in a history. 624in a history.
597 625
598Parameter WHAT is a list of the arguments passed to this function. 626Parameter WHAT is a list of the arguments passed to this function.
599The function asks for the username if WHAT contains symbol `user', for 627The function asks for the username if WHAT contains symbol `user', for
@@ -620,6 +648,34 @@ function like this: (sql-get-login 'user 'password 'database)."
620 (read-from-minibuffer "Database: " sql-database nil nil 648 (read-from-minibuffer "Database: " sql-database nil nil
621 sql-database-history)))) 649 sql-database-history))))
622 650
651(defun sql-change-sqli-buffer ()
652 "Change the SQLi buffer SQL strings are sent to.
653
654Call this function in a SQL buffer in order to change the SQLi buffer
655SQL strings are sent to. Calling this function sets `sql-buffer'.
656
657If you call it from a SQL buffer, this changes the local copy of
658`sql-buffer'.
659
660If you call it from anywhere else, it changes the global copy of
661`sql-buffer'."
662 (interactive)
663 (let ((new-buffer (get-buffer (read-buffer "New SQLi buffer: " nil t))))
664 (if new-buffer
665 (setq sql-buffer new-buffer))))
666
667(defun sql-show-sqli-buffer ()
668 "Show the name of current SQLi buffer.
669
670This is the buffer SQL strings are sent to. It is stored in the
671variable `sql-buffer'. See `sql-help' on how to create such a buffer."
672 (interactive)
673 (if (null (buffer-live-p sql-buffer))
674 (message "There is no SQLi buffer.")
675 (if (null (get-buffer-process sql-buffer))
676 (message "Buffer %s has no process." (buffer-name sql-buffer))
677 (message "Current SQLi buffer is %s." (buffer-name sql-buffer)))))
678
623(defun sql-copy-column () 679(defun sql-copy-column ()
624 "Copy current column to the end of buffer. 680 "Copy current column to the end of buffer.
625Inserts SELECT or commas if appropriate." 681Inserts SELECT or commas if appropriate."
@@ -668,6 +724,17 @@ Inserts SELECT or commas if appropriate."
668 (display-buffer sql-buffer))) 724 (display-buffer sql-buffer)))
669 (message "No SQL process started."))) 725 (message "No SQL process started.")))
670 726
727(defun sql-send-paragraph ()
728 "Send the current paragraph to the SQL process."
729 (interactive)
730 (let ((start (save-excursion
731 (backward-paragraph)
732 (point)))
733 (end (save-excursion
734 (forward-paragraph)
735 (point))))
736 (sql-send-region start end)))
737
671(defun sql-send-buffer () 738(defun sql-send-buffer ()
672 "Send the buffer contents to the SQL process." 739 "Send the buffer contents to the SQL process."
673 (interactive) 740 (interactive)
@@ -692,18 +759,22 @@ sql-toggle-pop-to-buffer-after-send-region to VALUE."
692(defun sql-mode () 759(defun sql-mode ()
693 "Major mode to edit SQL. 760 "Major mode to edit SQL.
694 761
695You can send SQL statements to the *SQL* buffer using 762You can send SQL statements to the SQLi buffer using
696\\[sql-send-region]. Such a buffer must exist before you can do this. 763\\[sql-send-region]. Such a buffer must exist before you can do this.
697See `sql-help'. 764See `sql-help' on how to create SQLi buffers.
698 765
699\\{sql-mode-map} 766\\{sql-mode-map}
700Customization: Entry to this mode runs the `sql-mode-hook'. 767Customization: Entry to this mode runs the `sql-mode-hook'.
701 768
702Here is an example for your .emacs file. It opens every file ending in 769When you put a buffer in SQL mode, the buffer stores the last SQLi
703.sql with sql-mode. 770buffer created as its destination in the variable `sql-buffer'. This
771will be the buffer \\[sql-send-region] sends the region to. If this
772SQLi buffer is killed, \\[sql-send-region] is no longer able to
773determine where the strings should be sent to. You can change the
774value of `sql-buffer' using \\[sql-change-sqli-buffer].
704 775
705\(setq auto-mode-alist (append auto-mode-alist 776For information on how to create multiple SQLi buffers, see
706 \(list '(\"\\\\.sql$\" . sql-mode))))" 777`sql-interactive-mode'."
707 (interactive) 778 (interactive)
708 (kill-all-local-variables) 779 (kill-all-local-variables)
709 (setq major-mode 'sql-mode) 780 (setq major-mode 'sql-mode)
@@ -715,6 +786,9 @@ Here is an example for your .emacs file. It opens every file ending in
715 nil t ((95 . "w") (46 . "w")))) 786 nil t ((95 . "w") (46 . "w"))))
716 (make-local-variable 'comment-start) 787 (make-local-variable 'comment-start)
717 (setq comment-start "--") 788 (setq comment-start "--")
789 ;; The following will make each buffer in sql-mode remeber the
790 ;; "current" SQLi buffer.
791 (make-local-variable 'sql-buffer)
718 (setq local-abbrev-table sql-mode-abbrev-table) 792 (setq local-abbrev-table sql-mode-abbrev-table)
719 (setq abbrev-all-caps 1) 793 (setq abbrev-all-caps 1)
720 (run-hooks 'sql-mode-hook)) 794 (run-hooks 'sql-mode-hook))
@@ -741,9 +815,27 @@ Use \\[sql-accumulate-and-indent] to enter multi-line statements.
741 815
742If you want to make multiple SQL buffers, rename the `*SQL*' buffer 816If you want to make multiple SQL buffers, rename the `*SQL*' buffer
743using \\[rename-buffer] or \\[rename-uniquely] and start a new process. 817using \\[rename-buffer] or \\[rename-uniquely] and start a new process.
818See `sql-help' for a list of available entry functions. The last buffer
819created by such an entry function is the current SQLi buffer. SQL
820buffers will send strings to the SQLi buffer current at the time of
821their creation. See `sql-mode' for details.
822
823Sample session using two connections:
824
8251. Create first SQLi buffer by calling an entry function.
8262. Rename buffer \"*SQL*\" to \"*Connection 1*\".
8273. Create a SQL buffer \"test1.sql\".
8284. Create second SQLi buffer by calling an entry function.
8295. Rename buffer \"*SQL*\" to \"*Connection 2*\".
8306. Create a SQL buffer \"test2.sql\".
831
832Now \\[sql-send-region] in buffer \"test1.sql\" will send the region to
833buffer \"*Connection 1*\", \\[sql-send-region] in buffer \"test2.sql\"
834will send the region to buffer \"*Connection 2*\".
744 835
745If you accidentally suspend your process, use \\[comint-continue-subjob] 836If you accidentally suspend your process, use \\[comint-continue-subjob]
746to continue it. 837to continue it. On some operating systems, this will not work because
838the signals are not supported.
747 839
748\\{sql-interactive-mode-map} 840\\{sql-interactive-mode-map}
749Customization: Entry to this mode runs the hooks on `comint-mode-hook' 841Customization: Entry to this mode runs the hooks on `comint-mode-hook'
@@ -763,7 +855,7 @@ cause the window to scroll to the end of the buffer.
763If you want to make SQL buffers limited in length, add the function 855If you want to make SQL buffers limited in length, add the function
764`comint-truncate-buffer' to `comint-output-filter-functions'. 856`comint-truncate-buffer' to `comint-output-filter-functions'.
765 857
766Here is an example for your .emacs file. It keeps the *SQL* Buffer a 858Here is an example for your .emacs file. It keeps the SQLi buffer a
767certain length and stores all inputs in an input-ring file. 859certain length and stores all inputs in an input-ring file.
768 860
769\(add-hook 'sql-interactive-mode-hook 861\(add-hook 'sql-interactive-mode-hook
@@ -819,12 +911,12 @@ Sentinels will always get the two parameters PROCESS and EVENT."
819(defun sql-oracle () 911(defun sql-oracle ()
820 "Run sqlplus by Oracle as an inferior process. 912 "Run sqlplus by Oracle as an inferior process.
821 913
822If buffer *SQL* exists but no process is running, make a new process. 914If buffer `*SQL*' exists but no process is running, make a new process.
823If buffer exists and a process is running, just switch to buffer 915If buffer exists and a process is running, just switch to buffer
824`*SQL*'. 916`*SQL*'.
825 917
826Interpreter used comes from variable `sql-oracle-program'. Login 918Interpreter used comes from variable `sql-oracle-program'. Login uses
827uses the variables `sql-user', `sql-password' and `sql-database' as 919the variables `sql-user', `sql-password', and `sql-database' as
828defaults, if set. 920defaults, if set.
829 921
830The buffer is put in sql-interactive-mode, giving commands for sending 922The buffer is put in sql-interactive-mode, giving commands for sending
@@ -872,13 +964,13 @@ The default comes from `process-coding-system-alist' and
872(defun sql-sybase () 964(defun sql-sybase ()
873 "Run isql by SyBase as an inferior process. 965 "Run isql by SyBase as an inferior process.
874 966
875If buffer *SQL* exists but no process is running, make a new process. 967If buffer `*SQL*' exists but no process is running, make a new process.
876If buffer exists and a process is running, just switch to buffer 968If buffer exists and a process is running, just switch to buffer
877`*SQL*'. 969`*SQL*'.
878 970
879Interpreter used comes from variable `sql-sybase-program'. Login uses 971Interpreter used comes from variable `sql-sybase-program'. Login uses
880the variables `sql-user', `sql-password' and `sql-database' as defaults, 972the variables `sql-user', `sql-password', and `sql-database' as
881if set. 973defaults, if set.
882 974
883The buffer is put in sql-interactive-mode, giving commands for sending 975The buffer is put in sql-interactive-mode, giving commands for sending
884input. See `sql-interactive-mode'. 976input. See `sql-interactive-mode'.
@@ -921,7 +1013,7 @@ The default comes from `process-coding-system-alist' and
921(defun sql-informix () 1013(defun sql-informix ()
922 "Run dbaccess by Informix as an inferior process. 1014 "Run dbaccess by Informix as an inferior process.
923 1015
924If buffer *SQL* exists but no process is running, make a new process. 1016If buffer `*SQL*' exists but no process is running, make a new process.
925If buffer exists and a process is running, just switch to buffer 1017If buffer exists and a process is running, just switch to buffer
926`*SQL*'. 1018`*SQL*'.
927 1019
@@ -959,23 +1051,24 @@ The default comes from `process-coding-system-alist' and
959 1051
960(defun sql-mysql () 1052(defun sql-mysql ()
961 "Run mysql by TcX as an inferior process. 1053 "Run mysql by TcX as an inferior process.
962Note that the widespread idea that mysql is free software 1054
963is inaccurate; its license is too restrictive. 1055Note that the widespread idea that mysql is free software is inaccurate;
964We urge you to use PostGres instead. 1056its license is too restrictive. We urge you to use PostGres instead.
965 1057
966If buffer `*SQL*' exists but no process is running, make a new process. 1058If buffer `*SQL*' exists but no process is running, make a new process.
967If buffer exists and a process is running, just switch to buffer 1059If buffer exists and a process is running, just switch to buffer
968`*SQL*'. 1060`*SQL*'.
969 1061
970Interpreter used comes from variable `sql-mysql-program'. Login uses 1062Interpreter used comes from variable `sql-mysql-program'. Login uses
971the variable `sql-database' as default, if set. 1063the variables `sql-user', `sql-password', `sql-database', and
1064`sql-server' as defaults, if set.
972 1065
973The buffer is put in sql-interactive-mode, giving commands for sending 1066The buffer is put in sql-interactive-mode, giving commands for sending
974input. See `sql-interactive-mode'. 1067input. See `sql-interactive-mode'.
975 1068
976To specify a coding system for converting non-ASCII characters 1069To specify a coding system for converting non-ASCII characters
977in the input and output to the process, use \\[universal-coding-system-argument] 1070in the input and output to the process, use \\[universal-coding-system-argument]
978before \\[sql-informix]. You can also specify this with \\[set-buffer-process-coding-system] 1071before \\[sql-mysql]. You can also specify this with \\[set-buffer-process-coding-system]
979in the SQL buffer, after you start the process. 1072in the SQL buffer, after you start the process.
980The default comes from `process-coding-system-alist' and 1073The default comes from `process-coding-system-alist' and
981`default-process-coding-system'. 1074`default-process-coding-system'.
@@ -984,13 +1077,15 @@ The default comes from `process-coding-system-alist' and
984 (interactive) 1077 (interactive)
985 (if (comint-check-proc "*SQL*") 1078 (if (comint-check-proc "*SQL*")
986 (pop-to-buffer "*SQL*") 1079 (pop-to-buffer "*SQL*")
987 (sql-get-login 'user 'password 'database) 1080 (sql-get-login 'user 'password 'database 'server)
988 (message "Login...") 1081 (message "Login...")
989 ;; Put all parameters to the program (if defined) in a list and call 1082 ;; Put all parameters to the program (if defined) in a list and call
990 ;; make-comint. 1083 ;; make-comint.
991 (let ((params)) 1084 (let ((params))
992 (if (not (string= "" sql-database)) 1085 (if (not (string= "" sql-database))
993 (setq params (append (list (concat "--host=" sql-database)) params))) 1086 (setq params (append (list sql-database) params)))
1087 (if (not (string= "" sql-server))
1088 (setq params (append (list (concat "--host=" sql-server)) params)))
994 (if (not (string= "" sql-password)) 1089 (if (not (string= "" sql-password))
995 (setq params (append (list (concat "--password=" sql-password)) params))) 1090 (setq params (append (list (concat "--password=" sql-password)) params)))
996 (if (not (string= "" sql-user)) 1091 (if (not (string= "" sql-user))
@@ -1006,10 +1101,57 @@ The default comes from `process-coding-system-alist' and
1006 1101
1007 1102
1008 1103
1104(defun sql-solid ()
1105 "Run solsql by Solid as an inferior process.
1106
1107If buffer `*SQL*' exists but no process is running, make a new process.
1108If buffer exists and a process is running, just switch to buffer
1109`*SQL*'.
1110
1111Interpreter used comes from variable `sql-solid-program'. Login uses
1112the variables `sql-user', `sql-password', and `sql-server' as
1113defaults, if set.
1114
1115The buffer is put in sql-interactive-mode, giving commands for sending
1116input. See `sql-interactive-mode'.
1117
1118To specify a coding system for converting non-ASCII characters
1119in the input and output to the process, use \\[universal-coding-system-argument]
1120before \\[sql-solid]. You can also specify this with \\[set-buffer-process-coding-system]
1121in the SQL buffer, after you start the process.
1122The default comes from `process-coding-system-alist' and
1123`default-process-coding-system'.
1124
1125\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
1126 (interactive)
1127 (if (comint-check-proc "*SQL*")
1128 (pop-to-buffer "*SQL*")
1129 (sql-get-login 'user 'password 'server)
1130 (message "Login...")
1131 ;; Put all parameters to the program (if defined) in a list and call
1132 ;; make-comint.
1133 (let ((params))
1134 ;; It only makes sense if both username and password are there.
1135 (if (not (or (string= "" sql-user)
1136 (string= "" sql-password)))
1137 (setq params (append (list sql-user sql-password) params)))
1138 (if (not (string= "" sql-server))
1139 (setq params (append (list sql-server) params)))
1140 (set-buffer (apply 'make-comint "SQL" sql-solid-program
1141 nil params)))
1142 (setq sql-prompt-regexp "^")
1143 (setq sql-prompt-length 0)
1144 (setq sql-buffer (current-buffer))
1145 (sql-interactive-mode)
1146 (message "Login...done")
1147 (pop-to-buffer sql-buffer)))
1148
1149
1150
1009(defun sql-ingres () 1151(defun sql-ingres ()
1010 "Run sql by Ingres as an inferior process. 1152 "Run sql by Ingres as an inferior process.
1011 1153
1012If buffer *SQL* exists but no process is running, make a new process. 1154If buffer `*SQL*' exists but no process is running, make a new process.
1013If buffer exists and a process is running, just switch to buffer 1155If buffer exists and a process is running, just switch to buffer
1014`*SQL*'. 1156`*SQL*'.
1015 1157
@@ -1048,12 +1190,12 @@ The default comes from `process-coding-system-alist' and
1048(defun sql-ms () 1190(defun sql-ms ()
1049 "Run isql by Microsoft as an inferior process. 1191 "Run isql by Microsoft as an inferior process.
1050 1192
1051If buffer *SQL* exists but no process is running, make a new process. 1193If buffer `*SQL*' exists but no process is running, make a new process.
1052If buffer exists and a process is running, just switch to buffer 1194If buffer exists and a process is running, just switch to buffer
1053`*SQL*'. 1195`*SQL*'.
1054 1196
1055Interpreter used comes from variable `sql-ms-program'. Login uses the 1197Interpreter used comes from variable `sql-ms-program'. Login uses the
1056variables `sql-user', `sql-password', `sql-server' and `sql-database' 1198variables `sql-user', `sql-password', `sql-database', and `sql-server'
1057as defaults, if set. 1199as defaults, if set.
1058 1200
1059The buffer is put in sql-interactive-mode, giving commands for sending 1201The buffer is put in sql-interactive-mode, giving commands for sending
@@ -1061,7 +1203,7 @@ input. See `sql-interactive-mode'.
1061 1203
1062To specify a coding system for converting non-ASCII characters 1204To specify a coding system for converting non-ASCII characters
1063in the input and output to the process, use \\[universal-coding-system-argument] 1205in the input and output to the process, use \\[universal-coding-system-argument]
1064before \\[sql-sybase]. You can also specify this with \\[set-buffer-process-coding-system] 1206before \\[sql-ms]. You can also specify this with \\[set-buffer-process-coding-system]
1065in the SQL buffer, after you start the process. 1207in the SQL buffer, after you start the process.
1066The default comes from `process-coding-system-alist' and 1208The default comes from `process-coding-system-alist' and
1067`default-process-coding-system'. 1209`default-process-coding-system'.
@@ -1102,7 +1244,7 @@ The default comes from `process-coding-system-alist' and
1102(defun sql-postgres () 1244(defun sql-postgres ()
1103 "Run psql by Postgres as an inferior process. 1245 "Run psql by Postgres as an inferior process.
1104 1246
1105If buffer *SQL* exists but no process is running, make a new process. 1247If buffer `*SQL*' exists but no process is running, make a new process.
1106If buffer exists and a process is running, just switch to buffer 1248If buffer exists and a process is running, just switch to buffer
1107`*SQL*'. 1249`*SQL*'.
1108 1250