Commit ed1e805a authored by Michael R. Mauger's avatar Michael R. Mauger

* lisp/progmodes/sql.el defensive programming

(sql-statement-regexp): if 'ansi' dialect is not defined, use "select"
(sql-interactive-mode): establish process sentinel iff there is a
process. Default values for :prompt-regexp and :prompt-length.
(sql-product-interactive): only check process status iff there is a
parent e66d5a1c
Pipeline #811 passed with stage
in 50 minutes and 35 seconds
......@@ -2929,7 +2929,7 @@ displayed."
;;; Motion Functions
(defun sql-statement-regexp (prod)
(let* ((ansi-stmt (sql-get-product-feature 'ansi :statement))
(let* ((ansi-stmt (or (sql-get-product-feature 'ansi :statement) "select"))
(prod-stmt (sql-get-product-feature prod :statement)))
(concat "^\\<"
(if prod-stmt
......@@ -4193,7 +4193,8 @@ you entered, right above the output it created.
(setq local-abbrev-table sql-mode-abbrev-table)
(setq abbrev-all-caps 1)
;; Exiting the process will call sql-stop.
(set-process-sentinel (get-buffer-process (current-buffer)) 'sql-stop)
(let ((proc (get-buffer-process (current-buffer))))
(when proc (set-process-sentinel proc 'sql-stop)))
;; Save the connection and login params
(set (make-local-variable 'sql-user) sql-user)
(set (make-local-variable 'sql-database) sql-database)
......@@ -4211,7 +4212,7 @@ you entered, right above the output it created.
;; User stuff. Initialize before the hook.
(set (make-local-variable 'sql-prompt-regexp)
(sql-get-product-feature sql-product :prompt-regexp))
(or (sql-get-product-feature sql-product :prompt-regexp) "^"))
(set (make-local-variable 'sql-prompt-length)
(sql-get-product-feature sql-product :prompt-length))
(set (make-local-variable 'sql-prompt-cont-regexp)
......@@ -4230,7 +4231,7 @@ you entered, right above the output it created.
(concat "\\(" sql-prompt-regexp
"\\|" sql-prompt-cont-regexp "\\)")
(setq left-margin sql-prompt-length)
(setq left-margin (or sql-prompt-length 0))
;; Install input sender
(set (make-local-variable 'comint-input-sender) 'sql-input-sender)
;; People wanting a different history file for each
......@@ -4522,7 +4523,8 @@ the call to \\[sql-product-interactive] with
(let ((proc (get-buffer-process new-sqli-buffer))
(secs sql-login-delay)
(step 0.3))
(while (and (memq (process-status proc) '(open run))
(while (and proc
(memq (process-status proc) '(open run))
(or (accept-process-output proc step)
(<= 0.0 (setq secs (- secs step))))
(progn (goto-char (point-max))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment