Tim Landscheidt <[email protected]> writes: > | #+HEADERS: :var p=(completing-read "Parameter: " '("a" "b" "c")) > | #+BEGIN_SRC sql :engine postgres :cmdline --no-psqlrc -q > | BEGIN WORK; > > | \set filedata `cat /path/to/'$p'.txt` > | SELECT '$p', :'filedata'; > > | COMMIT WORK; > | #+END_SRC > > This works well unless the argument contains a character > that needs to be escaped in a PostgreSQL/Bash string, for > example "'", as Org mode inserts the argument as is. > ... > | #+HEADERS: :var pb64=(base64-encode-string (encode-coding-string > (completing-read "Parameter: " '("a" "b" "c")) 'utf-8))
What about simply shell-quote-argument instead of going rounds with encoding? -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
