diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2010-11-10 14:00:53 -0700 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2010-11-18 09:12:55 -0700 |
commit | 14b52a05fa9c0a560ed257d4dd3e1f9f6d27bfa0 (patch) | |
tree | 6c4433f2211d462a97002586a5d5f3dded996099 | |
parent | c538b0eeab5e9c62dfdc447acd9b5ce4cabd92f0 (diff) | |
download | org-mode-14b52a05fa9c0a560ed257d4dd3e1f9f6d27bfa0.tar.gz |
ob-sqlite: pass the body to the sqlite command through a pipe
* lisp/ob-sqlite.el (ob-eval): require ob-eval for external command
execution
(org-babel-execute:sqlite): no longer uses the init option for
passing commands to sqlite
-rw-r--r-- | lisp/ob-sqlite.el | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lisp/ob-sqlite.el b/lisp/ob-sqlite.el index c744e43..dd4ea87 100644 --- a/lisp/ob-sqlite.el +++ b/lisp/ob-sqlite.el @@ -28,6 +28,7 @@ ;;; Code: (require 'ob) +(require 'ob-eval) (require 'ob-ref) (declare-function org-fill-template "org" (template alist)) @@ -65,15 +66,10 @@ This function is called by `org-babel-execute-src-block'." (unless db (error "ob-sqlite: can't evaluate without a database.")) (with-temp-buffer (insert - (shell-command-to-string + (org-babel-eval (org-fill-template - "%cmd -init %body %header %separator %nullvalue %others %csv %db " + "%cmd %header %separator %nullvalue %others %csv %db " (list - (cons "body" ((lambda (sql-file) - (with-temp-file sql-file - (insert (org-babel-expand-body:sqlite body params))) - sql-file) - (org-babel-temp-file "sqlite-sql-"))) (cons "cmd" org-babel-sqlite3-command) (cons "header" (if headers-p "-header" "-noheader")) (cons "separator" @@ -90,7 +86,9 @@ This function is called by `org-babel-execute-src-block'." (member :html others) separator) "" "-csv")) - (cons "db " db))))) + (cons "db " db))) + ;; body of the code block + (org-babel-expand-body:sqlite body params))) (if (or (member "scalar" result-params) (member "html" result-params) (member "code" result-params) |