aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mauger2010-09-10 23:17:02 -0400
committerMichael Mauger2010-09-10 23:17:02 -0400
commit9250002f81163aafc433425f5aed990839e3588a (patch)
tree74985b92731f55f237434e1f30ab8bfd41dc90c9
parentac1e75b396f8670af5b5e7e6ea8217207c96197d (diff)
downloademacs-9250002f81163aafc433425f5aed990839e3588a.tar.gz
emacs-9250002f81163aafc433425f5aed990839e3588a.zip
SQL Mode, Version 2.6
* progmodes/sql.el: Version 2.6 (sql-dialect): Synonym for "sql-product". (sql-find-sqli-buffer, sql-set-sqli-buffer-generally) (sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode): Set "sql-buffer" to buffer name not buffer object so multiple sql interactive buffers work properly. Reverts misguided changes in earlier work. (sql-comint): Make sure different buffer name is used if "*SQL*" buffer is for a different product. (sql-make-alternate-buffer-name): Fix bug with "sql-database" login param. (sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql) (sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase) (sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer): Accept new buffer name or prompt for one. (sql-port): Default to zero. (sql-comint-mysql): Handle "sql-port" as a numeric. (sql-port-history): Delete unused variable. (sql-get-login): Default "sql-port" to a number. (sql-product-alist): Correct Postgres prompt and terminator regexp. (sql-sqlite-program): Dynamically detect presence of "sqlite" or "sqlite3" executables. (sql-sqlite-login-params): Add "*.sqlite[23]?" database name pattern. (sql-buffer-live-p): New function. (sql-mode-menu, sql-send-string): Use it. (sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK syntax pattern. (sql-mode-postgres-font-lock-keywords): Support Postgres V9. (sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
-rw-r--r--etc/NEWS14
-rw-r--r--lisp/ChangeLog34
-rw-r--r--lisp/progmodes/sql.el563
3 files changed, 421 insertions, 190 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 4b454e39dbf..1d420172834 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -317,10 +317,24 @@ For example, adding "(diff-mode . ((mode . whitespace)))" to your
317variables `sql-product', `sql-user', `sql-server', `sql-database' and 317variables `sql-product', `sql-user', `sql-server', `sql-database' and
318`sql-port' can now be safely used as local variables. 318`sql-port' can now be safely used as local variables.
319 319
320*** `sql-dialect' is a synonym for `sql-product'.
321
320*** Added ability to login with a port on MySQL. 322*** Added ability to login with a port on MySQL.
321The custom variable `sql-port' can be specified for connection to 323The custom variable `sql-port' can be specified for connection to
322MySQL servers. 324MySQL servers.
323 325
326*** Dynamic selection of product in an SQL interactive session.
327If you use `sql-product-interactive' to start an SQL interactive
328session it uses the current value of `sql-product'. Preceding the
329invocation with C-u will force it to ask for the product before
330creating the session.
331
332*** Renaming a SQL interactive buffer when it is created.
333Prefixing the SQL interactive commands (`sql-sqlite', `sql-postgres',
334`sql-mysql', etc.) with C-u will force a new interactive session to be
335started and will prompt for the new name. This will reduce the need
336for `sql-rename-buffer' is most common use cases.
337
324*** Command continuation prompts in SQL interactive mode are suppressed. 338*** Command continuation prompts in SQL interactive mode are suppressed.
325Multiple line commands in SQL interactive mode, generate command 339Multiple line commands in SQL interactive mode, generate command
326continuation prompts which needlessly confuse the output. These 340continuation prompts which needlessly confuse the output. These
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b2a63275c44..c47a458f2f7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,37 @@
12010-09-11 Michael R. Mauger <mmaug@yahoo.com>
2
3 * progmodes/sql.el: Version 2.6
4 (sql-dialect): Synonym for "sql-product".
5 (sql-find-sqli-buffer, sql-set-sqli-buffer-generally)
6 (sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode):
7 Set "sql-buffer" to buffer name not buffer object so multiple sql
8 interactive buffers work properly. Reverts misguided changes in
9 earlier work.
10 (sql-comint): Make sure different buffer name is used if "*SQL*"
11 buffer is for a different product.
12 (sql-make-alternate-buffer-name): Fix bug with "sql-database"
13 login param.
14 (sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
15 (sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
16 (sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer):
17 Accept new buffer name or prompt for one.
18 (sql-port): Default to zero.
19 (sql-comint-mysql): Handle "sql-port" as a numeric.
20 (sql-port-history): Delete unused variable.
21 (sql-get-login): Default "sql-port" to a number.
22 (sql-product-alist): Correct Postgres prompt and terminator
23 regexp.
24 (sql-sqlite-program): Dynamically detect presence of "sqlite" or
25 "sqlite3" executables.
26 (sql-sqlite-login-params): Add "*.sqlite[23]?" database name
27 pattern.
28 (sql-buffer-live-p): New function.
29 (sql-mode-menu, sql-send-string): Use it.
30 (sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK
31 syntax pattern.
32 (sql-mode-postgres-font-lock-keywords): Support Postgres V9.
33 (sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands.
34
12010-09-10 Lars Magne Ingebrigtsen <larsi@gnus.org> 352010-09-10 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 36
3 * net/netrc.el (netrc-credentials): New conveniency function. 37 * net/netrc.el (netrc-credentials): New conveniency function.
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index e44504688f2..a80a555c13f 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.5 8;; Version: 2.6
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
@@ -187,10 +187,10 @@
187 187
188;; 6) Define a convienence function to invoke the SQL interpreter. 188;; 6) Define a convienence function to invoke the SQL interpreter.
189 189
190;; (defun my-sql-xyz () 190;; (defun my-sql-xyz (&optional buffer)
191;; "Run ixyz by XyzDB as an inferior process." 191;; "Run ixyz by XyzDB as an inferior process."
192;; (interactive) 192;; (interactive "P")
193;; (sql-product-interactive 'xyz)) 193;; (sql-product-interactive 'xyz buffer))
194 194
195;;; To Do: 195;;; To Do:
196 196
@@ -275,8 +275,8 @@ Customizing your password will store it in your ~/.emacs file."
275 :group 'SQL 275 :group 'SQL
276 :safe 'stringp) 276 :safe 'stringp)
277 277
278(defcustom sql-port nil 278(defcustom sql-port 0
279 "Default server or host." 279 "Default port."
280 :version "24.1" 280 :version "24.1"
281 :type 'number 281 :type 'number
282 :group 'SQL 282 :group 'SQL
@@ -430,9 +430,9 @@ Customizing your password will store it in your ~/.emacs file."
430 :sqli-comint-func sql-comint-postgres 430 :sqli-comint-func sql-comint-postgres
431 :prompt-regexp "^.*=[#>] " 431 :prompt-regexp "^.*=[#>] "
432 :prompt-length 5 432 :prompt-length 5
433 :prompt-cont-regexp "^.*-[#>] " 433 :prompt-cont-regexp "^.*[-(][#>] "
434 :input-filter sql-remove-tabs-filter 434 :input-filter sql-remove-tabs-filter
435 :terminator ("\\(^[\\]g\\|;\\)" . ";")) 435 :terminator ("\\(^\\s-*\\\\g\\|;\\)" . ";"))
436 436
437 (solid 437 (solid
438 :name "Solid" 438 :name "Solid"
@@ -551,7 +551,6 @@ settings.")
551(defvar sql-indirect-features 551(defvar sql-indirect-features
552 '(:font-lock :sqli-program :sqli-options :sqli-login)) 552 '(:font-lock :sqli-program :sqli-options :sqli-login))
553 553
554;;;###autoload
555(defcustom sql-connection-alist nil 554(defcustom sql-connection-alist nil
556 "An alist of connection parameters for interacting with a SQL 555 "An alist of connection parameters for interacting with a SQL
557 product. 556 product.
@@ -600,7 +599,6 @@ prompted for during login."
600 :version "24.1" 599 :version "24.1"
601 :group 'SQL) 600 :group 'SQL)
602 601
603;;;###autoload
604(defcustom sql-product 'ansi 602(defcustom sql-product 'ansi
605 "Select the SQL database product used so that buffers can be 603 "Select the SQL database product used so that buffers can be
606highlighted properly when you open them." 604highlighted properly when you open them."
@@ -613,6 +611,7 @@ highlighted properly when you open them."
613 sql-product-alist)) 611 sql-product-alist))
614 :group 'SQL 612 :group 'SQL
615 :safe 'symbolp) 613 :safe 'symbolp)
614(defvaralias 'sql-dialect 'sql-product)
616 615
617;; misc customization of sql.el behaviour 616;; misc customization of sql.el behaviour
618 617
@@ -788,7 +787,9 @@ to be safe:
788 787
789;; Customization for SQLite 788;; Customization for SQLite
790 789
791(defcustom sql-sqlite-program "sqlite3" 790(defcustom sql-sqlite-program (or (executable-find "sqlite3")
791 (executable-find "sqlite")
792 "sqlite")
792 "Command to start SQLite. 793 "Command to start SQLite.
793 794
794Starts `sql-interactive-mode' after doing some setup." 795Starts `sql-interactive-mode' after doing some setup."
@@ -801,7 +802,7 @@ Starts `sql-interactive-mode' after doing some setup."
801 :version "20.8" 802 :version "20.8"
802 :group 'SQL) 803 :group 'SQL)
803 804
804(defcustom sql-sqlite-login-params '((database :file ".*\\.db")) 805(defcustom sql-sqlite-login-params '((database :file ".*\\.\\(db\\|sqlite[23]?\\)"))
805 "List of login parameters needed to connect to SQLite." 806 "List of login parameters needed to connect to SQLite."
806 :type 'sql-login-params 807 :type 'sql-login-params
807 :version "24.1" 808 :version "24.1"
@@ -1022,9 +1023,6 @@ Starts `sql-interactive-mode' after doing some setup."
1022(defvar sql-server-history nil 1023(defvar sql-server-history nil
1023 "History of servers used.") 1024 "History of servers used.")
1024 1025
1025(defvar sql-port-history nil
1026 "History of ports used.")
1027
1028;; Passwords are not kept in a history. 1026;; Passwords are not kept in a history.
1029 1027
1030(defvar sql-buffer nil 1028(defvar sql-buffer nil
@@ -1054,6 +1052,12 @@ You can change `sql-prompt-length' on `sql-interactive-mode-hook'.")
1054 1052
1055Used by `sql-rename-buffer'.") 1053Used by `sql-rename-buffer'.")
1056 1054
1055(defun sql-buffer-live-p (buffer)
1056 "Returns non-nil if the process associated with buffer is live."
1057 (and buffer
1058 (buffer-live-p (get-buffer buffer))
1059 (get-buffer-process buffer)))
1060
1057;; Keymap for sql-interactive-mode. 1061;; Keymap for sql-interactive-mode.
1058 1062
1059(defvar sql-interactive-mode-map 1063(defvar sql-interactive-mode-map
@@ -1091,15 +1095,11 @@ Based on `comint-mode-map'.")
1091 sql-mode-menu sql-mode-map 1095 sql-mode-menu sql-mode-map
1092 "Menu for `sql-mode'." 1096 "Menu for `sql-mode'."
1093 `("SQL" 1097 `("SQL"
1094 ["Send Paragraph" sql-send-paragraph (and (buffer-live-p sql-buffer) 1098 ["Send Paragraph" sql-send-paragraph (sql-buffer-live-p sql-buffer)]
1095 (get-buffer-process sql-buffer))]
1096 ["Send Region" sql-send-region (and mark-active 1099 ["Send Region" sql-send-region (and mark-active
1097 (buffer-live-p sql-buffer) 1100 (sql-buffer-live-p sql-buffer))]
1098 (get-buffer-process sql-buffer))] 1101 ["Send Buffer" sql-send-buffer (sql-buffer-live-p sql-buffer)]
1099 ["Send Buffer" sql-send-buffer (and (buffer-live-p sql-buffer) 1102 ["Send String" sql-send-string (sql-buffer-live-p sql-buffer)]
1100 (get-buffer-process sql-buffer))]
1101 ["Send String" sql-send-string (and (buffer-live-p sql-buffer)
1102 (get-buffer-process sql-buffer))]
1103 "--" 1103 "--"
1104 ["Start SQLi session" sql-product-interactive 1104 ["Start SQLi session" sql-product-interactive
1105 :visible (not sql-connection-alist) 1105 :visible (not sql-connection-alist)
@@ -1364,7 +1364,7 @@ to add functions and PL/SQL keywords.")
1364 ;; Oracle SQL*Plus Commands 1364 ;; Oracle SQL*Plus Commands
1365 (cons 1365 (cons
1366 (concat 1366 (concat
1367 "^\\(?:\\(?:" (regexp-opt '( 1367 "^\\s-*\\(?:\\(?:" (regexp-opt '(
1368"@" "@@" "accept" "append" "archive" "attribute" "break" 1368"@" "@@" "accept" "append" "archive" "attribute" "break"
1369"btitle" "change" "clear" "column" "connect" "copy" "define" 1369"btitle" "change" "clear" "column" "connect" "copy" "define"
1370"del" "describe" "disconnect" "edit" "execute" "exit" "get" "help" 1370"del" "describe" "disconnect" "edit" "execute" "exit" "get" "help"
@@ -1403,7 +1403,7 @@ to add functions and PL/SQL keywords.")
1403 "\\)\\b.*" 1403 "\\)\\b.*"
1404 ) 1404 )
1405 'font-lock-doc-face) 1405 'font-lock-doc-face)
1406 '("^[ \t]*rem\\(?:ark\\)?.*" . font-lock-comment-face) 1406 '("^\\s-*rem\\(?:ark\\)?\\>.*" . font-lock-comment-face)
1407 1407
1408 ;; Oracle Functions 1408 ;; Oracle Functions
1409 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil 1409 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
@@ -1585,81 +1585,153 @@ to add functions and PL/SQL keywords.")
1585(defvar sql-mode-postgres-font-lock-keywords 1585(defvar sql-mode-postgres-font-lock-keywords
1586 (eval-when-compile 1586 (eval-when-compile
1587 (list 1587 (list
1588 ;; Postgres Functions 1588 ;; Postgres psql commands
1589 '("^\\s-*\\\\.*$" . font-lock-doc-face)
1590
1591 ;; Postgres unreserved words but may have meaning
1592 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil "a"
1593"abs" "absent" "according" "ada" "alias" "allocate" "are" "array_agg"
1594"asensitive" "atomic" "attribute" "attributes" "avg" "base64"
1595"bernoulli" "bit_length" "bitvar" "blob" "blocked" "bom" "breadth" "c"
1596"call" "cardinality" "catalog_name" "ceil" "ceiling" "char_length"
1597"character_length" "character_set_catalog" "character_set_name"
1598"character_set_schema" "characters" "checked" "class_origin" "clob"
1599"cobol" "collation" "collation_catalog" "collation_name"
1600"collation_schema" "collect" "column_name" "columns"
1601"command_function" "command_function_code" "completion" "condition"
1602"condition_number" "connect" "connection_name" "constraint_catalog"
1603"constraint_name" "constraint_schema" "constructor" "contains"
1604"control" "convert" "corr" "corresponding" "count" "covar_pop"
1605"covar_samp" "cube" "cume_dist" "current_default_transform_group"
1606"current_path" "current_transform_group_for_type" "cursor_name"
1607"datalink" "datetime_interval_code" "datetime_interval_precision" "db"
1608"defined" "degree" "dense_rank" "depth" "deref" "derived" "describe"
1609"descriptor" "destroy" "destructor" "deterministic" "diagnostics"
1610"disconnect" "dispatch" "dlnewcopy" "dlpreviouscopy" "dlurlcomplete"
1611"dlurlcompleteonly" "dlurlcompletewrite" "dlurlpath" "dlurlpathonly"
1612"dlurlpathwrite" "dlurlscheme" "dlurlserver" "dlvalue" "dynamic"
1613"dynamic_function" "dynamic_function_code" "element" "empty"
1614"end-exec" "equals" "every" "exception" "exec" "existing" "exp" "file"
1615"filter" "final" "first_value" "flag" "floor" "fortran" "found" "free"
1616"fs" "fusion" "g" "general" "generated" "get" "go" "goto" "grouping"
1617"hex" "hierarchy" "host" "id" "ignore" "implementation" "import"
1618"indent" "indicator" "infix" "initialize" "instance" "instantiable"
1619"integrity" "intersection" "iterate" "k" "key_member" "key_type" "lag"
1620"last_value" "lateral" "lead" "length" "less" "library" "like_regex"
1621"link" "ln" "locator" "lower" "m" "map" "matched" "max"
1622"max_cardinality" "member" "merge" "message_length"
1623"message_octet_length" "message_text" "method" "min" "mod" "modifies"
1624"modify" "module" "more" "multiset" "mumps" "namespace" "nclob"
1625"nesting" "new" "nfc" "nfd" "nfkc" "nfkd" "nil" "normalize"
1626"normalized" "nth_value" "ntile" "nullable" "number"
1627"occurrences_regex" "octet_length" "octets" "old" "open" "operation"
1628"ordering" "ordinality" "others" "output" "overriding" "p" "pad"
1629"parameter" "parameter_mode" "parameter_name"
1630"parameter_ordinal_position" "parameter_specific_catalog"
1631"parameter_specific_name" "parameter_specific_schema" "parameters"
1632"pascal" "passing" "passthrough" "percent_rank" "percentile_cont"
1633"percentile_disc" "permission" "pli" "position_regex" "postfix"
1634"power" "prefix" "preorder" "public" "rank" "reads" "recovery" "ref"
1635"referencing" "regr_avgx" "regr_avgy" "regr_count" "regr_intercept"
1636"regr_r2" "regr_slope" "regr_sxx" "regr_sxy" "regr_syy" "requiring"
1637"respect" "restore" "result" "return" "returned_cardinality"
1638"returned_length" "returned_octet_length" "returned_sqlstate" "rollup"
1639"routine" "routine_catalog" "routine_name" "routine_schema"
1640"row_count" "row_number" "scale" "schema_name" "scope" "scope_catalog"
1641"scope_name" "scope_schema" "section" "selective" "self" "sensitive"
1642"server_name" "sets" "size" "source" "space" "specific"
1643"specific_name" "specifictype" "sql" "sqlcode" "sqlerror"
1644"sqlexception" "sqlstate" "sqlwarning" "sqrt" "state" "static"
1645"stddev_pop" "stddev_samp" "structure" "style" "subclass_origin"
1646"sublist" "submultiset" "substring_regex" "sum" "system_user" "t"
1647"table_name" "tablesample" "terminate" "than" "ties" "timezone_hour"
1648"timezone_minute" "token" "top_level_count" "transaction_active"
1649"transactions_committed" "transactions_rolled_back" "transform"
1650"transforms" "translate" "translate_regex" "translation"
1651"trigger_catalog" "trigger_name" "trigger_schema" "trim_array"
1652"uescape" "under" "unlink" "unnamed" "unnest" "untyped" "upper" "uri"
1653"usage" "user_defined_type_catalog" "user_defined_type_code"
1654"user_defined_type_name" "user_defined_type_schema" "var_pop"
1655"var_samp" "varbinary" "variable" "whenever" "width_bucket" "within"
1656"xmlagg" "xmlbinary" "xmlcast" "xmlcomment" "xmldeclaration"
1657"xmldocument" "xmlexists" "xmliterate" "xmlnamespaces" "xmlquery"
1658"xmlschema" "xmltable" "xmltext" "xmlvalidate"
1659)
1660
1661 ;; Postgres non-reserved words
1589 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil 1662 (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
1590"abbrev" "abs" "acos" "age" "area" "ascii" "asin" "atab2" "atan" 1663"abort" "absolute" "access" "action" "add" "admin" "after" "aggregate"
1591"atan2" "avg" "bit_length" "both" "broadcast" "btrim" "cbrt" "ceil" 1664"also" "alter" "always" "assertion" "assignment" "at" "backward"
1592"center" "char_length" "chr" "coalesce" "col_description" "convert" 1665"before" "begin" "between" "by" "cache" "called" "cascade" "cascaded"
1593"cos" "cot" "count" "current_database" "current_date" "current_schema" 1666"catalog" "chain" "characteristics" "checkpoint" "class" "close"
1594"current_schemas" "current_setting" "current_time" "current_timestamp" 1667"cluster" "coalesce" "comment" "comments" "commit" "committed"
1595"current_user" "currval" "date_part" "date_trunc" "decode" "degrees" 1668"configuration" "connection" "constraints" "content" "continue"
1596"diameter" "encode" "exp" "extract" "floor" "get_bit" "get_byte" 1669"conversion" "copy" "cost" "createdb" "createrole" "createuser" "csv"
1597"has_database_privilege" "has_function_privilege" 1670"current" "cursor" "cycle" "data" "database" "day" "deallocate" "dec"
1598"has_language_privilege" "has_schema_privilege" "has_table_privilege" 1671"declare" "defaults" "deferred" "definer" "delete" "delimiter"
1599"height" "host" "initcap" "isclosed" "isfinite" "isopen" "leading" 1672"delimiters" "dictionary" "disable" "discard" "document" "domain"
1600"length" "ln" "localtime" "localtimestamp" "log" "lower" "lpad" 1673"drop" "each" "enable" "encoding" "encrypted" "enum" "escape"
1601"ltrim" "masklen" "max" "min" "mod" "netmask" "network" "nextval" 1674"exclude" "excluding" "exclusive" "execute" "exists" "explain"
1602"now" "npoints" "nullif" "obj_description" "octet_length" "overlay" 1675"external" "extract" "family" "first" "float" "following" "force"
1603"pclose" "pg_client_encoding" "pg_function_is_visible" 1676"forward" "function" "functions" "global" "granted" "greatest"
1604"pg_get_constraintdef" "pg_get_indexdef" "pg_get_ruledef" 1677"handler" "header" "hold" "hour" "identity" "if" "immediate"
1605"pg_get_userbyid" "pg_get_viewdef" "pg_opclass_is_visible" 1678"immutable" "implicit" "including" "increment" "index" "indexes"
1606"pg_operator_is_visible" "pg_table_is_visible" "pg_type_is_visible" 1679"inherit" "inherits" "inline" "inout" "input" "insensitive" "insert"
1607"pi" "popen" "position" "pow" "quote_ident" "quote_literal" "radians" 1680"instead" "invoker" "isolation" "key" "language" "large" "last"
1608"radius" "random" "repeat" "replace" "round" "rpad" "rtrim" 1681"lc_collate" "lc_ctype" "least" "level" "listen" "load" "local"
1609"session_user" "set_bit" "set_byte" "set_config" "set_masklen" 1682"location" "lock" "login" "mapping" "match" "maxvalue" "minute"
1610"setval" "sign" "sin" "split_part" "sqrt" "stddev" "strpos" "substr" 1683"minvalue" "mode" "month" "move" "name" "names" "national" "nchar"
1611"substring" "sum" "tan" "timeofday" "to_ascii" "to_char" "to_date" 1684"next" "no" "nocreatedb" "nocreaterole" "nocreateuser" "noinherit"
1612"to_hex" "to_number" "to_timestamp" "trailing" "translate" "trim" 1685"nologin" "none" "nosuperuser" "nothing" "notify" "nowait" "nullif"
1613"trunc" "upper" "variance" "version" "width" 1686"nulls" "object" "of" "oids" "operator" "option" "options" "out"
1687"overlay" "owned" "owner" "parser" "partial" "partition" "password"
1688"plans" "position" "preceding" "prepare" "prepared" "preserve" "prior"
1689"privileges" "procedural" "procedure" "quote" "range" "read"
1690"reassign" "recheck" "recursive" "reindex" "relative" "release"
1691"rename" "repeatable" "replace" "replica" "reset" "restart" "restrict"
1692"returns" "revoke" "role" "rollback" "row" "rows" "rule" "savepoint"
1693"schema" "scroll" "search" "second" "security" "sequence" "sequences"
1694"serializable" "server" "session" "set" "setof" "share" "show"
1695"simple" "stable" "standalone" "start" "statement" "statistics"
1696"stdin" "stdout" "storage" "strict" "strip" "substring" "superuser"
1697"sysid" "system" "tables" "tablespace" "temp" "template" "temporary"
1698"transaction" "treat" "trigger" "trim" "truncate" "trusted" "type"
1699"unbounded" "uncommitted" "unencrypted" "unknown" "unlisten" "until"
1700"update" "vacuum" "valid" "validator" "value" "values" "version"
1701"view" "volatile" "whitespace" "work" "wrapper" "write"
1702"xmlattributes" "xmlconcat" "xmlelement" "xmlforest" "xmlparse"
1703"xmlpi" "xmlroot" "xmlserialize" "year" "yes"
1614) 1704)
1705
1615 ;; Postgres Reserved 1706 ;; Postgres Reserved
1616 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil 1707 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
1617"abort" "access" "add" "after" "aggregate" "alignment" "all" "alter" 1708"all" "analyse" "analyze" "and" "any" "array" "asc" "as" "asymmetric"
1618"analyze" "and" "any" "as" "asc" "assignment" "authorization" 1709"authorization" "binary" "both" "case" "cast" "check" "collate"
1619"backward" "basetype" "before" "begin" "between" "binary" "by" "cache" 1710"column" "concurrently" "constraint" "create" "cross"
1620"called" "cascade" "case" "cast" "characteristics" "check" 1711"current_catalog" "current_date" "current_role" "current_schema"
1621"checkpoint" "class" "close" "cluster" "column" "comment" "commit" 1712"current_time" "current_timestamp" "current_user" "default"
1622"committed" "commutator" "constraint" "constraints" "conversion" 1713"deferrable" "desc" "distinct" "do" "else" "end" "except" "false"
1623"copy" "create" "createdb" "createuser" "cursor" "cycle" "database" 1714"fetch" "foreign" "for" "freeze" "from" "full" "grant" "group"
1624"deallocate" "declare" "default" "deferrable" "deferred" "definer" 1715"having" "ilike" "initially" "inner" "in" "intersect" "into" "isnull"
1625"delete" "delimiter" "desc" "distinct" "do" "domain" "drop" "each" 1716"is" "join" "leading" "left" "like" "limit" "localtime"
1626"element" "else" "encoding" "encrypted" "end" "escape" "except" 1717"localtimestamp" "natural" "notnull" "not" "null" "off" "offset"
1627"exclusive" "execute" "exists" "explain" "extended" "external" "false" 1718"only" "on" "order" "or" "outer" "overlaps" "over" "placing" "primary"
1628"fetch" "finalfunc" "for" "force" "foreign" "forward" "freeze" "from" 1719"references" "returning" "right" "select" "session_user" "similar"
1629"full" "function" "grant" "group" "gtcmp" "handler" "hashes" "having" 1720"some" "symmetric" "table" "then" "to" "trailing" "true" "union"
1630"immediate" "immutable" "implicit" "in" "increment" "index" "inherits" 1721"unique" "user" "using" "variadic" "verbose" "when" "where" "window"
1631"initcond" "initially" "input" "insensitive" "insert" "instead" 1722"with"
1632"internallength" "intersect" "into" "invoker" "is" "isnull"
1633"isolation" "join" "key" "language" "leftarg" "level" "like" "limit"
1634"listen" "load" "local" "location" "lock" "ltcmp" "main" "match"
1635"maxvalue" "merges" "minvalue" "mode" "move" "natural" "negator"
1636"next" "nocreatedb" "nocreateuser" "none" "not" "nothing" "notify"
1637"notnull" "null" "of" "offset" "oids" "on" "only" "operator" "or"
1638"order" "output" "owner" "partial" "passedbyvalue" "password" "plain"
1639"prepare" "primary" "prior" "privileges" "procedural" "procedure"
1640"public" "read" "recheck" "references" "reindex" "relative" "rename"
1641"reset" "restrict" "returns" "revoke" "rightarg" "rollback" "row"
1642"rule" "schema" "scroll" "security" "select" "sequence" "serializable"
1643"session" "set" "sfunc" "share" "show" "similar" "some" "sort1"
1644"sort2" "stable" "start" "statement" "statistics" "storage" "strict"
1645"stype" "sysid" "table" "temp" "template" "temporary" "then" "to"
1646"transaction" "trigger" "true" "truncate" "trusted" "type"
1647"unencrypted" "union" "unique" "unknown" "unlisten" "until" "update"
1648"usage" "user" "using" "vacuum" "valid" "validator" "values"
1649"variable" "verbose" "view" "volatile" "when" "where" "with" "without"
1650"work"
1651) 1723)
1652 1724
1653 ;; Postgres Data Types 1725 ;; Postgres Data Types
1654 (sql-font-lock-keywords-builder 'font-lock-type-face nil 1726 (sql-font-lock-keywords-builder 'font-lock-type-face nil
1655"anyarray" "bigint" "bigserial" "bit" "boolean" "box" "bytea" "char" 1727"bigint" "bigserial" "bit" "bool" "boolean" "box" "bytea" "char"
1656"character" "cidr" "circle" "cstring" "date" "decimal" "double" 1728"character" "cidr" "circle" "date" "decimal" "double" "float4"
1657"float4" "float8" "inet" "int2" "int4" "int8" "integer" "internal" 1729"float8" "inet" "int" "int2" "int4" "int8" "integer" "interval" "line"
1658"interval" "language_handler" "line" "lseg" "macaddr" "money" 1730"lseg" "macaddr" "money" "numeric" "path" "point" "polygon"
1659"numeric" "oid" "opaque" "path" "point" "polygon" "precision" "real" 1731"precision" "real" "serial" "serial4" "serial8" "smallint" "text"
1660"record" "regclass" "regoper" "regoperator" "regproc" "regprocedure" 1732"time" "timestamp" "timestamptz" "timetz" "tsquery" "tsvector"
1661"regtype" "serial" "serial4" "serial8" "smallint" "text" "time" 1733"txid_snapshot" "uuid" "varbit" "varchar" "varying" "without"
1662"timestamp" "varchar" "varying" "void" "zone" 1734"xml" "zone"
1663))) 1735)))
1664 1736
1665 "Postgres SQL keywords used by font-lock. 1737 "Postgres SQL keywords used by font-lock.
@@ -1979,6 +2051,9 @@ you define your own `sql-mode-mysql-font-lock-keywords'.")
1979(defvar sql-mode-sqlite-font-lock-keywords 2051(defvar sql-mode-sqlite-font-lock-keywords
1980 (eval-when-compile 2052 (eval-when-compile
1981 (list 2053 (list
2054 ;; SQLite commands
2055 '("^[.].*$" . font-lock-doc-face)
2056
1982 ;; SQLite Keyword 2057 ;; SQLite Keyword
1983 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil 2058 (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
1984"abort" "action" "add" "after" "all" "alter" "analyze" "and" "as" 2059"abort" "action" "add" "after" "all" "alter" "analyze" "and" "as"
@@ -2493,16 +2568,18 @@ function like this: (sql-get-login 'user 'password 'database)."
2493 2568
2494 ((eq token 'port) ; port 2569 ((eq token 'port) ; port
2495 (setq sql-port 2570 (setq sql-port
2496 (read-number "Port: " sql-port)))))) 2571 (read-number "Port: " (if (numberp sql-port)
2497 what)) 2572 sql-port
2573 0)))))))
2574 what))
2498 2575
2499(defun sql-find-sqli-buffer () 2576(defun sql-find-sqli-buffer ()
2500 "Returns the current default SQLi buffer or nil. 2577 "Returns the name of the current default SQLi buffer or nil.
2501In order to qualify, the SQLi buffer must be alive, 2578In order to qualify, the SQLi buffer must be alive, be in
2502be in `sql-interactive-mode' and have a process." 2579`sql-interactive-mode' and have a process."
2503 (let ((default-buffer (default-value 'sql-buffer))) 2580 (let ((default-buffer (default-value 'sql-buffer))
2504 (if (and (buffer-live-p default-buffer) 2581 (current-product sql-product))
2505 (get-buffer-process default-buffer)) 2582 (if (sql-buffer-live-p default-buffer)
2506 default-buffer 2583 default-buffer
2507 (save-current-buffer 2584 (save-current-buffer
2508 (let ((buflist (buffer-list)) 2585 (let ((buflist (buffer-list))
@@ -2511,9 +2588,10 @@ be in `sql-interactive-mode' and have a process."
2511 found)) 2588 found))
2512 (let ((candidate (car buflist))) 2589 (let ((candidate (car buflist)))
2513 (set-buffer candidate) 2590 (set-buffer candidate)
2514 (if (and (derived-mode-p 'sql-interactive-mode) 2591 (if (and (sql-buffer-live-p candidate)
2515 (get-buffer-process candidate)) 2592 (derived-mode-p 'sql-interactive-mode)
2516 (setq found candidate)) 2593 (eq sql-product current-product))
2594 (setq found (buffer-name candidate)))
2517 (setq buflist (cdr buflist)))) 2595 (setq buflist (cdr buflist))))
2518 found))))) 2596 found)))))
2519 2597
@@ -2527,15 +2605,15 @@ using `sql-find-sqli-buffer'. If `sql-buffer' is set,
2527 (interactive) 2605 (interactive)
2528 (save-excursion 2606 (save-excursion
2529 (let ((buflist (buffer-list)) 2607 (let ((buflist (buffer-list))
2530 (default-sqli-buffer (sql-find-sqli-buffer))) 2608 (default-buffer (sql-find-sqli-buffer)))
2531 (setq-default sql-buffer default-sqli-buffer) 2609 (setq-default sql-buffer default-buffer)
2532 (while (not (null buflist)) 2610 (while (not (null buflist))
2533 (let ((candidate (car buflist))) 2611 (let ((candidate (car buflist)))
2534 (set-buffer candidate) 2612 (set-buffer candidate)
2535 (if (and (derived-mode-p 'sql-mode) 2613 (if (and (derived-mode-p 'sql-mode)
2536 (not (buffer-live-p sql-buffer))) 2614 (not (buffer-live-p sql-buffer)))
2537 (progn 2615 (progn
2538 (setq sql-buffer default-sqli-buffer) 2616 (setq sql-buffer default-buffer)
2539 (run-hooks 'sql-set-sqli-hook)))) 2617 (run-hooks 'sql-set-sqli-hook))))
2540 (setq buflist (cdr buflist)))))) 2618 (setq buflist (cdr buflist))))))
2541 2619
@@ -2561,11 +2639,11 @@ If you call it from anywhere else, it sets the global copy of
2561 (if (null (get-buffer-process new-buffer)) 2639 (if (null (get-buffer-process new-buffer))
2562 (error "Buffer %s has no process" (buffer-name new-buffer))) 2640 (error "Buffer %s has no process" (buffer-name new-buffer)))
2563 (if (null (with-current-buffer new-buffer 2641 (if (null (with-current-buffer new-buffer
2564 (equal major-mode 'sql-interactive-mode))) 2642 (derived-mode-p 'sql-interactive-mode)))
2565 (error "Buffer %s is no SQLi buffer" (buffer-name new-buffer))) 2643 (error "Buffer %s is no SQLi buffer" (buffer-name new-buffer)))
2566 (if new-buffer 2644 (if new-buffer
2567 (progn 2645 (progn
2568 (setq sql-buffer new-buffer) 2646 (setq sql-buffer (buffer-name new-buffer))
2569 (run-hooks 'sql-set-sqli-hook)))))) 2647 (run-hooks 'sql-set-sqli-hook))))))
2570 2648
2571(defun sql-show-sqli-buffer () 2649(defun sql-show-sqli-buffer ()
@@ -2574,11 +2652,11 @@ If you call it from anywhere else, it sets the global copy of
2574This is the buffer SQL strings are sent to. It is stored in the 2652This is the buffer SQL strings are sent to. It is stored in the
2575variable `sql-buffer'. See `sql-help' on how to create such a buffer." 2653variable `sql-buffer'. See `sql-help' on how to create such a buffer."
2576 (interactive) 2654 (interactive)
2577 (if (null (buffer-live-p sql-buffer)) 2655 (if (null (buffer-live-p (get-buffer sql-buffer)))
2578 (message "%s has no SQLi buffer set." (buffer-name (current-buffer))) 2656 (message "%s has no SQLi buffer set." (buffer-name (current-buffer)))
2579 (if (null (get-buffer-process sql-buffer)) 2657 (if (null (get-buffer-process sql-buffer))
2580 (message "Buffer %s has no process." (buffer-name sql-buffer)) 2658 (message "Buffer %s has no process." sql-buffer)
2581 (message "Current SQLi buffer is %s." (buffer-name sql-buffer))))) 2659 (message "Current SQLi buffer is %s." sql-buffer))))
2582 2660
2583(defun sql-make-alternate-buffer-name () 2661(defun sql-make-alternate-buffer-name ()
2584 "Return a string that can be used to rename a SQLi buffer. 2662 "Return a string that can be used to rename a SQLi buffer.
@@ -2610,8 +2688,9 @@ server/database name."
2610 (unless (string= "" sql-user) 2688 (unless (string= "" sql-user)
2611 (list "/" sql-user))) 2689 (list "/" sql-user)))
2612 ((eq token 'port) 2690 ((eq token 'port)
2613 (unless (= 0 sql-port) 2691 (unless (or (not (numberp sql-port))
2614 (list ":" sql-port))) 2692 (= 0 sql-port))
2693 (list ":" (number-to-string sql-port))))
2615 ((eq token 'server) 2694 ((eq token 'server)
2616 (unless (string= "" sql-server) 2695 (unless (string= "" sql-server)
2617 (list "." 2696 (list "."
@@ -2619,7 +2698,7 @@ server/database name."
2619 (file-name-nondirectory sql-server) 2698 (file-name-nondirectory sql-server)
2620 sql-server)))) 2699 sql-server))))
2621 ((eq token 'database) 2700 ((eq token 'database)
2622 (when (string= "" sql-database) 2701 (unless (string= "" sql-database)
2623 (list "@" 2702 (list "@"
2624 (if (eq type :file) 2703 (if (eq type :file)
2625 (file-name-nondirectory sql-database) 2704 (file-name-nondirectory sql-database)
@@ -2649,10 +2728,32 @@ server/database name."
2649 ;; Use the name we've got 2728 ;; Use the name we've got
2650 name)))) 2729 name))))
2651 2730
2652(defun sql-rename-buffer () 2731(defun sql-rename-buffer (&optional new-name)
2653 "Rename a SQLi buffer." 2732 "Rename a SQL interactive buffer.
2654 (interactive) 2733
2655 (rename-buffer (format "*SQL: %s*" sql-alternate-buffer-name) t)) 2734Prompts for the new name if command is preceeded by
2735\\[universal-argument]. If no buffer name is provided, then the
2736`sql-alternate-buffer-name' is used.
2737
2738The actual buffer name set will be \"*SQL: NEW-NAME*\". If
2739NEW-NAME is empty, then the buffer name will be \"*SQL*\"."
2740 (interactive "P")
2741
2742 (if (not (derived-mode-p 'sql-interactive-mode))
2743 (message "Current buffer is not a SQL interactive buffer")
2744
2745 (cond
2746 ((stringp new-name)
2747 (setq sql-alternate-buffer-name new-name))
2748 ((listp new-name)
2749 (setq sql-alternate-buffer-name
2750 (read-string "Buffer name (\"*SQL: XXX*\"; enter `XXX'): "
2751 sql-alternate-buffer-name))))
2752
2753 (rename-buffer (if (string= "" sql-alternate-buffer-name)
2754 "*SQL*"
2755 (format "*SQL: %s*" sql-alternate-buffer-name))
2756 t)))
2656 2757
2657(defun sql-copy-column () 2758(defun sql-copy-column ()
2658 "Copy current column to the end of buffer. 2759 "Copy current column to the end of buffer.
@@ -2801,7 +2902,7 @@ to force the output from the query to appear on a new line."
2801 2902
2802 (let ((comint-input-sender-no-newline nil) 2903 (let ((comint-input-sender-no-newline nil)
2803 (s (replace-regexp-in-string "[[:space:]\n\r]+\\'" "" str))) 2904 (s (replace-regexp-in-string "[[:space:]\n\r]+\\'" "" str)))
2804 (if (buffer-live-p sql-buffer) 2905 (if (sql-buffer-live-p sql-buffer)
2805 (progn 2906 (progn
2806 ;; Ignore the hoping around... 2907 ;; Ignore the hoping around...
2807 (save-excursion 2908 (save-excursion
@@ -2814,7 +2915,7 @@ to force the output from the query to appear on a new line."
2814 (if sql-send-terminator 2915 (if sql-send-terminator
2815 (sql-send-magic-terminator sql-buffer s sql-send-terminator)) 2916 (sql-send-magic-terminator sql-buffer s sql-send-terminator))
2816 2917
2817 (message "Sent string to buffer %s." (buffer-name sql-buffer)))) 2918 (message "Sent string to buffer %s." sql-buffer)))
2818 2919
2819 ;; Display the sql buffer 2920 ;; Display the sql buffer
2820 (if sql-pop-to-buffer-after-send-region 2921 (if sql-pop-to-buffer-after-send-region
@@ -3063,7 +3164,7 @@ you entered, right above the output it created.
3063 (setq local-abbrev-table sql-mode-abbrev-table) 3164 (setq local-abbrev-table sql-mode-abbrev-table)
3064 (setq abbrev-all-caps 1) 3165 (setq abbrev-all-caps 1)
3065 ;; Exiting the process will call sql-stop. 3166 ;; Exiting the process will call sql-stop.
3066 (set-process-sentinel (get-buffer-process sql-buffer) 'sql-stop) 3167 (set-process-sentinel (get-buffer-process (current-buffer)) 'sql-stop)
3067 ;; Save the connection name 3168 ;; Save the connection name
3068 (make-local-variable 'sql-connection) 3169 (make-local-variable 'sql-connection)
3069 ;; Create a usefull name for renaming this buffer later. 3170 ;; Create a usefull name for renaming this buffer later.
@@ -3248,49 +3349,60 @@ optionally is saved to the user's init file."
3248;;; Entry functions for different SQL interpreters. 3349;;; Entry functions for different SQL interpreters.
3249 3350
3250;;;###autoload 3351;;;###autoload
3251(defun sql-product-interactive (&optional product) 3352(defun sql-product-interactive (&optional product new-name)
3252 "Run PRODUCT interpreter as an inferior process. 3353 "Run PRODUCT interpreter as an inferior process.
3253 3354
3254If buffer `*SQL*' exists but no process is running, make a new process. 3355If buffer `*SQL*' exists but no process is running, make a new process.
3255If buffer exists and a process is running, just switch to buffer `*SQL*'. 3356If buffer exists and a process is running, just switch to buffer `*SQL*'.
3256 3357
3358To specify the SQL product, prefix the call with
3359\\[universal-argument]. To set the buffer name as well, prefix
3360the call to \\[sql-product-interactive] with
3361\\[universal-argument] \\[universal-argument].
3362
3257\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3363\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3258 (interactive "P") 3364 (interactive "P")
3259 3365
3366 ;; Handle universal arguments if specified
3367 (when (not (or executing-kbd-macro noninteractive))
3368 (when (and (listp product)
3369 (not (cdr product))
3370 (numberp (car product)))
3371 (when (>= (car product) 16)
3372 (when (not new-name)
3373 (setq new-name '(4)))
3374 (setq product '(4)))))
3375
3376 ;; Get the value of product that we need
3260 (setq product 3377 (setq product
3261 (cond 3378 (cond
3262 ((equal product '(4)) ; Universal arg, prompt for product 3379 ((equal product '(4)) ; C-u, prompt for product
3263 (intern (completing-read "SQL product: " 3380 (intern (completing-read "SQL product: "
3264 (mapcar (lambda (info) (symbol-name (car info))) 3381 (mapcar (lambda (info) (symbol-name (car info)))
3265 sql-product-alist) 3382 sql-product-alist)
3266 nil 'require-match 3383 nil 'require-match
3267 (or (and sql-product (symbol-name sql-product)) "ansi")))) 3384 (or (and sql-product
3385 (symbol-name sql-product))
3386 "ansi"))))
3268 ((and product ; Product specified 3387 ((and product ; Product specified
3269 (symbolp product)) product) 3388 (symbolp product)) product)
3270 (t sql-product))) ; Default to sql-product 3389 (t sql-product))) ; Default to sql-product
3271 3390
3391 ;; If we have a product and it has a interactive mode
3272 (if product 3392 (if product
3273 (when (sql-get-product-feature product :sqli-comint-func) 3393 (when (sql-get-product-feature product :sqli-comint-func)
3274 (if (and sql-buffer 3394 ;; If no new name specified, fall back on sql-buffer if its for
3275 (buffer-live-p sql-buffer) 3395 ;; the same product
3276 (comint-check-proc sql-buffer)) 3396 (if (and (not new-name)
3397 sql-buffer
3398 (sql-buffer-live-p sql-buffer)
3399 (comint-check-proc sql-buffer)
3400 (eq product (with-current-buffer sql-buffer sql-product)))
3277 (pop-to-buffer sql-buffer) 3401 (pop-to-buffer sql-buffer)
3278 3402
3279 ;; Is the current buffer in sql-mode and 3403 ;; We have a new name or sql-buffer doesn't exist or match
3280 ;; there is a buffer local setting of sql-buffer 3404 ;; Start by remembering where we start
3281 (let* ((start-buffer 3405 (let* ((start-buffer (current-buffer))
3282 (and (derived-mode-p 'sql-mode)
3283 (current-buffer)))
3284 (start-sql-buffer
3285 (and start-buffer
3286 (let (found)
3287 (dolist (var (buffer-local-variables))
3288 (and (consp var)
3289 (eq (car var) 'sql-buffer)
3290 (buffer-live-p (cdr var))
3291 (get-buffer-process (cdr var))
3292 (setq found (cdr var))))
3293 found)))
3294 new-sqli-buffer) 3406 new-sqli-buffer)
3295 3407
3296 ;; Get credentials. 3408 ;; Get credentials.
@@ -3303,15 +3415,18 @@ If buffer exists and a process is running, just switch to buffer `*SQL*'.
3303 (sql-get-product-feature product :sqli-options)) 3415 (sql-get-product-feature product :sqli-options))
3304 3416
3305 ;; Set SQLi mode. 3417 ;; Set SQLi mode.
3306 (setq sql-interactive-product product 3418 (setq new-sqli-buffer (current-buffer))
3307 new-sqli-buffer (current-buffer) 3419 (let ((sql-interactive-product product))
3308 sql-buffer new-sqli-buffer) 3420 (sql-interactive-mode))
3309 (sql-interactive-mode) 3421
3422 ;; Set the new buffer name
3423 (when new-name
3424 (sql-rename-buffer new-name))
3310 3425
3311 ;; Set `sql-buffer' in the start buffer 3426 ;; Set `sql-buffer' in the start buffer
3312 (when (and start-buffer (not start-sql-buffer)) 3427 (setq sql-buffer (buffer-name new-sqli-buffer))
3313 (with-current-buffer start-buffer 3428 (with-current-buffer start-buffer
3314 (setq sql-buffer new-sqli-buffer))) 3429 (setq sql-buffer (buffer-name new-sqli-buffer)))
3315 3430
3316 ;; All done. 3431 ;; All done.
3317 (message "Login...done") 3432 (message "Login...done")
@@ -3323,12 +3438,22 @@ If buffer exists and a process is running, just switch to buffer `*SQL*'.
3323 3438
3324PRODUCT is the SQL product. PARAMS is a list of strings which are 3439PRODUCT is the SQL product. PARAMS is a list of strings which are
3325passed as command line arguments." 3440passed as command line arguments."
3326 (let ((program (sql-get-product-feature product :sqli-program))) 3441 (let ((program (sql-get-product-feature product :sqli-program))
3442 (buf-name "SQL"))
3443 ;; Make sure buffer name is unique
3444 (when (get-buffer (format "*%s*" buf-name))
3445 (setq buf-name (format "SQL-%s" product))
3446 (when (get-buffer (format "*%s*" buf-name))
3447 (let ((i 1))
3448 (while (get-buffer (format "*%s*"
3449 (setq buf-name
3450 (format "SQL-%s%d" product i))))
3451 (setq i (1+ i))))))
3327 (set-buffer 3452 (set-buffer
3328 (apply 'make-comint "SQL" program nil params)))) 3453 (apply 'make-comint buf-name program nil params))))
3329 3454
3330;;;###autoload 3455;;;###autoload
3331(defun sql-oracle () 3456(defun sql-oracle (&optional buffer)
3332 "Run sqlplus by Oracle as an inferior process. 3457 "Run sqlplus by Oracle as an inferior process.
3333 3458
3334If buffer `*SQL*' exists but no process is running, make a new process. 3459If buffer `*SQL*' exists but no process is running, make a new process.
@@ -3343,6 +3468,11 @@ the list `sql-oracle-options'.
3343The buffer is put in SQL interactive mode, giving commands for sending 3468The buffer is put in SQL interactive mode, giving commands for sending
3344input. See `sql-interactive-mode'. 3469input. See `sql-interactive-mode'.
3345 3470
3471To set the buffer name directly, use \\[universal-argument]
3472before \\[sql-oracle]. Once session has started,
3473\\[sql-rename-buffer] can be called separately to rename the
3474buffer.
3475
3346To specify a coding system for converting non-ASCII characters 3476To specify a coding system for converting non-ASCII characters
3347in the input and output to the process, use \\[universal-coding-system-argument] 3477in the input and output to the process, use \\[universal-coding-system-argument]
3348before \\[sql-oracle]. You can also specify this with \\[set-buffer-process-coding-system] 3478before \\[sql-oracle]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3351,8 +3481,8 @@ The default comes from `process-coding-system-alist' and
3351`default-process-coding-system'. 3481`default-process-coding-system'.
3352 3482
3353\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3483\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3354 (interactive) 3484 (interactive "P")
3355 (sql-product-interactive 'oracle)) 3485 (sql-product-interactive 'oracle buffer))
3356 3486
3357(defun sql-comint-oracle (product options) 3487(defun sql-comint-oracle (product options)
3358 "Create comint buffer and connect to Oracle." 3488 "Create comint buffer and connect to Oracle."
@@ -3375,7 +3505,7 @@ The default comes from `process-coding-system-alist' and
3375 3505
3376 3506
3377;;;###autoload 3507;;;###autoload
3378(defun sql-sybase () 3508(defun sql-sybase (&optional buffer)
3379 "Run isql by Sybase as an inferior process. 3509 "Run isql by Sybase as an inferior process.
3380 3510
3381If buffer `*SQL*' exists but no process is running, make a new process. 3511If buffer `*SQL*' exists but no process is running, make a new process.
@@ -3390,6 +3520,11 @@ can be stored in the list `sql-sybase-options'.
3390The buffer is put in SQL interactive mode, giving commands for sending 3520The buffer is put in SQL interactive mode, giving commands for sending
3391input. See `sql-interactive-mode'. 3521input. See `sql-interactive-mode'.
3392 3522
3523To set the buffer name directly, use \\[universal-argument]
3524before \\[sql-sybase]. Once session has started,
3525\\[sql-rename-buffer] can be called separately to rename the
3526buffer.
3527
3393To specify a coding system for converting non-ASCII characters 3528To specify a coding system for converting non-ASCII characters
3394in the input and output to the process, use \\[universal-coding-system-argument] 3529in the input and output to the process, use \\[universal-coding-system-argument]
3395before \\[sql-sybase]. You can also specify this with \\[set-buffer-process-coding-system] 3530before \\[sql-sybase]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3398,8 +3533,8 @@ The default comes from `process-coding-system-alist' and
3398`default-process-coding-system'. 3533`default-process-coding-system'.
3399 3534
3400\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3535\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3401 (interactive) 3536 (interactive "P")
3402 (sql-product-interactive 'sybase)) 3537 (sql-product-interactive 'sybase buffer))
3403 3538
3404(defun sql-comint-sybase (product options) 3539(defun sql-comint-sybase (product options)
3405 "Create comint buffer and connect to Sybase." 3540 "Create comint buffer and connect to Sybase."
@@ -3419,7 +3554,7 @@ The default comes from `process-coding-system-alist' and
3419 3554
3420 3555
3421;;;###autoload 3556;;;###autoload
3422(defun sql-informix () 3557(defun sql-informix (&optional buffer)
3423 "Run dbaccess by Informix as an inferior process. 3558 "Run dbaccess by Informix as an inferior process.
3424 3559
3425If buffer `*SQL*' exists but no process is running, make a new process. 3560If buffer `*SQL*' exists but no process is running, make a new process.
@@ -3432,6 +3567,11 @@ the variable `sql-database' as default, if set.
3432The buffer is put in SQL interactive mode, giving commands for sending 3567The buffer is put in SQL interactive mode, giving commands for sending
3433input. See `sql-interactive-mode'. 3568input. See `sql-interactive-mode'.
3434 3569
3570To set the buffer name directly, use \\[universal-argument]
3571before \\[sql-informix]. Once session has started,
3572\\[sql-rename-buffer] can be called separately to rename the
3573buffer.
3574
3435To specify a coding system for converting non-ASCII characters 3575To specify a coding system for converting non-ASCII characters
3436in the input and output to the process, use \\[universal-coding-system-argument] 3576in the input and output to the process, use \\[universal-coding-system-argument]
3437before \\[sql-informix]. You can also specify this with \\[set-buffer-process-coding-system] 3577before \\[sql-informix]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3440,8 +3580,8 @@ The default comes from `process-coding-system-alist' and
3440`default-process-coding-system'. 3580`default-process-coding-system'.
3441 3581
3442\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3582\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3443 (interactive) 3583 (interactive "P")
3444 (sql-product-interactive 'informix)) 3584 (sql-product-interactive 'informix buffer))
3445 3585
3446(defun sql-comint-informix (product options) 3586(defun sql-comint-informix (product options)
3447 "Create comint buffer and connect to Informix." 3587 "Create comint buffer and connect to Informix."
@@ -3456,7 +3596,7 @@ The default comes from `process-coding-system-alist' and
3456 3596
3457 3597
3458;;;###autoload 3598;;;###autoload
3459(defun sql-sqlite () 3599(defun sql-sqlite (&optional buffer)
3460 "Run sqlite as an inferior process. 3600 "Run sqlite as an inferior process.
3461 3601
3462SQLite is free software. 3602SQLite is free software.
@@ -3473,6 +3613,11 @@ can be stored in the list `sql-sqlite-options'.
3473The buffer is put in SQL interactive mode, giving commands for sending 3613The buffer is put in SQL interactive mode, giving commands for sending
3474input. See `sql-interactive-mode'. 3614input. See `sql-interactive-mode'.
3475 3615
3616To set the buffer name directly, use \\[universal-argument]
3617before \\[sql-sqlite]. Once session has started,
3618\\[sql-rename-buffer] can be called separately to rename the
3619buffer.
3620
3476To specify a coding system for converting non-ASCII characters 3621To specify a coding system for converting non-ASCII characters
3477in the input and output to the process, use \\[universal-coding-system-argument] 3622in the input and output to the process, use \\[universal-coding-system-argument]
3478before \\[sql-sqlite]. You can also specify this with \\[set-buffer-process-coding-system] 3623before \\[sql-sqlite]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3481,8 +3626,8 @@ The default comes from `process-coding-system-alist' and
3481`default-process-coding-system'. 3626`default-process-coding-system'.
3482 3627
3483\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3628\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3484 (interactive) 3629 (interactive "P")
3485 (sql-product-interactive 'sqlite)) 3630 (sql-product-interactive 'sqlite buffer))
3486 3631
3487(defun sql-comint-sqlite (product options) 3632(defun sql-comint-sqlite (product options)
3488 "Create comint buffer and connect to SQLite." 3633 "Create comint buffer and connect to SQLite."
@@ -3498,7 +3643,7 @@ The default comes from `process-coding-system-alist' and
3498 3643
3499 3644
3500;;;###autoload 3645;;;###autoload
3501(defun sql-mysql () 3646(defun sql-mysql (&optional buffer)
3502 "Run mysql by TcX as an inferior process. 3647 "Run mysql by TcX as an inferior process.
3503 3648
3504Mysql versions 3.23 and up are free software. 3649Mysql versions 3.23 and up are free software.
@@ -3515,6 +3660,11 @@ can be stored in the list `sql-mysql-options'.
3515The buffer is put in SQL interactive mode, giving commands for sending 3660The buffer is put in SQL interactive mode, giving commands for sending
3516input. See `sql-interactive-mode'. 3661input. See `sql-interactive-mode'.
3517 3662
3663To set the buffer name directly, use \\[universal-argument]
3664before \\[sql-mysql]. Once session has started,
3665\\[sql-rename-buffer] can be called separately to rename the
3666buffer.
3667
3518To specify a coding system for converting non-ASCII characters 3668To specify a coding system for converting non-ASCII characters
3519in the input and output to the process, use \\[universal-coding-system-argument] 3669in the input and output to the process, use \\[universal-coding-system-argument]
3520before \\[sql-mysql]. You can also specify this with \\[set-buffer-process-coding-system] 3670before \\[sql-mysql]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3523,8 +3673,8 @@ The default comes from `process-coding-system-alist' and
3523`default-process-coding-system'. 3673`default-process-coding-system'.
3524 3674
3525\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3675\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3526 (interactive) 3676 (interactive "P")
3527 (sql-product-interactive 'mysql)) 3677 (sql-product-interactive 'mysql buffer))
3528 3678
3529(defun sql-comint-mysql (product options) 3679(defun sql-comint-mysql (product options)
3530 "Create comint buffer and connect to MySQL." 3680 "Create comint buffer and connect to MySQL."
@@ -3535,7 +3685,7 @@ The default comes from `process-coding-system-alist' and
3535 (setq params (append (list sql-database) params))) 3685 (setq params (append (list sql-database) params)))
3536 (if (not (string= "" sql-server)) 3686 (if (not (string= "" sql-server))
3537 (setq params (append (list (concat "--host=" sql-server)) params))) 3687 (setq params (append (list (concat "--host=" sql-server)) params)))
3538 (if (and sql-port (numberp sql-port)) 3688 (if (not (= 0 sql-port))
3539 (setq params (append (list (concat "--port=" (number-to-string sql-port))) params))) 3689 (setq params (append (list (concat "--port=" (number-to-string sql-port))) params)))
3540 (if (not (string= "" sql-password)) 3690 (if (not (string= "" sql-password))
3541 (setq params (append (list (concat "--password=" sql-password)) params))) 3691 (setq params (append (list (concat "--password=" sql-password)) params)))
@@ -3547,7 +3697,7 @@ The default comes from `process-coding-system-alist' and
3547 3697
3548 3698
3549;;;###autoload 3699;;;###autoload
3550(defun sql-solid () 3700(defun sql-solid (&optional buffer)
3551 "Run solsql by Solid as an inferior process. 3701 "Run solsql by Solid as an inferior process.
3552 3702
3553If buffer `*SQL*' exists but no process is running, make a new process. 3703If buffer `*SQL*' exists but no process is running, make a new process.
@@ -3561,6 +3711,11 @@ defaults, if set.
3561The buffer is put in SQL interactive mode, giving commands for sending 3711The buffer is put in SQL interactive mode, giving commands for sending
3562input. See `sql-interactive-mode'. 3712input. See `sql-interactive-mode'.
3563 3713
3714To set the buffer name directly, use \\[universal-argument]
3715before \\[sql-solid]. Once session has started,
3716\\[sql-rename-buffer] can be called separately to rename the
3717buffer.
3718
3564To specify a coding system for converting non-ASCII characters 3719To specify a coding system for converting non-ASCII characters
3565in the input and output to the process, use \\[universal-coding-system-argument] 3720in the input and output to the process, use \\[universal-coding-system-argument]
3566before \\[sql-solid]. You can also specify this with \\[set-buffer-process-coding-system] 3721before \\[sql-solid]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3569,8 +3724,8 @@ The default comes from `process-coding-system-alist' and
3569`default-process-coding-system'. 3724`default-process-coding-system'.
3570 3725
3571\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3726\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3572 (interactive) 3727 (interactive "P")
3573 (sql-product-interactive 'solid)) 3728 (sql-product-interactive 'solid buffer))
3574 3729
3575(defun sql-comint-solid (product options) 3730(defun sql-comint-solid (product options)
3576 "Create comint buffer and connect to Solid." 3731 "Create comint buffer and connect to Solid."
@@ -3588,7 +3743,7 @@ The default comes from `process-coding-system-alist' and
3588 3743
3589 3744
3590;;;###autoload 3745;;;###autoload
3591(defun sql-ingres () 3746(defun sql-ingres (&optional buffer)
3592 "Run sql by Ingres as an inferior process. 3747 "Run sql by Ingres as an inferior process.
3593 3748
3594If buffer `*SQL*' exists but no process is running, make a new process. 3749If buffer `*SQL*' exists but no process is running, make a new process.
@@ -3601,6 +3756,11 @@ the variable `sql-database' as default, if set.
3601The buffer is put in SQL interactive mode, giving commands for sending 3756The buffer is put in SQL interactive mode, giving commands for sending
3602input. See `sql-interactive-mode'. 3757input. See `sql-interactive-mode'.
3603 3758
3759To set the buffer name directly, use \\[universal-argument]
3760before \\[sql-ingres]. Once session has started,
3761\\[sql-rename-buffer] can be called separately to rename the
3762buffer.
3763
3604To specify a coding system for converting non-ASCII characters 3764To specify a coding system for converting non-ASCII characters
3605in the input and output to the process, use \\[universal-coding-system-argument] 3765in the input and output to the process, use \\[universal-coding-system-argument]
3606before \\[sql-ingres]. You can also specify this with \\[set-buffer-process-coding-system] 3766before \\[sql-ingres]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3609,8 +3769,8 @@ The default comes from `process-coding-system-alist' and
3609`default-process-coding-system'. 3769`default-process-coding-system'.
3610 3770
3611\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3771\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3612 (interactive) 3772 (interactive "P")
3613 (sql-product-interactive 'ingres)) 3773 (sql-product-interactive 'ingres buffer))
3614 3774
3615(defun sql-comint-ingres (product options) 3775(defun sql-comint-ingres (product options)
3616 "Create comint buffer and connect to Ingres." 3776 "Create comint buffer and connect to Ingres."
@@ -3624,7 +3784,7 @@ The default comes from `process-coding-system-alist' and
3624 3784
3625 3785
3626;;;###autoload 3786;;;###autoload
3627(defun sql-ms () 3787(defun sql-ms (&optional buffer)
3628 "Run osql by Microsoft as an inferior process. 3788 "Run osql by Microsoft as an inferior process.
3629 3789
3630If buffer `*SQL*' exists but no process is running, make a new process. 3790If buffer `*SQL*' exists but no process is running, make a new process.
@@ -3639,6 +3799,11 @@ in the list `sql-ms-options'.
3639The buffer is put in SQL interactive mode, giving commands for sending 3799The buffer is put in SQL interactive mode, giving commands for sending
3640input. See `sql-interactive-mode'. 3800input. See `sql-interactive-mode'.
3641 3801
3802To set the buffer name directly, use \\[universal-argument]
3803before \\[sql-ms]. Once session has started,
3804\\[sql-rename-buffer] can be called separately to rename the
3805buffer.
3806
3642To specify a coding system for converting non-ASCII characters 3807To specify a coding system for converting non-ASCII characters
3643in the input and output to the process, use \\[universal-coding-system-argument] 3808in the input and output to the process, use \\[universal-coding-system-argument]
3644before \\[sql-ms]. You can also specify this with \\[set-buffer-process-coding-system] 3809before \\[sql-ms]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3647,8 +3812,8 @@ The default comes from `process-coding-system-alist' and
3647`default-process-coding-system'. 3812`default-process-coding-system'.
3648 3813
3649\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3814\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3650 (interactive) 3815 (interactive "P")
3651 (sql-product-interactive 'ms)) 3816 (sql-product-interactive 'ms buffer))
3652 3817
3653(defun sql-comint-ms (product options) 3818(defun sql-comint-ms (product options)
3654 "Create comint buffer and connect to Microsoft SQL Server." 3819 "Create comint buffer and connect to Microsoft SQL Server."
@@ -3675,7 +3840,7 @@ The default comes from `process-coding-system-alist' and
3675 3840
3676 3841
3677;;;###autoload 3842;;;###autoload
3678(defun sql-postgres () 3843(defun sql-postgres (&optional buffer)
3679 "Run psql by Postgres as an inferior process. 3844 "Run psql by Postgres as an inferior process.
3680 3845
3681If buffer `*SQL*' exists but no process is running, make a new process. 3846If buffer `*SQL*' exists but no process is running, make a new process.
@@ -3690,6 +3855,11 @@ Additional command line parameters can be stored in the list
3690The buffer is put in SQL interactive mode, giving commands for sending 3855The buffer is put in SQL interactive mode, giving commands for sending
3691input. See `sql-interactive-mode'. 3856input. See `sql-interactive-mode'.
3692 3857
3858To set the buffer name directly, use \\[universal-argument]
3859before \\[sql-postgres]. Once session has started,
3860\\[sql-rename-buffer] can be called separately to rename the
3861buffer.
3862
3693To specify a coding system for converting non-ASCII characters 3863To specify a coding system for converting non-ASCII characters
3694in the input and output to the process, use \\[universal-coding-system-argument] 3864in the input and output to the process, use \\[universal-coding-system-argument]
3695before \\[sql-postgres]. You can also specify this with \\[set-buffer-process-coding-system] 3865before \\[sql-postgres]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3703,8 +3873,8 @@ Try to set `comint-output-filter-functions' like this:
3703 '(comint-strip-ctrl-m))) 3873 '(comint-strip-ctrl-m)))
3704 3874
3705\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3875\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3706 (interactive) 3876 (interactive "P")
3707 (sql-product-interactive 'postgres)) 3877 (sql-product-interactive 'postgres buffer))
3708 3878
3709(defun sql-comint-postgres (product options) 3879(defun sql-comint-postgres (product options)
3710 "Create comint buffer and connect to Postgres." 3880 "Create comint buffer and connect to Postgres."
@@ -3725,7 +3895,7 @@ Try to set `comint-output-filter-functions' like this:
3725 3895
3726 3896
3727;;;###autoload 3897;;;###autoload
3728(defun sql-interbase () 3898(defun sql-interbase (&optional buffer)
3729 "Run isql by Interbase as an inferior process. 3899 "Run isql by Interbase as an inferior process.
3730 3900
3731If buffer `*SQL*' exists but no process is running, make a new process. 3901If buffer `*SQL*' exists but no process is running, make a new process.
@@ -3739,6 +3909,11 @@ defaults, if set.
3739The buffer is put in SQL interactive mode, giving commands for sending 3909The buffer is put in SQL interactive mode, giving commands for sending
3740input. See `sql-interactive-mode'. 3910input. See `sql-interactive-mode'.
3741 3911
3912To set the buffer name directly, use \\[universal-argument]
3913before \\[sql-interbase]. Once session has started,
3914\\[sql-rename-buffer] can be called separately to rename the
3915buffer.
3916
3742To specify a coding system for converting non-ASCII characters 3917To specify a coding system for converting non-ASCII characters
3743in the input and output to the process, use \\[universal-coding-system-argument] 3918in the input and output to the process, use \\[universal-coding-system-argument]
3744before \\[sql-interbase]. You can also specify this with \\[set-buffer-process-coding-system] 3919before \\[sql-interbase]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3747,8 +3922,8 @@ The default comes from `process-coding-system-alist' and
3747`default-process-coding-system'. 3922`default-process-coding-system'.
3748 3923
3749\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3924\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3750 (interactive) 3925 (interactive "P")
3751 (sql-product-interactive 'interbase)) 3926 (sql-product-interactive 'interbase buffer))
3752 3927
3753(defun sql-comint-interbase (product options) 3928(defun sql-comint-interbase (product options)
3754 "Create comint buffer and connect to Interbase." 3929 "Create comint buffer and connect to Interbase."
@@ -3766,7 +3941,7 @@ The default comes from `process-coding-system-alist' and
3766 3941
3767 3942
3768;;;###autoload 3943;;;###autoload
3769(defun sql-db2 () 3944(defun sql-db2 (&optional buffer)
3770 "Run db2 by IBM as an inferior process. 3945 "Run db2 by IBM as an inferior process.
3771 3946
3772If buffer `*SQL*' exists but no process is running, make a new process. 3947If buffer `*SQL*' exists but no process is running, make a new process.
@@ -3784,6 +3959,11 @@ db2, newlines will be escaped if necessary. If you don't want that, set
3784`comint-input-sender' back to `comint-simple-send' by writing an after 3959`comint-input-sender' back to `comint-simple-send' by writing an after
3785advice. See the elisp manual for more information. 3960advice. See the elisp manual for more information.
3786 3961
3962To set the buffer name directly, use \\[universal-argument]
3963before \\[sql-db2]. Once session has started,
3964\\[sql-rename-buffer] can be called separately to rename the
3965buffer.
3966
3787To specify a coding system for converting non-ASCII characters 3967To specify a coding system for converting non-ASCII characters
3788in the input and output to the process, use \\[universal-coding-system-argument] 3968in the input and output to the process, use \\[universal-coding-system-argument]
3789before \\[sql-db2]. You can also specify this with \\[set-buffer-process-coding-system] 3969before \\[sql-db2]. You can also specify this with \\[set-buffer-process-coding-system]
@@ -3792,8 +3972,8 @@ The default comes from `process-coding-system-alist' and
3792`default-process-coding-system'. 3972`default-process-coding-system'.
3793 3973
3794\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 3974\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3795 (interactive) 3975 (interactive "P")
3796 (sql-product-interactive 'db2)) 3976 (sql-product-interactive 'db2 buffer))
3797 3977
3798(defun sql-comint-db2 (product options) 3978(defun sql-comint-db2 (product options)
3799 "Create comint buffer and connect to DB2." 3979 "Create comint buffer and connect to DB2."
@@ -3801,11 +3981,9 @@ The default comes from `process-coding-system-alist' and
3801 ;; make-comint. 3981 ;; make-comint.
3802 (sql-comint product options) 3982 (sql-comint product options)
3803) 3983)
3804;; ;; Properly escape newlines when DB2 is interactive.
3805;; (setq comint-input-sender 'sql-escape-newlines-and-send))
3806 3984
3807;;;###autoload 3985;;;###autoload
3808(defun sql-linter () 3986(defun sql-linter (&optional buffer)
3809 "Run inl by RELEX as an inferior process. 3987 "Run inl by RELEX as an inferior process.
3810 3988
3811If buffer `*SQL*' exists but no process is running, make a new process. 3989If buffer `*SQL*' exists but no process is running, make a new process.
@@ -3827,9 +4005,14 @@ an empty password.
3827The buffer is put in SQL interactive mode, giving commands for sending 4005The buffer is put in SQL interactive mode, giving commands for sending
3828input. See `sql-interactive-mode'. 4006input. See `sql-interactive-mode'.
3829 4007
4008To set the buffer name directly, use \\[universal-argument]
4009before \\[sql-linter]. Once session has started,
4010\\[sql-rename-buffer] can be called separately to rename the
4011buffer.
4012
3830\(Type \\[describe-mode] in the SQL buffer for a list of commands.)" 4013\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
3831 (interactive) 4014 (interactive "P")
3832 (sql-product-interactive 'linter)) 4015 (sql-product-interactive 'linter buffer))
3833 4016
3834(defun sql-comint-linter (product options) 4017(defun sql-comint-linter (product options)
3835 "Create comint buffer and connect to Linter." 4018 "Create comint buffer and connect to Linter."