emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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/)]
@ 2020-11-26 20:46 Philipp Uhl
  0 siblings, 0 replies; only message in thread
From: Philipp Uhl @ 2020-11-26 20:46 UTC (permalink / raw)
  To: emacs-orgmode



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



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

only message in thread, other threads:[~2020-11-26 22:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 20:46 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/)] Philipp Uhl

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