diff options
| author | Joakim Verona | 2012-09-11 17:18:45 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-09-11 17:18:45 +0200 |
| commit | 0cc36550df4f355a1b46e944fc65e533ff0df90e (patch) | |
| tree | 100e4130dffa88423b6430c2814f740007b72269 /lisp/progmodes | |
| parent | b035a30e5cd2f34fedc04c253eeb5a11afed8145 (diff) | |
| parent | 96d0357142bf277e6eb4d957a59b2c655034e2b7 (diff) | |
| download | emacs-0cc36550df4f355a1b46e944fc65e533ff0df90e.tar.gz emacs-0cc36550df4f355a1b46e944fc65e533ff0df90e.zip | |
upstream
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/sql.el | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 030cc02f3f4..f3ecbe3fc3d 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Alex Schroeder <alex@gnu.org> | 5 | ;; Author: Alex Schroeder <alex@gnu.org> |
| 6 | ;; Maintainer: Michael Mauger <mmaug@yahoo.com> | 6 | ;; Maintainer: Michael Mauger <mmaug@yahoo.com> |
| 7 | ;; Version: 3.0 | 7 | ;; Version: 3.1 |
| 8 | ;; Keywords: comm languages processes | 8 | ;; Keywords: comm languages processes |
| 9 | ;; URL: http://savannah.gnu.org/projects/emacs/ | 9 | ;; URL: http://savannah.gnu.org/projects/emacs/ |
| 10 | 10 | ||
| @@ -218,9 +218,12 @@ | |||
| 218 | ;; Michael Mauger <mmaug@yahoo.com> -- improved product support | 218 | ;; Michael Mauger <mmaug@yahoo.com> -- improved product support |
| 219 | ;; Drew Adams <drew.adams@oracle.com> -- Emacs 20 support | 219 | ;; Drew Adams <drew.adams@oracle.com> -- Emacs 20 support |
| 220 | ;; Harald Maier <maierh@myself.com> -- sql-send-string | 220 | ;; Harald Maier <maierh@myself.com> -- sql-send-string |
| 221 | ;; Stefan Monnier <monnier@iro.umontreal.ca> -- font-lock corrections; code polish | 221 | ;; Stefan Monnier <monnier@iro.umontreal.ca> -- font-lock corrections; |
| 222 | ;; code polish | ||
| 222 | ;; Paul Sleigh <bat@flurf.net> -- MySQL keyword enhancement | 223 | ;; Paul Sleigh <bat@flurf.net> -- MySQL keyword enhancement |
| 223 | ;; Andrew Schein <andrew@andrewschein.com> -- sql-port bug | 224 | ;; Andrew Schein <andrew@andrewschein.com> -- sql-port bug |
| 225 | ;; Ian Bjorhovde <idbjorh@dataproxy.com> -- db2 escape newlines | ||
| 226 | ;; incorrectly enabled by default | ||
| 224 | 227 | ||
| 225 | 228 | ||
| 226 | 229 | ||
| @@ -879,6 +882,16 @@ In older versions of SQL*Plus, this was the SET SCAN OFF command." | |||
| 879 | :type 'boolean | 882 | :type 'boolean |
| 880 | :group 'SQL) | 883 | :group 'SQL) |
| 881 | 884 | ||
| 885 | (defcustom sql-db2-escape-newlines nil | ||
| 886 | "Non-nil if newlines should be escaped by a backslash in DB2 SQLi. | ||
| 887 | |||
| 888 | When non-nil, Emacs will automatically insert a space and | ||
| 889 | backslash prior to every newline in multi-line SQL statements as | ||
| 890 | they are submitted to an interactive DB2 session." | ||
| 891 | :version "24.3" | ||
| 892 | :type 'boolean | ||
| 893 | :group 'SQL) | ||
| 894 | |||
| 882 | ;; Customization for SQLite | 895 | ;; Customization for SQLite |
| 883 | 896 | ||
| 884 | (defcustom sql-sqlite-program (or (executable-find "sqlite3") | 897 | (defcustom sql-sqlite-program (or (executable-find "sqlite3") |
| @@ -3188,20 +3201,23 @@ Placeholders are words starting with an ampersand like &this." | |||
| 3188 | 3201 | ||
| 3189 | ;; Using DB2 interactively, newlines must be escaped with " \". | 3202 | ;; Using DB2 interactively, newlines must be escaped with " \". |
| 3190 | ;; The space before the backslash is relevant. | 3203 | ;; The space before the backslash is relevant. |
| 3204 | |||
| 3191 | (defun sql-escape-newlines-filter (string) | 3205 | (defun sql-escape-newlines-filter (string) |
| 3192 | "Escape newlines in STRING. | 3206 | "Escape newlines in STRING. |
| 3193 | Every newline in STRING will be preceded with a space and a backslash." | 3207 | Every newline in STRING will be preceded with a space and a backslash." |
| 3194 | (let ((result "") (start 0) mb me) | 3208 | (if (not sql-db2-escape-newlines) |
| 3195 | (while (string-match "\n" string start) | 3209 | string |
| 3196 | (setq mb (match-beginning 0) | 3210 | (let ((result "") (start 0) mb me) |
| 3197 | me (match-end 0) | 3211 | (while (string-match "\n" string start) |
| 3198 | result (concat result | 3212 | (setq mb (match-beginning 0) |
| 3199 | (substring string start mb) | 3213 | me (match-end 0) |
| 3200 | (if (and (> mb 1) | 3214 | result (concat result |
| 3201 | (string-equal " \\" (substring string (- mb 2) mb))) | 3215 | (substring string start mb) |
| 3202 | "" " \\\n")) | 3216 | (if (and (> mb 1) |
| 3203 | start me)) | 3217 | (string-equal " \\" (substring string (- mb 2) mb))) |
| 3204 | (concat result (substring string start)))) | 3218 | "" " \\\n")) |
| 3219 | start me)) | ||
| 3220 | (concat result (substring string start))))) | ||
| 3205 | 3221 | ||
| 3206 | 3222 | ||
| 3207 | 3223 | ||