emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: [Babel] sqlite if: End of file during parsing
@ 2012-02-15 16:37 Philip Rooke
  2012-02-15 17:59 ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Philip Rooke @ 2012-02-15 16:37 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


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

Starting from emacs -Q evaluate the following code blocks in
succession.  The #+results: blocks below are what I am seeing on my

#+begin_src emacs-lisp :results silent
  (require 'org)
  (require 'org-install)
   '((sqlite . t)
     (sh . t)))

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');

Check this worked:

#+begin_src sqlite :db ob-bug.db :results output
  select * from person;

| 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;

: 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');

Repeat the last two queries.
#+begin_src sqlite :db ob-bug.db :results output
  select * from person;

| Joe  | Bloggs |
| Fred | Smith  |


#+begin_src sqlite :db ob-bug.db :results output
  select f_name || " " || l_name from person;

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;'

: Joe Bloggs
: Fred Smith

Remove the debug database file if you want:

#+begin_src sh :results silent
  rm ob-bug.db

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


Emacs  : GNU Emacs (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:
 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)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-02-19  9:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-15 16:37 Bug: [Babel] sqlite if: End of file during parsing Philip Rooke
2012-02-15 17:59 ` Eric Schulte
2012-02-15 20:21   ` Philip Rooke
2012-02-18 21:51     ` Eric Schulte
2012-02-19  9:39       ` Philip Rooke

Code repositories for project(s) associated with this public inbox


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