emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116447: * progmodes/sql.el: Version 3.4


From: Michael Mauger
Subject: [Emacs-diffs] trunk r116447: * progmodes/sql.el: Version 3.4
Date: Sat, 15 Feb 2014 22:51:37 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116447
revision-id: address@hidden
parent: address@hidden
committer: Michael Mauger <address@hidden>
branch nick: trunk
timestamp: Sat 2014-02-15 17:50:45 -0500
message:
  * progmodes/sql.el: Version 3.4
  (sql-oracle-options): New default value ("-L").
  (sql-mode-oracle-font-lock-keywords): Added placeholder highlighting.
  (sql-placeholders-filter): Correct placeholder pattern.
  (sql-read-table-name): Bug fix. Detect absence of SQLi process.
  (sql-login-delay): New variable.
  (sql-product-interactive): Use it.
modified:
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/sql.el          sql.el-20091113204419-o5vbwnq5f7feedwu-1303
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2014-02-14 07:36:42 +0000
+++ b/etc/NEWS  2014-02-15 22:50:45 +0000
@@ -807,6 +807,19 @@
 with an indented sample file.
 
 ---
+** SQL
+Improved login monitoring and appropriate response to login failures.
+Includes `sql-login-delay' to define maximum wait for a connection.
+
+*** Oracle support
+SQL*Plus script placeholders are properly highlighted and identified
+in `sql-placeholders-filter' correctly.  When SQL*Plus is started,
+options specified in `sql-oracle-options' are passed before the logon
+parameter, as SQL*Plus expects.  The default setting for
+`sql-oracle-options' has been altered to pass the `-L' option to limit
+the number of logon attempts per invocation.
+
+---
 ** New Term mode option `term-suppress-hard-newline'.
 
 +++

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-02-15 04:16:46 +0000
+++ b/lisp/ChangeLog    2014-02-15 22:50:45 +0000
@@ -1,3 +1,14 @@
+2014-02-14  Michael R. Mauger  <address@hidden>
+
+       * progmodes/sql.el: Version 3.4
+       (sql-oracle-options): New default value ("-L").
+       (sql-mode-oracle-font-lock-keywords): Added placeholder
+       highlighting.
+       (sql-placeholders-filter): Correct placeholder pattern.
+       (sql-read-table-name): Bug fix. Detect absence of SQLi process.
+       (sql-login-delay): New variable.
+       (sql-product-interactive): Use it.
+
 2014-02-15  Juanma Barranquero  <address@hidden>
 
        * frameset.el (frameset--jump-to-register): Check that buffer is live

=== modified file 'lisp/progmodes/sql.el'
--- a/lisp/progmodes/sql.el     2014-01-03 05:37:58 +0000
+++ b/lisp/progmodes/sql.el     2014-02-15 22:50:45 +0000
@@ -4,7 +4,7 @@
 
 ;; Author: Alex Schroeder <address@hidden>
 ;; Maintainer: Michael Mauger <address@hidden>
-;; Version: 3.3
+;; Version: 3.4
 ;; Keywords: comm languages processes
 ;; URL: http://savannah.gnu.org/projects/emacs/
 
@@ -724,6 +724,8 @@
 Globally should be set to nil; it will be non-nil in `sql-mode',
 `sql-interactive-mode' and list all buffers.")
 
+(defvar sql-login-delay 7.5 ;; Secs
+  "Maximum number of seconds you are willing to wait for a login connection.")
 
 (defcustom sql-pop-to-buffer-after-send-region nil
   "When non-nil, pop to the buffer SQL statements are sent to.
@@ -849,10 +851,10 @@
   :type 'file
   :group 'SQL)
 
-(defcustom sql-oracle-options nil
+(defcustom sql-oracle-options '("-L")
   "List of additional options for `sql-oracle-program'."
   :type '(repeat string)
-  :version "20.8"
+  :version "24.4"
   :group 'SQL)
 
 (defcustom sql-oracle-login-params '(user password database)
@@ -1601,6 +1603,7 @@
 
        "\\)\\(?:\\s-.*\\)?\\(?:[-]\n.*\\)*$")
       0 'font-lock-doc-face t)
+     '("&?&\\(?:\\sw\\|\\s_\\)+[.]?" 0 font-lock-preprocessor-face t)
 
      ;; Oracle Functions
      (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
@@ -3208,7 +3211,7 @@
 Placeholders are words starting with an ampersand like &this."
 
   (when sql-oracle-scan-on
-    (while (string-match "&\\(\\sw+\\)" string)
+    (while (string-match "&?&\\(\\(?:\\sw\\|\\s_\\)+\\)[.]?" string)
       (setq string (replace-match
                    (read-from-minibuffer
                     (format "Enter value for %s: " (match-string 1 string))
@@ -3681,13 +3684,16 @@
                (buffer-substring-no-properties (match-beginning 0)
                                                (match-end 0))))
          (sql-completion-sqlbuf (sql-find-sqli-buffer))
-         (product (with-current-buffer sql-completion-sqlbuf sql-product))
+         (product (when sql-completion-sqlbuf
+                    (with-current-buffer sql-completion-sqlbuf sql-product)))
          (completion-ignore-case t))
 
-    (if (sql-get-product-feature product :completion-object)
-        (completing-read prompt #'sql--completion-table
-                         nil nil tname)
-      (read-from-minibuffer prompt tname))))
+    (if product
+        (if (sql-get-product-feature product :completion-object)
+            (completing-read prompt #'sql--completion-table
+                             nil nil tname)
+          (read-from-minibuffer prompt tname))
+      (user-error "There is no active SQLi buffer"))))
 
 (defun sql-list-all (&optional enhanced)
   "List all database objects.
@@ -4145,14 +4151,15 @@
             ;; We have a new name or sql-buffer doesn't exist or match
             ;; Start by remembering where we start
             (let ((start-buffer (current-buffer))
-                  new-sqli-buffer)
+                  new-sqli-buffer rpt)
 
               ;; Get credentials.
               (apply #'sql-get-login
                      (sql-get-product-feature product :sqli-login))
 
               ;; Connect to database.
-              (message "Login...")
+              (setq rpt (make-progress-reporter "Login"))
+
               (let ((sql-user       (default-value 'sql-user))
                     (sql-password   (default-value 'sql-password))
                     (sql-server     (default-value 'sql-server))
@@ -4182,15 +4189,25 @@
               ;; Make sure the connection is complete
               ;; (Sometimes start up can be slow)
               ;;  and call the login hook
-              (let ((proc (get-buffer-process new-sqli-buffer)))
+              (let ((proc (get-buffer-process new-sqli-buffer))
+                    (secs sql-login-delay)
+                    (step 0.3))
                 (while (and (memq (process-status proc) '(open run))
-                            (accept-process-output proc 2.5)
+                            (or (accept-process-output proc step)
+                                (<= 0.0 (setq secs (- secs step))))
                             (progn (goto-char (point-max))
-                                   (not (looking-back sql-prompt-regexp))))))
-              (run-hooks 'sql-login-hook)
+                                   (not (re-search-backward sql-prompt-regexp 
0 t))))
+                  (progress-reporter-update rpt)))
+
+              (goto-char (point-max))
+              (when (re-search-backward sql-prompt-regexp nil t)
+                (run-hooks 'sql-login-hook))
+
               ;; All done.
-              (message "Login...done")
-              (pop-to-buffer new-sqli-buffer)))))
+              (progress-reporter-done rpt)
+              (pop-to-buffer new-sqli-buffer)
+              (goto-char (point-max))
+              (current-buffer)))))
     (user-error "No default SQL product defined.  Set `sql-product'.")))
 
 (defun sql-comint (product params)
@@ -4262,8 +4279,9 @@
          (setq parameter sql-user)))
     (if (and parameter (not (string= "" sql-database)))
        (setq parameter (concat parameter "@" sql-database)))
+    ;; options must appear before the logon parameters
     (if parameter
-       (setq parameter (nconc (list parameter) options))
+       (setq parameter (append options (list parameter)))
       (setq parameter options))
     (sql-comint product parameter)
     ;; Set process coding system to agree with the interpreter


reply via email to

[Prev in Thread] Current Thread [Next in Thread]