emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Re: using orgtbl-sqlinsert


From: Eric Abrahamsen
Subject: [O] [PATCH] Re: using orgtbl-sqlinsert
Date: Wed, 05 Jun 2013 11:58:32 +0800
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux)

Eric Abrahamsen <address@hidden> writes:

> Eric Abrahamsen <address@hidden> writes:
>
> A very quiet "bump", to see if anyone knows how to handle this...

Clearly whining wasn't getting me anywhere, so here's a patch. I don't
claim to understand all the ins and outs of orgtbl-to-generic, so this
might not be complete, but at least it gets it working again. There were
plain old errors in the existing code (undefined variables, etc), so
this has to be an improvement, even if it's incomplete.

So with this patch, calling `org-babel-execute-src-block' on the
#+BEGIN_SRC line in the following:

#+TBLNAME: terms
| Chinese          | English                            |
|------------------+------------------------------------|
| 音像制品出版     | A/V Publishing                     |

#+NAME: insert-statements
#+BEGIN_SRC emacs-lisp :var terms=terms :wrap "SRC sqlite :db \"dbname.sqlite\""
  (orgtbl-to-sqlinsert terms '(:sqlname "terms"))
#+END_SRC

#+RESULTS: insert-statements

Produces this:

#+RESULTS: insert-statements
#+BEGIN_SRC sqlite :db "dbname.sqlite"
BEGIN TRANSACTION;
INSERT INTO terms( Chinese, English ) VALUES ( '音像制品出版' , 'A/V Publishing' );
COMMIT;
#+END_SRC


Hope all's in order.

E

Attachment: 0001-contrib-lisp-orgtbl-sqlinsert.el.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]