summaryrefslogtreecommitdiff
path: root/lisp/ob-sqlite.el
diff options
context:
space:
mode:
authorSebastien Delafond <seb@debian.org>2013-12-29 17:44:50 +0100
committerSébastien Delafond <sdelafond@gmail.com>2014-07-13 13:35:31 +0200
commit6c5e25df62a8618951b30a669f875a93c7944e0b (patch)
treeddae85aa6440f29d4d0b4efa5ffa3d656900a8e8 /lisp/ob-sqlite.el
parent489f1deda8d0ec93810c342b427c1920b8c47cbb (diff)
parent52fbfeb04b10aa78f24f339a352fe1161c0b37e4 (diff)
Imported Debian patch 8.2.4-1
Diffstat (limited to 'lisp/ob-sqlite.el')
-rw-r--r--lisp/ob-sqlite.el25
1 files changed, 12 insertions, 13 deletions
diff --git a/lisp/ob-sqlite.el b/lisp/ob-sqlite.el
index 84d4688..fcfdb8e 100644
--- a/lisp/ob-sqlite.el
+++ b/lisp/ob-sqlite.el
@@ -114,23 +114,22 @@ This function is called by `org-babel-execute-src-block'."
(defun org-babel-sqlite-expand-vars (body vars)
"Expand the variables held in VARS in BODY."
+ ;; FIXME: Redundancy with org-babel-sql-expand-vars!
(mapc
(lambda (pair)
(setq body
(replace-regexp-in-string
- (format "\$%s" (car pair))
- ((lambda (val)
- (if (listp val)
- ((lambda (data-file)
- (with-temp-file data-file
- (insert (orgtbl-to-csv
- val '(:fmt (lambda (el) (if (stringp el)
- el
- (format "%S" el)))))))
- data-file)
- (org-babel-temp-file "sqlite-data-"))
- (if (stringp val) val (format "%S" val))))
- (cdr pair))
+ (format "\$%s" (car pair)) ;FIXME: "\$" == "$"!
+ (let ((val (cdr pair)))
+ (if (listp val)
+ (let ((data-file (org-babel-temp-file "sqlite-data-")))
+ (with-temp-file data-file
+ (insert (orgtbl-to-csv
+ val '(:fmt (lambda (el) (if (stringp el)
+ el
+ (format "%S" el)))))))
+ data-file)
+ (if (stringp val) val (format "%S" val))))
body)))
vars)
body)