[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109971: * progmodes/sql.el: Version
From: |
Michael Mauger |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109971: * progmodes/sql.el: Version 3.1 |
Date: |
Mon, 10 Sep 2012 15:22:53 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109971
committer: Michael Mauger <address@hidden>
branch nick: trunk
timestamp: Mon 2012-09-10 15:22:53 -0400
message:
* progmodes/sql.el: Version 3.1
(sql-db2-escape-newlines): New variable.
(sql-escape-newlines-filter): Use it.
modified:
etc/NEWS
lisp/ChangeLog
lisp/progmodes/sql.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2012-09-10 14:33:08 +0000
+++ b/etc/NEWS 2012-09-10 19:22:53 +0000
@@ -344,6 +344,14 @@
*** Accepts \r and \f as whitespace.
+** SQL Mode
+
+*** DB2 added `sql-db2-escape-newlines'
+
+If non-nil, newlines sent to the command interpreter will be escaped
+by a backslash. The default does not escape the newlines and assumes
+that the sql statement will be terminated by a semicolon.
+
** Diff mode
Faces for changes now use the same diff color scheme as in modern VCSes
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-09-10 15:52:15 +0000
+++ b/lisp/ChangeLog 2012-09-10 19:22:53 +0000
@@ -1,3 +1,9 @@
+2012-09-10 Michael R. Mauger <address@hidden>
+
+ * progmodes/sql.el: Version 3.1
+ (sql-db2-escape-newlines): New variable.
+ (sql-escape-newlines-filter): Use it.
+
2012-09-10 Juanma Barranquero <address@hidden>
* custom.el (custom-theme-load-confirm): Remove unneeded assignment.
=== modified file 'lisp/progmodes/sql.el'
--- a/lisp/progmodes/sql.el 2012-07-13 14:58:12 +0000
+++ b/lisp/progmodes/sql.el 2012-09-10 19:22:53 +0000
@@ -4,7 +4,7 @@
;; Author: Alex Schroeder <address@hidden>
;; Maintainer: Michael Mauger <address@hidden>
-;; Version: 3.0
+;; Version: 3.1
;; Keywords: comm languages processes
;; URL: http://savannah.gnu.org/projects/emacs/
@@ -218,9 +218,12 @@
;; Michael Mauger <address@hidden> -- improved product support
;; Drew Adams <address@hidden> -- Emacs 20 support
;; Harald Maier <address@hidden> -- sql-send-string
-;; Stefan Monnier <address@hidden> -- font-lock corrections; code polish
+;; Stefan Monnier <address@hidden> -- font-lock corrections;
+;; code polish
;; Paul Sleigh <address@hidden> -- MySQL keyword enhancement
;; Andrew Schein <address@hidden> -- sql-port bug
+;; Ian Bjorhovde <address@hidden> -- db2 escape newlines
+;; incorrectly enabled by default
@@ -879,6 +882,16 @@
:type 'boolean
:group 'SQL)
+(defcustom sql-db2-escape-newlines nil
+ "Non-nil if newlines should be escaped by a backslash in DB2 SQLi.
+
+When non-nil, Emacs will automatically insert a space and
+backslash prior to every newline in multi-line SQL statements as
+they are submitted to an interactive DB2 session."
+ :version "24.3"
+ :type 'boolean
+ :group 'SQL)
+
;; Customization for SQLite
(defcustom sql-sqlite-program (or (executable-find "sqlite3")
@@ -3188,20 +3201,23 @@
;; Using DB2 interactively, newlines must be escaped with " \".
;; The space before the backslash is relevant.
+
(defun sql-escape-newlines-filter (string)
"Escape newlines in STRING.
Every newline in STRING will be preceded with a space and a backslash."
- (let ((result "") (start 0) mb me)
- (while (string-match "\n" string start)
- (setq mb (match-beginning 0)
- me (match-end 0)
- result (concat result
- (substring string start mb)
- (if (and (> mb 1)
- (string-equal " \\" (substring string (- mb
2) mb)))
- "" " \\\n"))
- start me))
- (concat result (substring string start))))
+ (if (not sql-db2-escape-newlines)
+ string
+ (let ((result "") (start 0) mb me)
+ (while (string-match "\n" string start)
+ (setq mb (match-beginning 0)
+ me (match-end 0)
+ result (concat result
+ (substring string start mb)
+ (if (and (> mb 1)
+ (string-equal " \\" (substring string (-
mb 2) mb)))
+ "" " \\\n"))
+ start me))
+ (concat result (substring string start)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109971: * progmodes/sql.el: Version 3.1,
Michael Mauger <=