emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* sql code block #+BEGIN_SRC sql :tangle qry/testthis.sql :cmdline "-v this=\\'asdf\\'"
@ 2019-09-03 23:42 Cook, Malcolm
  0 siblings, 0 replies; only message in thread
From: Cook, Malcolm @ 2019-09-03 23:42 UTC (permalink / raw)
  To: Org-mode

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-03 23:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-03 23:42 sql code block #+BEGIN_SRC sql :tangle qry/testthis.sql :cmdline "-v this=\\'asdf\\'" Cook, Malcolm

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).