[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: [BUG] ob-sqlite.el, -init doesn't work with some optio
Re: [Orgmode] Re: [BUG] ob-sqlite.el, -init doesn't work with some options
Wed, 10 Nov 2010 14:03:21 -0700
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
Please try out the attached patch which pushed code block bodies to the
sqlite command using org-babel-eval (which itself uses the
This patch works for me. If it works for you and solves your issue,
then I'll push it through to the Org-mode core.
Much Thanks -- Eric
>From 9adf6cd33421882f351e8ca8fa56a037b665f619 Mon Sep 17 00:00:00 2001
From: Eric Schulte <address@hidden>
Date: Wed, 10 Nov 2010 14:00:53 -0700
Subject: [PATCH] ob-sqlite: pass the body to the sqlite command through a pipe
* lisp/ob-sqlite.el (ob-eval): require ob-eval for external command
(org-babel-execute:sqlite): no longer uses the init option for
passing commands to sqlite
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
@@ -28,6 +28,7 @@
(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."))
- "%cmd -init %body %header %separator %nullvalue %others %csv %db "
+ "%cmd %header %separator %nullvalue %others %csv %db "
- (cons "body" ((lambda (sql-file)
- (with-temp-file sql-file
- (insert (org-babel-expand-body:sqlite body params)))
- (org-babel-temp-file "sqlite-sql-")))
(cons "cmd" org-babel-sqlite3-command)
(cons "header" (if headers-p "-header" "-noheader"))
@@ -90,7 +86,9 @@ This function is called by `org-babel-execute-src-block'."
(member :html others) separator)
- (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)
Łukasz Stelmach <address@hidden> writes:
> "Eric Schulte" <address@hidden> writes:
>> Łukasz Stelmach <address@hidden> writes:
>>> ob-sqlite.el uses -init option to provide sqlite with a src block
>>> content, however, this prevetns sevarl options' from taking an
>>> effect. Particularly -header (and it's opposite), -csv and -header
>> Thanks for mentioning this issue and for posting a workaround.
>> Would you suggest a different method of passing the body of a sqlite
>> code block to the sqlite command? The only other options which
>> immediately occurs to me would involve =cat='ing the body of the code
>> block through a pipe to the sqlite command (which would probably only
>> work on unix systems).
> I think this is the way we are supposed to do this from sqlite's point
> of view as -init is rather somthing like rc file that prepares the
> envioronment for further work. As far as cat(1) is concerned, please
> remember that windows is alergic and doesn't keep one, it holds =type=.
> IMHO the cleanest way of pushing commands to Emacs' child's stdin is
> =shell-command-on-region=, which should work on every OS Emacs works.