emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Philipp Uhl <philipp.uhl@rwth-aachen.de>
To: <emacs-orgmode@gnu.org>
Subject: Bug: ob-sql fails to work with other source code blocks if result contains quotes [9.4 (9.4-44-g5272d9-elpa @ /home/philipp/.emacs.d/elpa/org-20201123/)]
Date: Thu, 26 Nov 2020 20:46:09 +0000	[thread overview]
Message-ID: <97dfc87b-9748-a5e2-cf4d-1aa78451607c@rwth-aachen.de> (raw)



Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See

https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

When SQL output contains " than, JS code blocks don't work.

This works:

#+NAME: test
#+BEGIN_SRC sql
select '1'
#+END_SRC


#+BEGIN_SRC js :var test=test
return test
#+END_SRC

#+RESULTS:
| 1 |


This does not:

#+NAME: test
#+BEGIN_SRC sql
select '"1"'
#+END_SRC


#+BEGIN_SRC js :var test=test
return test
#+END_SRC

#+RESULTS:


It results in this error:


/tmp/babel-vaAbSc/js-script-GZW7OY:2
var test=[[#("\"1\"" 0 3 (face font-lock-string-face))]];
^

SyntaxError: Invalid or unexpected token
at wrapSafe (node:internal/modules/cjs/loader:999:16)
at Module._compile (node:internal/modules/cjs/loader:1047:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Function.executeUserEntryPoint [as runMain] 
(node:internal/modules/run_main:72:12)
at node:internal/main/run_main_module:17:47



The expanded code looks like this:

var test=[[#("\"1\"" 0 3 (face font-lock-string-face))]];
return test


I should mention, that, in order to make JS output as a result work at
all, I have this in my config (but I don't think, it is related to this
bug):

Fix issue with javascript output due to depricated use of "sys"
package
#+BEGIN_SRC emacs-lisp
(setq org-babel-js-function-wrapper
"process.stdout.write(require('util').inspect(function(){\n%s\n}(), { 
maxArrayLength: null, maxStringLength: null, breakLength: Infinity, 
compact: true }))")
#+END_SRC



The bug does not appear when using e.g. python.

With best regards,
Philipp Uhl


Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.22, cairo version 1.17.3)
of 2020-08-28
Package: Org mode version 9.4 (9.4-44-g5272d9-elpa @ 
/home/philipp/.emacs.d/elpa/org-20201123/)



                 reply	other threads:[~2020-11-26 22:19 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=97dfc87b-9748-a5e2-cf4d-1aa78451607c@rwth-aachen.de \
    --to=philipp.uhl@rwth-aachen.de \
    --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).