aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mauger2010-07-18 14:44:32 -0400
committerMichael Mauger2010-07-18 14:44:32 -0400
commit30c4d8dcb8354549c7de86a827427d0fe96d508e (patch)
treea24206e399c061d34f819067a0f1b4ecfde10d57
parent8d16a259868cba3703a696bfced3e224ccc43f36 (diff)
downloademacs-30c4d8dcb8354549c7de86a827427d0fe96d508e.tar.gz
emacs-30c4d8dcb8354549c7de86a827427d0fe96d508e.zip
SQL Mode V2.2 - Added sql-connect and sql-connection-alist
-rw-r--r--etc/NEWS41
-rw-r--r--lisp/ChangeLog31
-rw-r--r--lisp/progmodes/sql.el350
3 files changed, 327 insertions, 95 deletions
diff --git a/etc/NEWS b/etc/NEWS
index bf60bcb31aa..8ea0b61c05b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -42,7 +42,7 @@ lib-src/Makefile by hand in order to use the associated features.
42This is only useful if your crt*.o files are in a non-standard location. 42This is only useful if your crt*.o files are in a non-standard location.
43 43
44--- 44---
45** Emacs can be compiled against Gtk+ 3.0 if you pass --with-x-toolkit=gtk3 45** Emacs can be compiled against Gtk+ 3.0 if you pass --with-x-toolkit=gtk3
46to configure. Note that other libraries used by Emacs, RSVG and GConf, 46to configure. Note that other libraries used by Emacs, RSVG and GConf,
47also depend on Gtk+. You can disable them with --without-rsvg and 47also depend on Gtk+. You can disable them with --without-rsvg and
48--without-gconf. 48--without-gconf.
@@ -256,9 +256,9 @@ For example, adding "(diff-mode . ((mode . whitespace)))" to your
256 256
257** SQL Mode enhancements. 257** SQL Mode enhancements.
258 258
259*** Several variables have been marked as safe local variables. 259*** Several variables have been marked as safe local variables. The
260The variables `sql-product', `sql-user', `sql-server', and 260variables `sql-product', `sql-user', `sql-server', `sql-database' and
261`sql-database' can now be safely used as local variables. 261`sql-port' can now be safely used as local variables.
262 262
263*** Added ability to login with a port on MySQL. 263*** Added ability to login with a port on MySQL.
264The custom variable `sql-port' can be specified for connection to 264The custom variable `sql-port' can be specified for connection to
@@ -269,15 +269,42 @@ Each supported product has a custom variable `sql-*-login-params'
269which is a list of the parameters to be prompted for before a 269which is a list of the parameters to be prompted for before a
270connection is established. 270connection is established.
271 271
272*** Added `sql-connection-alist' to record login parameter values.
273An alist for recording different username, database and server
274values. If there are multiple databases that you connect to the
275parameters needed can be stored in this alist.
276
277For example, the following might be set in the user's init.el:
278
279 (setq sql-connection-alist
280 '((dev (sql-product 'sqlite)
281 (sql-database "/home/mmaug/dev.db"))
282 (prd (sql-product 'oracle)
283 (sql-user "mmaug")
284 (sql-database "iprd2a"))))
285
286This defines two connections named "dev" and "prd".
287
288*** Added `sql-connect' to use predefined connections.
289Sets the login parameters based on the values in the
290`sql-connection-alist' and start a SQL interactive session. Any
291values specified in the connection will not be prompted for.
292
293In the example above, if the user were to invoke M-x sql-connect, they
294would be prompted for the connection. The user can respond with
295either "dev" or "prd". The "dev" connection would connect to the
296SQLite database without prompting; the "prd" connection would prompt
297for the users password and then connect to the Oracle database.
298
272*** Added option `sql-send-terminator'. 299*** Added option `sql-send-terminator'.
273When set makes sure that each command sent with `sql-send-*' commands 300When set makes sure that each command sent with `sql-send-*' commands
274are properly terminated and submitted to the SQL processor. 301are properly terminated and submitted to the SQL processor.
275 302
276*** Added option `sql-oracle-scan-on'. 303*** Added option `sql-oracle-scan-on'.
277When set commands sent to Oracle's SQL*Plus are scanned for strings 304When set commands sent to Oracle's SQL*Plus are scanned for strings
278starting with an ampersand and the user is asked for replacement 305starting with an ampersand and the user is asked for replacement text.
279text. In general, the SQL*Plus option SCAN should be set OFF under 306In general, the SQL*Plus option SCAN should always be set OFF under
280SQL interactive mode. 307SQL interactive mode and this option used in its place.
281 308
282*** SQL interactive mode will replace tabs with spaces. 309*** SQL interactive mode will replace tabs with spaces.
283This prevents the comand interpretter for MySQL and Postgres from 310This prevents the comand interpretter for MySQL and Postgres from
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a1bce7df595..7d071d06e6b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,34 @@
12010-07-18 Michael R. Mauger <mmaug@yahoo.com>
2
3 * progmodes/sql.el: Version 2.2.
4 (sql-product, sql-user, sql-database, sql-server, sql-port): Use
5 defcustom :safe keyword rather than putting safe-local-variable
6 property.
7 (sql-password): Use defcustom :risky keyword rather than putting
8 risky-local-variable property.
9 (sql-oracle-login-params, sql-sqlite-login-params)
10 (sql-solid-login-params, sql-sybase-login-params)
11 (sql-informix-login-params, sql-ingres-login-params)
12 (sql-ms-login-params, sql-postgres-login-params)
13 (sql-interbase-login-params, sql-db2-login-params)
14 (sql-linter-login-params): Add `port' option
15 (sql-get-product-feature): Added NO-INDIRECT parameter.
16 (sql-comint-oracle, sql-comint-sybase)
17 (sql-comint-informix, sql-comint-sqlite, sql-comint-mysql)
18 (sql-comint-solid, sql-comint-ingres, sql-comint-ms)
19 (sql-comint-postgres, sql-comint-interbase, sql-comint-db2)
20 (sql-comint-linter): Renamed sql-connect-* functions to
21 sql-comint-*.
22 (sql-product-alist, sql-mode-menu): Renamed as above and
23 :sqli-connect-func to :sqli-comint-func.
24 (sql-connection): New variable
25 (sql-interactive-mode): Set it.
26 (sql-connection-alist): New variable.
27 (sql-connect): New function.
28 (sql--alt-buffer-part, sql--alt-if-not-empty)
29 (sql-make-alternate-buffer-name): Improved alternative buffer
30 name.
31
12010-07-17 Thierry Volpiatto <thierry.volpiatto@gmail.com> 322010-07-17 Thierry Volpiatto <thierry.volpiatto@gmail.com>
2 33
3 * image-mode.el (image-bookmark-make-record): Do not set context 34 * image-mode.el (image-bookmark-make-record): Do not set context
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 19e60da7ea2..d31b7ad0ef5 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -5,7 +5,7 @@
5 5
6;; Author: Alex Schroeder <alex@gnu.org> 6;; Author: Alex Schroeder <alex@gnu.org>
7;; Maintainer: Michael Mauger <mmaug@yahoo.com> 7;; Maintainer: Michael Mauger <mmaug@yahoo.com>
8;; Version: 2.1 8;; Version: 2.2
9;; Keywords: comm languages processes 9;; Keywords: comm languages processes
10;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el 10;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el
11;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode 11;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode
@@ -156,7 +156,8 @@
156;; (const user) 156;; (const user)
157;; (const password) 157;; (const password)
158;; (const server) 158;; (const server)
159;; (const database))) 159;; (const database)
160;; (const port)))
160;; :group 'SQL) 161;; :group 'SQL)
161;; 162;;
162;; (sql-set-product-feature 'xyz 163;; (sql-set-product-feature 'xyz
@@ -170,7 +171,7 @@
170;; (sql-set-product-feature 'xyz 171;; (sql-set-product-feature 'xyz
171;; :sqli-options 'my-sql-xyz-options)) 172;; :sqli-options 'my-sql-xyz-options))
172 173
173;; (defun my-sql-connect-xyz (product options) 174;; (defun my-sql-comint-xyz (product options)
174;; "Connect ti XyzDB in a comint buffer." 175;; "Connect ti XyzDB in a comint buffer."
175;; 176;;
176;; ;; Do something with `sql-user', `sql-password', 177;; ;; Do something with `sql-user', `sql-password',
@@ -184,10 +185,10 @@
184;; (setq params (append (list "-P" sql-password) params))) 185;; (setq params (append (list "-P" sql-password) params)))
185;; (if (not (string= "" sql-user)) 186;; (if (not (string= "" sql-user))
186;; (setq params (append (list "-U" sql-user) params))) 187;; (setq params (append (list "-U" sql-user) params)))
187;; (sql-connect product params))) 188;; (sql-comint product params)))
188;; 189;;
189;; (sql-set-product-feature 'xyz 190;; (sql-set-product-feature 'xyz
190;; :sqli-connect-func 'my-sql-connect-xyz) 191;; :sqli-connect-func 'my-sql-comint-xyz)
191 192
192;; 6) Define a convienence function to invoke the SQL interpreter. 193;; 6) Define a convienence function to invoke the SQL interpreter.
193 194
@@ -235,6 +236,7 @@
235(eval-when-compile 236(eval-when-compile
236 (require 'regexp-opt)) 237 (require 'regexp-opt))
237(require 'custom) 238(require 'custom)
239(require 'assoc)
238(eval-when-compile ;; needed in Emacs 19, 20 240(eval-when-compile ;; needed in Emacs 19, 20
239 (setq max-specpdl-size 2000)) 241 (setq max-specpdl-size 2000))
240 242
@@ -255,8 +257,8 @@
255(defcustom sql-user "" 257(defcustom sql-user ""
256 "Default username." 258 "Default username."
257 :type 'string 259 :type 'string
258 :group 'SQL) 260 :group 'SQL
259(put 'sql-user 'safe-local-variable 'stringp) 261 :safe 'stringp)
260 262
261(defcustom sql-password "" 263(defcustom sql-password ""
262 "Default password. 264 "Default password.
@@ -264,32 +266,36 @@
264Storing your password in a textfile such as ~/.emacs could be dangerous. 266Storing your password in a textfile such as ~/.emacs could be dangerous.
265Customizing your password will store it in your ~/.emacs file." 267Customizing your password will store it in your ~/.emacs file."
266 :type 'string 268 :type 'string
267 :group 'SQL) 269 :group 'SQL
268(put 'sql-password 'risky-local-variable t) 270 :risky t)
269 271
270(defcustom sql-database "" 272(defcustom sql-database ""
271 "Default database." 273 "Default database."
272 :type 'string 274 :type 'string
273 :group 'SQL) 275 :group 'SQL
274(put 'sql-database 'safe-local-variable 'stringp) 276 :safe 'stringp)
275 277
276(defcustom sql-server "" 278(defcustom sql-server ""
277 "Default server or host." 279 "Default server or host."
278 :type 'string 280 :type 'string
279 :group 'SQL) 281 :group 'SQL
280(put 'sql-server 'safe-local-variable 'stringp) 282 :safe 'stringp)
281 283
282(defcustom sql-port nil 284(defcustom sql-port nil
283 "Default server or host." 285 "Default server or host."
286 :version "24.1"
284 :type 'number 287 :type 'number
285 :group 'SQL) 288 :group 'SQL
286(put 'sql-port 'safe-local-variable 'numberp) 289 :safe 'numberp)
287 290
288;; SQL Product support 291;; SQL Product support
289 292
290(defvar sql-interactive-product nil 293(defvar sql-interactive-product nil
291 "Product under `sql-interactive-mode'.") 294 "Product under `sql-interactive-mode'.")
292 295
296(defvar sql-connection nil
297 "Connection name if interactive session started by `sql-connect'.")
298
293(defvar sql-product-alist 299(defvar sql-product-alist
294 '((ansi 300 '((ansi
295 :name "ANSI" 301 :name "ANSI"
@@ -301,7 +307,7 @@ Customizing your password will store it in your ~/.emacs file."
301 :sqli-program sql-db2-program 307 :sqli-program sql-db2-program
302 :sqli-options sql-db2-options 308 :sqli-options sql-db2-options
303 :sqli-login sql-db2-login-params 309 :sqli-login sql-db2-login-params
304 :sqli-connect-func sql-connect-db2 310 :sqli-comint-func sql-comint-db2
305 :prompt-regexp "^db2 => " 311 :prompt-regexp "^db2 => "
306 :prompt-length 7 312 :prompt-length 7
307 :input-filter sql-escape-newlines-filter) 313 :input-filter sql-escape-newlines-filter)
@@ -312,7 +318,7 @@ Customizing your password will store it in your ~/.emacs file."
312 :sqli-program sql-informix-program 318 :sqli-program sql-informix-program
313 :sqli-options sql-informix-options 319 :sqli-options sql-informix-options
314 :sqli-login sql-informix-login-params 320 :sqli-login sql-informix-login-params
315 :sqli-connect-func sql-connect-informix 321 :sqli-comint-func sql-comint-informix
316 :prompt-regexp "^> " 322 :prompt-regexp "^> "
317 :prompt-length 2 323 :prompt-length 2
318 :syntax-alist ((?{ . "<") (?} . ">"))) 324 :syntax-alist ((?{ . "<") (?} . ">")))
@@ -323,7 +329,7 @@ Customizing your password will store it in your ~/.emacs file."
323 :sqli-program sql-ingres-program 329 :sqli-program sql-ingres-program
324 :sqli-options sql-ingres-options 330 :sqli-options sql-ingres-options
325 :sqli-login sql-ingres-login-params 331 :sqli-login sql-ingres-login-params
326 :sqli-connect-func sql-connect-ingres 332 :sqli-comint-func sql-comint-ingres
327 :prompt-regexp "^\* " 333 :prompt-regexp "^\* "
328 :prompt-length 2) 334 :prompt-length 2)
329 335
@@ -333,7 +339,7 @@ Customizing your password will store it in your ~/.emacs file."
333 :sqli-program sql-interbase-program 339 :sqli-program sql-interbase-program
334 :sqli-options sql-interbase-options 340 :sqli-options sql-interbase-options
335 :sqli-login sql-interbase-login-params 341 :sqli-login sql-interbase-login-params
336 :sqli-connect-func sql-connect-interbase 342 :sqli-comint-func sql-comint-interbase
337 :prompt-regexp "^SQL> " 343 :prompt-regexp "^SQL> "
338 :prompt-length 5) 344 :prompt-length 5)
339 345
@@ -343,7 +349,7 @@ Customizing your password will store it in your ~/.emacs file."
343 :sqli-program sql-linter-program 349 :sqli-program sql-linter-program
344 :sqli-options sql-linter-options 350 :sqli-options sql-linter-options
345 :sqli-login sql-linter-login-params 351 :sqli-login sql-linter-login-params
346 :sqli-connect-func sql-connect-linter 352 :sqli-comint-func sql-comint-linter
347 :prompt-regexp "^SQL>" 353 :prompt-regexp "^SQL>"
348 :prompt-length 4) 354 :prompt-length 4)
349 355
@@ -353,7 +359,7 @@ Customizing your password will store it in your ~/.emacs file."
353 :sqli-program sql-ms-program 359 :sqli-program sql-ms-program
354 :sqli-options sql-ms-options 360 :sqli-options sql-ms-options
355 :sqli-login sql-ms-login-params 361 :sqli-login sql-ms-login-params
356 :sqli-connect-func sql-connect-ms 362 :sqli-comint-func sql-comint-ms
357 :prompt-regexp "^[0-9]*>" 363 :prompt-regexp "^[0-9]*>"
358 :prompt-length 5 364 :prompt-length 5
359 :syntax-alist ((?@ . "w")) 365 :syntax-alist ((?@ . "w"))
@@ -366,7 +372,7 @@ Customizing your password will store it in your ~/.emacs file."
366 :sqli-program sql-mysql-program 372 :sqli-program sql-mysql-program
367 :sqli-options sql-mysql-options 373 :sqli-options sql-mysql-options
368 :sqli-login sql-mysql-login-params 374 :sqli-login sql-mysql-login-params
369 :sqli-connect-func sql-connect-mysql 375 :sqli-comint-func sql-comint-mysql
370 :prompt-regexp "^mysql> " 376 :prompt-regexp "^mysql> "
371 :prompt-length 6 377 :prompt-length 6
372 :input-filter sql-remove-tabs-filter) 378 :input-filter sql-remove-tabs-filter)
@@ -377,7 +383,7 @@ Customizing your password will store it in your ~/.emacs file."
377 :sqli-program sql-oracle-program 383 :sqli-program sql-oracle-program
378 :sqli-options sql-oracle-options 384 :sqli-options sql-oracle-options
379 :sqli-login sql-oracle-login-params 385 :sqli-login sql-oracle-login-params
380 :sqli-connect-func sql-connect-oracle 386 :sqli-comint-func sql-comint-oracle
381 :prompt-regexp "^SQL> " 387 :prompt-regexp "^SQL> "
382 :prompt-length 5 388 :prompt-length 5
383 :syntax-alist ((?$ . "w") (?# . "w")) 389 :syntax-alist ((?$ . "w") (?# . "w"))
@@ -391,7 +397,7 @@ Customizing your password will store it in your ~/.emacs file."
391 :sqli-program sql-postgres-program 397 :sqli-program sql-postgres-program
392 :sqli-options sql-postgres-options 398 :sqli-options sql-postgres-options
393 :sqli-login sql-postgres-login-params 399 :sqli-login sql-postgres-login-params
394 :sqli-connect-func sql-connect-postgres 400 :sqli-comint-func sql-comint-postgres
395 :prompt-regexp "^.*[#>] *" 401 :prompt-regexp "^.*[#>] *"
396 :prompt-length 5 402 :prompt-length 5
397 :input-filter sql-remove-tabs-filter 403 :input-filter sql-remove-tabs-filter
@@ -403,7 +409,7 @@ Customizing your password will store it in your ~/.emacs file."
403 :sqli-program sql-solid-program 409 :sqli-program sql-solid-program
404 :sqli-options sql-solid-options 410 :sqli-options sql-solid-options
405 :sqli-login sql-solid-login-params 411 :sqli-login sql-solid-login-params
406 :sqli-connect-func sql-connect-solid 412 :sqli-comint-func sql-comint-solid
407 :prompt-regexp "^" 413 :prompt-regexp "^"
408 :prompt-length 0) 414 :prompt-length 0)
409 415
@@ -414,7 +420,7 @@ Customizing your password will store it in your ~/.emacs file."
414 :sqli-program sql-sqlite-program 420 :sqli-program sql-sqlite-program
415 :sqli-options sql-sqlite-options 421 :sqli-options sql-sqlite-options
416 :sqli-login sql-sqlite-login-params 422 :sqli-login sql-sqlite-login-params
417 :sqli-connect-func sql-connect-sqlite 423 :sqli-comint-func sql-comint-sqlite
418 :prompt-regexp "^sqlite> " 424 :prompt-regexp "^sqlite> "
419 :prompt-length 8) 425 :prompt-length 8)
420 426
@@ -424,7 +430,7 @@ Customizing your password will store it in your ~/.emacs file."
424 :sqli-program sql-sybase-program 430 :sqli-program sql-sybase-program
425 :sqli-options sql-sybase-options 431 :sqli-options sql-sybase-options
426 :sqli-login sql-sybase-login-params 432 :sqli-login sql-sybase-login-params
427 :sqli-connect-func sql-connect-sybase 433 :sqli-comint-func sql-comint-sybase
428 :prompt-regexp "^SQL> " 434 :prompt-regexp "^SQL> "
429 :prompt-length 5 435 :prompt-length 5
430 :syntax-alist ((?@ . "w")) 436 :syntax-alist ((?@ . "w"))
@@ -463,7 +469,7 @@ may be any one of the following:
463 database and server) needed to connect to 469 database and server) needed to connect to
464 the database. 470 the database.
465 471
466 :sqli-connect-func name of a function which accepts no 472 :sqli-comint-func name of a function which accepts no
467 parameters that will use the values of 473 parameters that will use the values of
468 `sql-user', `sql-password', 474 `sql-user', `sql-password',
469 `sql-database' and `sql-server' to open a 475 `sql-database' and `sql-server' to open a
@@ -508,6 +514,51 @@ settings.")
508 '(:font-lock :sqli-program :sqli-options :sqli-login)) 514 '(:font-lock :sqli-program :sqli-options :sqli-login))
509 515
510;;;###autoload 516;;;###autoload
517(defcustom sql-connection-alist nil
518 "An alist of connection parameters for interacting with a SQL
519 product.
520
521Each element of the alist is as follows:
522
523 \(CONNECTION \(SQL-VARIABLE VALUE) ...)
524
525Where CONNECTION is a symbol identifying the connection, SQL-VARIABLE
526is the symbol name of a SQL mode variable, and VALUE is the value to
527be assigned to the variable.
528
529The most common SQL-VARIABLE settings associated with a connection
530are:
531
532 `sql-product'
533 `sql-user'
534 `sql-password'
535 `sql-port'
536 `sql-server'
537 `sql-database'
538
539If a SQL-VARIABLE is part of the connection, it will not be
540prompted for during login."
541
542 :type `(alist :key-type (symbol :tag "Connection")
543 :value-type
544 (set
545 (group (const :tag "Product" sql-product)
546 (choice
547 ,@(mapcar (lambda (prod-info)
548 `(const :tag
549 ,(or (plist-get (cdr prod-info) :name)
550 (capitalize (symbol-name (car prod-info))))
551 (quote ,(car prod-info))))
552 sql-product-alist)))
553 (group (const :tag "Username" sql-user) string)
554 (group (const :tag "Password" sql-password) string)
555 (group (const :tag "Server" sql-server) string)
556 (group (const :tag "Database" sql-database) string)
557 (group (const :tag "Port" sql-port) integer)))
558 :version "24.1"
559 :group 'SQL)
560
561;;;###autoload
511(defcustom sql-product 'ansi 562(defcustom sql-product 'ansi
512 "Select the SQL database product used so that buffers can be 563 "Select the SQL database product used so that buffers can be
513highlighted properly when you open them." 564highlighted properly when you open them."
@@ -518,11 +569,8 @@ highlighted properly when you open them."
518 (capitalize (symbol-name (car prod-info)))) 569 (capitalize (symbol-name (car prod-info))))
519 ,(car prod-info))) 570 ,(car prod-info)))
520 sql-product-alist)) 571 sql-product-alist))
521 :group 'SQL) 572 :group 'SQL
522(put 'sql-product 'safe-local-variable 'symbolp) 573 :safe 'symbolp)
523
524(defvar sql-interactive-product nil
525 "Product under `sql-interactive-mode'.")
526 574
527;; misc customization of sql.el behaviour 575;; misc customization of sql.el behaviour
528 576
@@ -681,7 +729,8 @@ You will find the file in your Orant\\bin directory."
681 (const user) 729 (const user)
682 (const password) 730 (const password)
683 (const server) 731 (const server)
684 (const database))) 732 (const database)
733 (const port)))
685 :version "24.1" 734 :version "24.1"
686 :group 'SQL) 735 :group 'SQL)
687 736
@@ -721,7 +770,8 @@ Starts `sql-interactive-mode' after doing some setup."
721 (const user) 770 (const user)
722 (const password) 771 (const password)
723 (const server) 772 (const server)
724 (const database))) 773 (const database)
774 (const port)))
725 :version "24.1" 775 :version "24.1"
726 :group 'SQL) 776 :group 'SQL)
727 777
@@ -768,7 +818,8 @@ Starts `sql-interactive-mode' after doing some setup."
768 (const user) 818 (const user)
769 (const password) 819 (const password)
770 (const server) 820 (const server)
771 (const database))) 821 (const database)
822 (const port)))
772 :version "24.1" 823 :version "24.1"
773 :group 'SQL) 824 :group 'SQL)
774 825
@@ -794,7 +845,8 @@ Some versions of isql might require the -n option in order to work."
794 (const user) 845 (const user)
795 (const password) 846 (const password)
796 (const server) 847 (const server)
797 (const database))) 848 (const database)
849 (const port)))
798 :version "24.1" 850 :version "24.1"
799 :group 'SQL) 851 :group 'SQL)
800 852
@@ -813,7 +865,8 @@ Starts `sql-interactive-mode' after doing some setup."
813 (const user) 865 (const user)
814 (const password) 866 (const password)
815 (const server) 867 (const server)
816 (const database))) 868 (const database)
869 (const port)))
817 :version "24.1" 870 :version "24.1"
818 :group 'SQL) 871 :group 'SQL)
819 872
@@ -832,7 +885,8 @@ Starts `sql-interactive-mode' after doing some setup."
832 (const user) 885 (const user)
833 (const password) 886 (const password)
834 (const server) 887 (const server)
835 (const database))) 888 (const database)
889 (const port)))
836 :version "24.1" 890 :version "24.1"
837 :group 'SQL) 891 :group 'SQL)
838 892
@@ -858,7 +912,8 @@ Starts `sql-interactive-mode' after doing some setup."
858 (const user) 912 (const user)
859 (const password) 913 (const password)
860 (const server) 914 (const server)
861 (const database))) 915 (const database)
916 (const port)))
862 :version "24.1" 917 :version "24.1"
863 :group 'SQL) 918 :group 'SQL)
864 919
@@ -889,7 +944,8 @@ add your name with a \"-U\" prefix (such as \"-Umark\") to the list."
889 (const user) 944 (const user)
890 (const password) 945 (const password)
891 (const server) 946 (const server)
892 (const database))) 947 (const database)
948 (const port)))
893 :version "24.1" 949 :version "24.1"
894 :group 'SQL) 950 :group 'SQL)
895 951
@@ -914,7 +970,8 @@ Starts `sql-interactive-mode' after doing some setup."
914 (const user) 970 (const user)
915 (const password) 971 (const password)
916 (const server) 972 (const server)
917 (const database))) 973 (const database)
974 (const port)))
918 :version "24.1" 975 :version "24.1"
919 :group 'SQL) 976 :group 'SQL)
920 977
@@ -939,7 +996,8 @@ Starts `sql-interactive-mode' after doing some setup."
939 (const user) 996 (const user)
940 (const password) 997 (const password)
941 (const server) 998 (const server)
942 (const database))) 999 (const database)
1000 (const port)))
943 :version "24.1" 1001 :version "24.1"
944 :group 'SQL) 1002 :group 'SQL)
945 1003
@@ -964,7 +1022,8 @@ Starts `sql-interactive-mode' after doing some setup."
964 (const user) 1022 (const user)
965 (const password) 1023 (const password)
966 (const server) 1024 (const server)
967 (const database))) 1025 (const database)
1026 (const port)))
968 :version "24.1" 1027 :version "24.1"
969 :group 'SQL) 1028 :group 'SQL)
970 1029
@@ -1057,7 +1116,7 @@ Based on `comint-mode-map'.")
1057 ["Send String" sql-send-string (and (buffer-live-p sql-buffer) 1116 ["Send String" sql-send-string (and (buffer-live-p sql-buffer)
1058 (get-buffer-process sql-buffer))] 1117 (get-buffer-process sql-buffer))]
1059 ["--" nil nil] 1118 ["--" nil nil]
1060 ["Start SQLi session" sql-product-interactive (sql-get-product-feature sql-product :sqli-connect-func)] 1119 ["Start SQLi session" sql-product-interactive (sql-get-product-feature sql-product :sqli-comint-func)]
1061 ["Show SQLi buffer" sql-show-sqli-buffer t] 1120 ["Show SQLi buffer" sql-show-sqli-buffer t]
1062 ["Set SQLi buffer" sql-set-sqli-buffer t] 1121 ["Set SQLi buffer" sql-set-sqli-buffer t]
1063 ["Pop to SQLi buffer after send" 1122 ["Pop to SQLi buffer after send"
@@ -2016,13 +2075,17 @@ argument must be a plist keyword accepted by
2016 (setcdr p (plist-put (cdr p) feature newvalue))) 2075 (setcdr p (plist-put (cdr p) feature newvalue)))
2017 (message "`%s' is not a known product; use `sql-add-product' to add it first." product)))) 2076 (message "`%s' is not a known product; use `sql-add-product' to add it first." product))))
2018 2077
2019(defun sql-get-product-feature (product feature &optional fallback) 2078(defun sql-get-product-feature (product feature &optional fallback not-indirect)
2020 "Lookup FEATURE associated with a SQL PRODUCT. 2079 "Lookup FEATURE associated with a SQL PRODUCT.
2021 2080
2022If the FEATURE is nil for PRODUCT, and FALLBACK is specified, 2081If the FEATURE is nil for PRODUCT, and FALLBACK is specified,
2023then the FEATURE associated with the FALLBACK product is 2082then the FEATURE associated with the FALLBACK product is
2024returned. 2083returned.
2025 2084
2085If the FEATURE is in the list `sql-indirect-features', and the
2086NOT-INDIRECT parameter is not set, then the value of the symbol
2087stored in the connect alist is returned.
2088
2026See `sql-product-alist' for a list of products and supported features." 2089See `sql-product-alist' for a list of products and supported features."
2027 (let* ((p (assoc product sql-product-alist)) 2090 (let* ((p (assoc product sql-product-alist))
2028 (v (plist-get (cdr p) feature))) 2091 (v (plist-get (cdr p) feature)))
@@ -2036,6 +2099,7 @@ See `sql-product-alist' for a list of products and supported features."
2036 2099
2037 (if (and 2100 (if (and
2038 (member feature sql-indirect-features) 2101 (member feature sql-indirect-features)
2102 (not not-indirect)
2039 (symbolp v)) 2103 (symbolp v))
2040 (symbol-value v) 2104 (symbol-value v)
2041 v)) 2105 v))
@@ -2329,6 +2393,7 @@ function like this: (sql-get-login 'user 'password 'database)."
2329 (setq sql-database 2393 (setq sql-database
2330 (read-from-minibuffer "Database: " sql-database nil nil 2394 (read-from-minibuffer "Database: " sql-database nil nil
2331 'sql-database-history)))) 2395 'sql-database-history))))
2396
2332 (setq what (cdr what)))) 2397 (setq what (cdr what))))
2333 2398
2334(defun sql-find-sqli-buffer () 2399(defun sql-find-sqli-buffer ()
@@ -2415,21 +2480,62 @@ variable `sql-buffer'. See `sql-help' on how to create such a buffer."
2415 (message "Buffer %s has no process." (buffer-name sql-buffer)) 2480 (message "Buffer %s has no process." (buffer-name sql-buffer))
2416 (message "Current SQLi buffer is %s." (buffer-name sql-buffer))))) 2481 (message "Current SQLi buffer is %s." (buffer-name sql-buffer)))))
2417 2482
2483(defun sql--alt-buffer-part (delim part)
2484 (unless (string= "" part)
2485 (list delim part)))
2486
2487(defun sql--alt-if-not-empty (s)
2488 (if (string= "" s) nil s))
2489
2418(defun sql-make-alternate-buffer-name () 2490(defun sql-make-alternate-buffer-name ()
2419 "Return a string that can be used to rename a SQLi buffer. 2491 "Return a string that can be used to rename a SQLi buffer.
2420 2492
2421This is used to set `sql-alternate-buffer-name' within 2493This is used to set `sql-alternate-buffer-name' within
2422`sql-interactive-mode'." 2494`sql-interactive-mode'.
2423 (concat (if (string= "" sql-user) 2495
2424 (if (string= "" (user-login-name)) 2496If the session was started with `sql-connect' then the alternate
2425 () 2497name would be the name of the connection.
2426 (concat (user-login-name) "/")) 2498
2427 (concat sql-user "/")) 2499Otherwise, it uses the parameters identified by the :sqlilogin
2428 (if (string= "" sql-database) 2500parameter.
2429 (if (string= "" sql-server) 2501
2430 (system-name) 2502If all else fails, the alternate name would be the user and
2431 sql-server) 2503server/database name."
2432 sql-database))) 2504
2505 (or
2506 ;; If started by sql-connect, use that
2507 (sql--alt-if-not-empty
2508 (when sql-connection (symbol-name sql-connection)))
2509
2510 ;; based on :sqli-login setting
2511 (sql--alt-if-not-empty
2512 (apply 'concat
2513 (cdr
2514 (apply 'append nil
2515 (mapcar
2516 (lambda (v)
2517 (cond
2518 ((eq v 'user) (sql--alt-buffer-part "/" sql-user))
2519 ((eq v 'server) (sql--alt-buffer-part "@" sql-server))
2520 ((eq v 'database) (sql--alt-buffer-part "@" sql-database))
2521 ((eq v 'port) (sql--alt-buffer-part ":" sql-port))
2522
2523 ((eq v 'password) nil)
2524 (t nil)))
2525 (sql-get-product-feature sql-product :sqli-login))))))
2526
2527 ;; Default: username/server format
2528 (sql--alt-if-not-empty
2529 (concat (if (string= "" sql-user)
2530 (if (string= "" (user-login-name))
2531 ()
2532 (concat (user-login-name) "/"))
2533 (concat sql-user "/"))
2534 (if (string= "" sql-database)
2535 (if (string= "" sql-server)
2536 (system-name)
2537 sql-server)
2538 sql-database)))))
2433 2539
2434(defun sql-rename-buffer () 2540(defun sql-rename-buffer ()
2435 "Rename a SQLi buffer." 2541 "Rename a SQLi buffer."
@@ -2788,6 +2894,8 @@ you entered, right above the output it created.
2788 (setq abbrev-all-caps 1) 2894 (setq abbrev-all-caps 1)
2789 ;; Exiting the process will call sql-stop. 2895 ;; Exiting the process will call sql-stop.
2790 (set-process-sentinel (get-buffer-process sql-buffer) 'sql-stop) 2896 (set-process-sentinel (get-buffer-process sql-buffer) 'sql-stop)
2897 ;; Save the connection name
2898 (make-local-variable 'sql-connection)
2791 ;; Create a usefull name for renaming this buffer later. 2899 ;; Create a usefull name for renaming this buffer later.
2792 (make-local-variable 'sql-alternate-buffer-name) 2900 (make-local-variable 'sql-alternate-buffer-name)
2793 (setq sql-alternate-buffer-name (sql-make-alternate-buffer-name)) 2901 (setq sql-alternate-buffer-name (sql-make-alternate-buffer-name))
@@ -2854,7 +2962,7 @@ If buffer exists and a process is running, just switch to buffer `*SQL*'.
2854 ((symbolp product) product) ; Product specified 2962 ((symbolp product) product) ; Product specified
2855 (t sql-product))) ; Default to sql-product 2963 (t sql-product))) ; Default to sql-product
2856 2964
2857 (when (sql-get-product-feature product :sqli-connect-func) 2965 (when (sql-get-product-feature product :sqli-comint-func)
2858 (if (and sql-buffer 2966 (if (and sql-buffer
2859 (buffer-live-p sql-buffer) 2967 (buffer-live-p sql-buffer)
2860 (comint-check-proc sql-buffer)) 2968 (comint-check-proc sql-buffer))
@@ -2882,7 +2990,7 @@ If buffer exists and a process is running, just switch to buffer `*SQL*'.
2882 2990
2883 ;; Connect to database. 2991 ;; Connect to database.
2884 (message "Login...") 2992 (message "Login...")
2885 (funcall (sql-get-product-feature product :sqli-connect-func) 2993 (funcall (sql-get-product-feature product :sqli-comint-func)
2886 product 2994 product
2887 (sql-get-product-feature product :sqli-options)) 2995 (sql-get-product-feature product :sqli-options))
2888 2996
@@ -2901,16 +3009,82 @@ If buffer exists and a process is running, just switch to buffer `*SQL*'.
2901 (message "Login...done") 3009 (message "Login...done")
2902 (pop-to-buffer sql-buffer))))) 3010 (pop-to-buffer sql-buffer)))))
2903 3011
2904(defun sql-connect (product params) 3012(defun sql-comint (product params)
2905 "Set up a comint buffer to connect to the SQL processor. 3013 "Set up a comint buffer to run the SQL processor.
2906 3014
2907PRODUCT is the SQL product. PARAMS is a list of strings which are 3015PRODUCT is the SQL product. PARAMS is a list of strings which are
2908passed as command line arguments." 3016passed as command line arguments."
2909 (let ((program (sql-get-product-feature product :sqli-program))) 3017 (let ((program (sql-get-product-feature product :sqli-program)))
2910 (set-buffer 3018 (set-buffer
2911 (if params 3019 (apply 'make-comint "SQL" program nil params))))
2912 (apply 'make-comint "SQL" program nil params) 3020
2913 (make-comint "SQL" program nil))))) 3021;;;###autoload
3022(defun sql-connect (connection)
3023 "Connect to an interactive session using CONNECTION settings.
3024
3025See `sql-connection-alist' to see how to define connections and
3026their settings.
3027
3028The user will not be prompted for any login parameters if a value
3029is specified in the connection settings."
3030
3031 ;; Prompt for the connection from those defined in the alist
3032 (interactive
3033 (if sql-connection-alist
3034 (list
3035 (intern
3036 (completing-read "Connection: "
3037 (mapcar (lambda (c) (symbol-name (car c)))
3038 sql-connection-alist)
3039 nil t)))
3040 nil))
3041
3042 ;; Are there connections defined
3043 (if sql-connection-alist
3044 ;; Was one selected
3045 (when connection
3046 ;; Get connection settings
3047 (let ((connect-set (aget sql-connection-alist connection)))
3048 ;; Settings are defined
3049 (if connect-set
3050 ;; Set the desired parameters
3051 (eval `(let*
3052 (,@connect-set
3053 ;; :sqli-login params variable
3054 (param-var (sql-get-product-feature sql-product
3055 :sqli-login nil t))
3056 ;; :sqli-login params value
3057 (login-params (sql-get-product-feature sql-product
3058 :sqli-login))
3059 ;; which params are in the connection
3060 (set-params (mapcar
3061 (lambda (v)
3062 (cond
3063 ((eq (car v) 'sql-user) 'user)
3064 ((eq (car v) 'sql-password) 'password)
3065 ((eq (car v) 'sql-server) 'server)
3066 ((eq (car v) 'sql-database) 'database)
3067 ((eq (car v) 'sql-port) 'port)
3068 (t (car v))))
3069 connect-set))
3070 ;; the remaining params (w/o the connection params)
3071 (rem-params (apply 'append nil
3072 (mapcar
3073 (lambda (l)
3074 (unless (member l set-params)
3075 (list l)))
3076 login-params)))
3077 ;; Remember the connection
3078 (sql-connection connection))
3079
3080 ;; Set the remaining parameters and start the
3081 ;; interactive session
3082 (eval `(let ((,param-var ',rem-params))
3083 (sql-product-interactive sql-product)))))
3084 (message "SQL Connection \"%s\" does not exist" connection)
3085 nil)))
3086 (message "No SQL Connections defined")
3087 nil))
2914 3088
2915;;;###autoload 3089;;;###autoload
2916(defun sql-oracle () 3090(defun sql-oracle ()
@@ -2939,7 +3113,7 @@ The default comes from `process-coding-system-alist' and
2939 (interactive) 3113 (interactive)
2940 (sql-product-interactive 'oracle)) 3114 (sql-product-interactive 'oracle))
2941 3115
2942(defun sql-connect-oracle (product options) 3116(defun sql-comint-oracle (product options)
2943 "Create comint buffer and connect to Oracle." 3117 "Create comint buffer and connect to Oracle."
2944 ;; Produce user/password@database construct. Password without user 3118 ;; Produce user/password@database construct. Password without user
2945 ;; is meaningless; database without user/password is meaningless, 3119 ;; is meaningless; database without user/password is meaningless,
@@ -2955,7 +3129,7 @@ The default comes from `process-coding-system-alist' and
2955 (if parameter 3129 (if parameter
2956 (setq parameter (nconc (list parameter) options)) 3130 (setq parameter (nconc (list parameter) options))
2957 (setq parameter options)) 3131 (setq parameter options))
2958 (sql-connect product parameter))) 3132 (sql-comint product parameter)))
2959 3133
2960 3134
2961 3135
@@ -2986,7 +3160,7 @@ The default comes from `process-coding-system-alist' and
2986 (interactive) 3160 (interactive)
2987 (sql-product-interactive 'sybase)) 3161 (sql-product-interactive 'sybase))
2988 3162
2989(defun sql-connect-sybase (product options) 3163(defun sql-comint-sybase (product options)
2990 "Create comint buffer and connect to Sybase." 3164 "Create comint buffer and connect to Sybase."
2991 ;; Put all parameters to the program (if defined) in a list and call 3165 ;; Put all parameters to the program (if defined) in a list and call
2992 ;; make-comint. 3166 ;; make-comint.
@@ -2999,7 +3173,7 @@ The default comes from `process-coding-system-alist' and
2999 (setq params (append (list "-P" sql-password) params))) 3173 (setq params (append (list "-P" sql-password) params)))
3000 (if (not (string= "" sql-user)) 3174 (if (not (string= "" sql-user))
3001 (setq params (append (list "-U" sql-user) params))) 3175 (setq params (append (list "-U" sql-user) params)))
3002 (sql-connect product params))) 3176 (sql-comint product params)))
3003 3177
3004 3178
3005 3179
@@ -3028,7 +3202,7 @@ The default comes from `process-coding-system-alist' and
3028 (interactive) 3202 (interactive)
3029 (sql-product-interactive 'informix)) 3203 (sql-product-interactive 'informix))
3030 3204
3031(defun sql-connect-informix (product options) 3205(defun sql-comint-informix (product options)
3032 "Create comint buffer and connect to Informix." 3206 "Create comint buffer and connect to Informix."
3033 ;; username and password are ignored. 3207 ;; username and password are ignored.
3034 (let ((db (if (string= "" sql-database) 3208 (let ((db (if (string= "" sql-database)
@@ -3036,7 +3210,7 @@ The default comes from `process-coding-system-alist' and
3036 (if (string= "" sql-server) 3210 (if (string= "" sql-server)
3037 sql-database 3211 sql-database
3038 (concat sql-database "@" sql-server))))) 3212 (concat sql-database "@" sql-server)))))
3039 (sql-connect product (append `(,db "-") options)))) 3213 (sql-comint product (append `(,db "-") options))))
3040 3214
3041 3215
3042 3216
@@ -3069,7 +3243,7 @@ The default comes from `process-coding-system-alist' and
3069 (interactive) 3243 (interactive)
3070 (sql-product-interactive 'sqlite)) 3244 (sql-product-interactive 'sqlite))
3071 3245
3072(defun sql-connect-sqlite (product options) 3246(defun sql-comint-sqlite (product options)
3073 "Create comint buffer and connect to SQLite." 3247 "Create comint buffer and connect to SQLite."
3074 ;; Put all parameters to the program (if defined) in a list and call 3248 ;; Put all parameters to the program (if defined) in a list and call
3075 ;; make-comint. 3249 ;; make-comint.
@@ -3077,7 +3251,7 @@ The default comes from `process-coding-system-alist' and
3077 (if (not (string= "" sql-database)) 3251 (if (not (string= "" sql-database))
3078 (setq params (append (list sql-database) params))) 3252 (setq params (append (list sql-database) params)))
3079 (setq params (append options params)) 3253 (setq params (append options params))
3080 (sql-connect product params))) 3254 (sql-comint product params)))
3081 3255
3082 3256
3083 3257
@@ -3110,7 +3284,7 @@ The default comes from `process-coding-system-alist' and
3110 (interactive) 3284 (interactive)
3111 (sql-product-interactive 'mysql)) 3285 (sql-product-interactive 'mysql))
3112 3286
3113(defun sql-connect-mysql (product options) 3287(defun sql-comint-mysql (product options)
3114 "Create comint buffer and connect to MySQL." 3288 "Create comint buffer and connect to MySQL."
3115 ;; Put all parameters to the program (if defined) in a list and call 3289 ;; Put all parameters to the program (if defined) in a list and call
3116 ;; make-comint. 3290 ;; make-comint.
@@ -3126,7 +3300,7 @@ The default comes from `process-coding-system-alist' and
3126 (if (not (string= "" sql-user)) 3300 (if (not (string= "" sql-user))
3127 (setq params (append (list (concat "--user=" sql-user)) params))) 3301 (setq params (append (list (concat "--user=" sql-user)) params)))
3128 (setq params (append options params)) 3302 (setq params (append options params))
3129 (sql-connect product params))) 3303 (sql-comint product params)))
3130 3304
3131 3305
3132 3306
@@ -3156,7 +3330,7 @@ The default comes from `process-coding-system-alist' and
3156 (interactive) 3330 (interactive)
3157 (sql-product-interactive 'solid)) 3331 (sql-product-interactive 'solid))
3158 3332
3159(defun sql-connect-solid (product options) 3333(defun sql-comint-solid (product options)
3160 "Create comint buffer and connect to Solid." 3334 "Create comint buffer and connect to Solid."
3161 ;; Put all parameters to the program (if defined) in a list and call 3335 ;; Put all parameters to the program (if defined) in a list and call
3162 ;; make-comint. 3336 ;; make-comint.
@@ -3167,7 +3341,7 @@ The default comes from `process-coding-system-alist' and
3167 (setq params (append (list sql-user sql-password) params))) 3341 (setq params (append (list sql-user sql-password) params)))
3168 (if (not (string= "" sql-server)) 3342 (if (not (string= "" sql-server))
3169 (setq params (append (list sql-server) params))) 3343 (setq params (append (list sql-server) params)))
3170 (sql-connect product params))) 3344 (sql-comint product params)))
3171 3345
3172 3346
3173 3347
@@ -3196,10 +3370,10 @@ The default comes from `process-coding-system-alist' and
3196 (interactive) 3370 (interactive)
3197 (sql-product-interactive 'ingres)) 3371 (sql-product-interactive 'ingres))
3198 3372
3199(defun sql-connect-ingres (product options) 3373(defun sql-comint-ingres (product options)
3200 "Create comint buffer and connect to Ingres." 3374 "Create comint buffer and connect to Ingres."
3201 ;; username and password are ignored. 3375 ;; username and password are ignored.
3202 (sql-connect product 3376 (sql-comint product
3203 (append (if (string= "" sql-database) 3377 (append (if (string= "" sql-database)
3204 nil 3378 nil
3205 (list sql-database)) 3379 (list sql-database))
@@ -3234,7 +3408,7 @@ The default comes from `process-coding-system-alist' and
3234 (interactive) 3408 (interactive)
3235 (sql-product-interactive 'ms)) 3409 (sql-product-interactive 'ms))
3236 3410
3237(defun sql-connect-ms (product options) 3411(defun sql-comint-ms (product options)
3238 "Create comint buffer and connect to Microsoft SQL Server." 3412 "Create comint buffer and connect to Microsoft SQL Server."
3239 ;; Put all parameters to the program (if defined) in a list and call 3413 ;; Put all parameters to the program (if defined) in a list and call
3240 ;; make-comint. 3414 ;; make-comint.
@@ -3254,7 +3428,7 @@ The default comes from `process-coding-system-alist' and
3254 ;; If -P is passed to ISQL as the last argument without a 3428 ;; If -P is passed to ISQL as the last argument without a
3255 ;; password, it's considered null. 3429 ;; password, it's considered null.
3256 (setq params (append params (list "-P"))))) 3430 (setq params (append params (list "-P")))))
3257 (sql-connect product params))) 3431 (sql-comint product params)))
3258 3432
3259 3433
3260 3434
@@ -3290,7 +3464,7 @@ Try to set `comint-output-filter-functions' like this:
3290 (interactive) 3464 (interactive)
3291 (sql-product-interactive 'postgres)) 3465 (sql-product-interactive 'postgres))
3292 3466
3293(defun sql-connect-postgres (product options) 3467(defun sql-comint-postgres (product options)
3294 "Create comint buffer and connect to Postgres." 3468 "Create comint buffer and connect to Postgres."
3295 ;; username and password are ignored. Mark Stosberg suggest to add 3469 ;; username and password are ignored. Mark Stosberg suggest to add
3296 ;; the database at the end. Jason Beegan suggest using --pset and 3470 ;; the database at the end. Jason Beegan suggest using --pset and
@@ -3304,7 +3478,7 @@ Try to set `comint-output-filter-functions' like this:
3304 (setq params (append (list "-h" sql-server) params))) 3478 (setq params (append (list "-h" sql-server) params)))
3305 (if (not (string= "" sql-user)) 3479 (if (not (string= "" sql-user))
3306 (setq params (append (list "-U" sql-user) params))) 3480 (setq params (append (list "-U" sql-user) params)))
3307 (sql-connect product params))) 3481 (sql-comint product params)))
3308 3482
3309 3483
3310 3484
@@ -3334,7 +3508,7 @@ The default comes from `process-coding-system-alist' and
3334 (interactive) 3508 (interactive)
3335 (sql-product-interactive 'interbase)) 3509 (sql-product-interactive 'interbase))
3336 3510
3337(defun sql-connect-interbase (product options) 3511(defun sql-comint-interbase (product options)
3338 "Create comint buffer and connect to Interbase." 3512 "Create comint buffer and connect to Interbase."
3339 ;; Put all parameters to the program (if defined) in a list and call 3513 ;; Put all parameters to the program (if defined) in a list and call
3340 ;; make-comint. 3514 ;; make-comint.
@@ -3345,7 +3519,7 @@ The default comes from `process-coding-system-alist' and
3345 (setq params (append (list "-p" sql-password) params))) 3519 (setq params (append (list "-p" sql-password) params)))
3346 (if (not (string= "" sql-database)) 3520 (if (not (string= "" sql-database))
3347 (setq params (cons sql-database params))) ; add to the front! 3521 (setq params (cons sql-database params))) ; add to the front!
3348 (sql-connect product params))) 3522 (sql-comint product params)))
3349 3523
3350 3524
3351 3525
@@ -3379,11 +3553,11 @@ The default comes from `process-coding-system-alist' and
3379 (interactive) 3553 (interactive)
3380 (sql-product-interactive 'db2)) 3554 (sql-product-interactive 'db2))
3381 3555
3382(defun sql-connect-db2 (product options) 3556(defun sql-comint-db2 (product options)
3383 "Create comint buffer and connect to DB2." 3557 "Create comint buffer and connect to DB2."
3384 ;; Put all parameters to the program (if defined) in a list and call 3558 ;; Put all parameters to the program (if defined) in a list and call
3385 ;; make-comint. 3559 ;; make-comint.
3386 (sql-connect product options) 3560 (sql-comint product options)
3387) 3561)
3388;; ;; Properly escape newlines when DB2 is interactive. 3562;; ;; Properly escape newlines when DB2 is interactive.
3389;; (setq comint-input-sender 'sql-escape-newlines-and-send)) 3563;; (setq comint-input-sender 'sql-escape-newlines-and-send))
@@ -3415,7 +3589,7 @@ input. See `sql-interactive-mode'.
3415 (interactive) 3589 (interactive)
3416 (sql-product-interactive 'linter)) 3590 (sql-product-interactive 'linter))
3417 3591
3418(defun sql-connect-linter (product options) 3592(defun sql-comint-linter (product options)
3419 "Create comint buffer and connect to Linter." 3593 "Create comint buffer and connect to Linter."
3420 ;; Put all parameters to the program (if defined) in a list and call 3594 ;; Put all parameters to the program (if defined) in a list and call
3421 ;; make-comint. 3595 ;; make-comint.
@@ -3430,7 +3604,7 @@ input. See `sql-interactive-mode'.
3430 (if (string= "" sql-database) 3604 (if (string= "" sql-database)
3431 (setenv "LINTER_MBX" nil) 3605 (setenv "LINTER_MBX" nil)
3432 (setenv "LINTER_MBX" sql-database)) 3606 (setenv "LINTER_MBX" sql-database))
3433 (sql-connect product params) 3607 (sql-comint product params)
3434 (setenv "LINTER_MBX" old-mbx))) 3608 (setenv "LINTER_MBX" old-mbx)))
3435 3609
3436 3610