From: Philip Rooke <phil@yax.org.uk>
To: emacs-orgmode@gnu.org
Subject: Bug: [Babel] sqlite if: End of file during parsing
Date: Wed, 15 Feb 2012 16:37:31 +0000 [thread overview]
Message-ID: <m2bop0t5mc.fsf@bo.sak.lan> (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
http://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------
(Warning, this is the first time I have tried to use org babel and so
there could be user error in the following. Sorry if that is the
case.)
Starting from emacs -Q evaluate the following code blocks in
succession. The #+results: blocks below are what I am seeing on my
system.
#+begin_src emacs-lisp :results silent
(require 'org)
(require 'org-install)
(org-babel-do-load-languages
'org-babel-load-languages
'((sqlite . t)
(sh . t)))
#+end_src
The next block will create a small 2k file, ob-bug.db, in the current
directory. You will probably want to delete later.
#+begin_src sqlite :db ob-bug.db :results silent
drop table if exists person;
create table person (f_name text, l_name text);
insert into person (f_name, l_name) values ('Joe', 'Bloggs');
#+end_src
Check this worked:
#+begin_src sqlite :db ob-bug.db :results output
select * from person;
#+end_src
#+results:
| Joe | Bloggs |
Formatting the name using the sqlite string concat operator ||
also works as expected:
#+begin_src sqlite :db ob-bug.db :results output
select f_name || " " || l_name from person;
#+end_src
#+results:
: Joe Bloggs
Add a second line of data:
#+begin_src sqlite :db ob-bug.db :results output silent
insert into person (f_name, l_name) values ('Fred', 'Smith');
#+end_src
Repeat the last two queries.
#+begin_src sqlite :db ob-bug.db :results output
select * from person;
#+end_src
#+results:
| Joe | Bloggs |
| Fred | Smith |
but...
#+begin_src sqlite :db ob-bug.db :results output
select f_name || " " || l_name from person;
#+end_src
errors with the unhelpful message "if: End of file during parsing"
Although the query works from a shell:
#+begin_src sh :results output
sqlite3 ob-bug.db 'select f_name || " " || l_name from person;'
#+end_src
#+results:
: Joe Bloggs
: Fred Smith
Remove the debug database file if you want:
#+begin_src sh :results silent
rm ob-bug.db
#+end_src
(toggle-debug-on-error) offers no information and so I have tried edebug
stepping through the code. It seems that the error is happening in the
function org-babel-read at line 2335 when it tries to evaluate
(read "\"Joe").
The query at first ran successfully when there was just one line of
data in the database and stepping through that query shows that the
string being passed through org-babel-read is "Joe Bloggs" rather than
"\"Joe" and therefore follows a different code path at line 2334.
At this point I am stuck.
Phil
Emacs : GNU Emacs 24.0.92.1 (i386-apple-darwin10.8.0, NS apple-appkit-1038.36)
of 2012-01-28 on bo
Package: Org-mode version 7.8.03 (release_7.8.03.346.gf9c4)
current state:
==============
(setq
org-export-preprocess-before-selecting-backend-code-hook '(org-beamer-select-beamer-code)
org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe)
org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook)
org-occur-hook '(org-first-headline-recenter)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-export-preprocess-before-normalizing-links-hook '(org-remove-file-link-modifiers)
org-confirm-shell-link-function 'yes-or-no-p
org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc org-beamer-auto-fragile-frames org-beamer-place-default-actions-for-lists)
org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-babel-pre-tangle-hook '(save-buffer)
org-mode-hook '((lambda nil (org-add-hook (quote change-major-mode-hook) (quote org-show-block-all) (quote append) (quote local)))
(lambda nil (org-add-hook (quote change-major-mode-hook) (quote org-babel-show-result-all) (quote append) (quote local)))
org-babel-result-hide-spec org-babel-hide-all-hashes)
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
org-export-latex-format-toc-function 'org-export-latex-format-toc-default
org-export-blocks '((src org-babel-exp-src-block nil) (export-comment org-export-blocks-format-comment t) (ditaa org-export-blocks-format-ditaa nil)
(dot org-export-blocks-format-dot nil))
org-export-first-hook '(org-beamer-initialize-open-trackers)
org-export-interblocks '((src org-babel-exp-non-block-elements))
org-confirm-elisp-link-function 'yes-or-no-p
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-babel-load-languages '((sqlite . t) (sh . t))
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
)
next reply other threads:[~2012-02-15 16:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-15 16:37 Philip Rooke [this message]
2012-02-15 17:59 ` Bug: [Babel] sqlite if: End of file during parsing Eric Schulte
2012-02-15 20:21 ` Philip Rooke
2012-02-18 21:51 ` Eric Schulte
2012-02-19 9:39 ` Philip Rooke
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=m2bop0t5mc.fsf@bo.sak.lan \
--to=phil@yax.org.uk \
--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).