From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: orgtbl-to-sqlinsert Date: Sun, 02 Feb 2014 13:47:16 -1000 Message-ID: References: <52EEB660.5070308@free.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WA6l8-00019j-MW for emacs-orgmode@gnu.org; Sun, 02 Feb 2014 18:47:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WA6l1-0007fN-Og for emacs-orgmode@gnu.org; Sun, 02 Feb 2014 18:47:30 -0500 Received: from oproxy19-pub.mail.unifiedlayer.com ([70.40.200.33]:43381) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1WA6l1-0007fF-Hz for emacs-orgmode@gnu.org; Sun, 02 Feb 2014 18:47:23 -0500 In-Reply-To: <52EEB660.5070308@free.fr> (Thierry Banel's message of "Sun, 02 Feb 2014 22:19:28 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Thierry Banel Cc: emacs-orgmode@gnu.org Aloha Thierry, Thierry Banel 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