Add dbi support to sql babel mode

* lisp/ob-sql.el: add dbi engine type and pre/post processing
This commit is contained in:
Rick Frankel 2012-05-16 21:26:56 -04:00 committed by Eric Schulte
parent c4cad9f80b
commit eed31ad936
1 changed files with 10 additions and 1 deletions

View File

@ -71,6 +71,11 @@ This function is called by `org-babel-execute-src-block'."
(org-babel-temp-file "sql-out-")))
(header-delim "")
(command (case (intern engine)
('dbi (format "dbish --batch '%s' < %s | sed '%s' > %s"
(or cmdline "")
(org-babel-process-file-name in-file)
"/^+/d;s/^\|//;$d"
(org-babel-process-file-name out-file)))
('monetdb (format "mclient -f tab %s < %s > %s"
(or cmdline "")
(org-babel-process-file-name in-file)
@ -90,7 +95,11 @@ This function is called by `org-babel-execute-src-block'."
(or cmdline "")))
(t (error "no support for the %s sql engine" engine)))))
(with-temp-file in-file
(insert (org-babel-expand-body:sql body params)))
(insert
(case (intern engine)
('dbi "/format partbox\n")
(t ""))
(org-babel-expand-body:sql body params)))
(message command)
(shell-command command)
(if (or (member "scalar" result-params)