emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Cook, Malcolm" <MEC@stowers.org>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: sql code block #+BEGIN_SRC sql :tangle qry/testthis.sql :cmdline "-v this=\\'asdf\\'"
Date: Tue, 3 Sep 2019 23:42:44 +0000	[thread overview]
Message-ID: <DM5PR20MB2039F66405FAB4AE04E93D10BEB90@DM5PR20MB2039.namprd20.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]



I am surprised by the level of quoting seemingly required by org-mode to pass a variable to psql in :cmdline



The following works:



#+PROPERTY: header-args:sql :engine postgresql :dbhost  my.host :database mydb :dbuser me

#+PROPERTY: header-args:sql+ :tangle no :results table :exports both

#+BEGIN_SRC sql :cmdline "-v this=\\'that\\'"

select :this as this

#+END_SRC



#+RESULTS:

| this |

|------|

| that |





However, I found no other quote/escape combination to work.  At first I expected to work:



:cmdline "-v this=\'asdf\'"



... but it is an error.



Is this expected and consistent with other emacs behavior?



Is there another, perhaps simpler, way to pass variables to postgresql  code block in org ob-sql?



Thanks,



Malcolm

[-- Attachment #2: Type: text/html, Size: 4314 bytes --]

                 reply	other threads:[~2019-09-03 23:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM5PR20MB2039F66405FAB4AE04E93D10BEB90@DM5PR20MB2039.namprd20.prod.outlook.com \
    --to=mec@stowers.org \
    --cc=emacs-orgmode@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).