From: tsd@tsdye.com (Thomas S. Dye)
To: Thierry Banel <tbanelwebmin@free.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: orgtbl-to-sqlinsert
Date: Sun, 02 Feb 2014 13:47:16 -1000 [thread overview]
Message-ID: <m1a9e9yt4r.fsf@tsdye.com> (raw)
In-Reply-To: <52EEB660.5070308@free.fr> (Thierry Banel's message of "Sun, 02 Feb 2014 22:19:28 +0100")
Aloha Thierry,
Thierry Banel <tbanelwebmin@free.fr> writes:
> Hi Thomas.
>
> I don't understand this behavior yet.
> But here is a workaround:
> try the #+ORGTBL: SEND feature:
> 1- Add a #+ORGTBL: SEND line
> 2- Add a BEGIN RECEIVE ORGTBL block
> 3- Type C-c C-c with cursor on the first pipe of the table
>
> --8<--------------------------->8--
> #+ORGTBL: SEND faraway orgtbl-to-sqlinsert :sqlname "foo" :fmt (1 "%s")
> | one | two |
> |-----+--------|
> | 1 | Buckle |
> | 2 | Shoe |
> | 3 | Open |
> | 4 | Door |
>
> ;; BEGIN RECEIVE ORGTBL faraway
> BEGIN TRANSACTION;
> INSERT INTO foo( one, two ) VALUES ( 1 , 'Buckle' );
> INSERT INTO foo( one, two ) VALUES ( 2 , 'Shoe' );
> INSERT INTO foo( one, two ) VALUES ( 3 , 'Open' );
> INSERT INTO foo( one, two ) VALUES ( 4 , 'Door' );
> COMMIT;
> ;; END RECEIVE ORGTBL faraway
Yes, this works.
Perhaps the table needs to be processed before it is passed to
orgtbl-to-sqlinsert?
Note that =orgtbl-to-sqlinsert= takes advantage of org-mode's applying
the formatting to each cell /before/ checking for a line-formatting
function. The header line itself and sectioning line are suppressed
with the settings
: :hlfmt (lambda (lst) (setq firstheader nil))
: :hline nil
: :remove-nil-lines t
I don't fully understand what this means, but it appears to address the
table header.
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
next prev parent reply other threads:[~2014-02-02 23:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-02 20:09 orgtbl-to-sqlinsert Thomas S. Dye
2014-02-02 21:19 ` orgtbl-to-sqlinsert Thierry Banel
2014-02-02 23:47 ` Thomas S. Dye [this message]
2014-02-04 21:18 ` orgtbl-to-sqlinsert Thierry Banel
2014-02-04 22:00 ` orgtbl-to-sqlinsert Thomas S. Dye
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1a9e9yt4r.fsf@tsdye.com \
--to=tsd@tsdye.com \
--cc=emacs-orgmode@gnu.org \
--cc=tbanelwebmin@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.