From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Cook, Malcolm" Subject: sql code block #+BEGIN_SRC sql :tangle qry/testthis.sql :cmdline "-v this=\\'asdf\\'" Date: Tue, 3 Sep 2019 23:42:44 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_DM5PR20MB2039F66405FAB4AE04E93D10BEB90DM5PR20MB2039namp_" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:51913) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5IXq-0007mm-Ph for emacs-orgmode@gnu.org; Tue, 03 Sep 2019 19:49:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5IXo-0005RV-Q5 for emacs-orgmode@gnu.org; Tue, 03 Sep 2019 19:49:06 -0400 Received: from us-smtp-delivery-170.mimecast.com ([216.205.24.170]:40047) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5IXo-0005Qx-GR for emacs-orgmode@gnu.org; Tue, 03 Sep 2019 19:49:04 -0400 Content-Language: en-US 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" To: Org-mode --_000_DM5PR20MB2039F66405FAB4AE04E93D10BEB90DM5PR20MB2039namp_ Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable I am surprised by the level of quoting seemingly required by org-mode to pa= ss a variable to psql in :cmdline The following works: #+PROPERTY: header-args:sql :engine postgresql :dbhost my.host :database m= ydb :dbuser me #+PROPERTY: header-args:sql+ :tangle no :results table :exports both #+BEGIN_SRC sql :cmdline "-v this=3D\\'that\\'" select :this as this #+END_SRC #+RESULTS: | this | |------| | that | However, I found no other quote/escape combination to work. At first I exp= ected to work: :cmdline "-v this=3D\'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 cod= e block in org ob-sql? Thanks, Malcolm --_000_DM5PR20MB2039F66405FAB4AE04E93D10BEB90DM5PR20MB2039namp_ Content-Type: text/html; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable

 

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 m= e

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

#+BEGIN_SRC sql :c= mdline "-v this=3D\\'that\\'"

select :this as this

#+END_SRC

 

#+RESULTS:

| this |

|------|

| that |

 

 

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

 

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

 

… but it is an error.

 

Is this expected and consistent with other emacs = behavior? 

 

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

 

Thanks,

 

Malcolm

--_000_DM5PR20MB2039F66405FAB4AE04E93D10BEB90DM5PR20MB2039namp_--