Skip to content

Commit 417bcd3

Browse files
committed
clean output regex goes in plist
1 parent f72954b commit 417bcd3

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

ob-sql.el

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ This function is called by `org-babel-execute-src-block'."
291291
(org-babel-temp-file "sql-out-")))
292292
(session (cdr (assoc :session params)))
293293
(session-p (not (string= session "none")))
294+
(clean-output (plist-get org-sql-session-clean-output in-engine))
294295
(header-delim ""))
295296

296297
(if (or session-p org-sql-run-comint-p)
@@ -325,12 +326,9 @@ This function is called by `org-babel-execute-src-block'."
325326
(with-current-buffer (get-buffer-create "*ob-sql-result*")
326327
(goto-char (point-min))
327328
;; clear the output or prompt and termination
328-
(let ((clear-output ;;(plist-get org-sql-session-clean-output in-engine)
329-
(sql-get-product-feature in-engine :org-sql-session-clean-output)
330-
))
331-
(while (re-search-forward clear-output nil t)
332-
(replace-match ""))
333-
(write-file out-file))))
329+
(while (re-search-forward clean-output nil t)
330+
(replace-match ""))
331+
(write-file out-file)))
334332

335333
;; else, command line
336334
(let* ((cmdline (cdr (assq :cmdline params)))
@@ -470,9 +468,7 @@ SET COLSEP '|'
470468
(when session-p
471469
(goto-char (point-min))
472470
;; clear the output of prompt and termination
473-
(while (re-search-forward
474-
(sql-get-product-feature in-engine :org-sql-session-clean-output)
475-
nil t)
471+
(while (re-search-forward clean-output nil t)
476472
(replace-match "")))
477473

478474
(org-table-import out-file (if (string= engine "sqsh") '(4) '(16)))
@@ -628,11 +624,6 @@ should also be prompted."
628624
"\\|\\(" org-sql-session--batch-terminate "\n\\)"
629625
(when prompt-cont-regexp
630626
(concat "\\|\\(" prompt-cont-regexp "\\)"))))
631-
(sql-set-product-feature engine :org-sql-session-clean-output
632-
(concat "\\(" prompt-regexp "\\)"
633-
"\\|\\(" org-sql-session--batch-terminate "\n\\)"
634-
(when prompt-cont-regexp
635-
(concat "\\|\\(" prompt-cont-regexp "\\)"))))
636627

637628
;; Get credentials.
638629
;; either all fields are provided

0 commit comments

Comments
 (0)