Re: [O] Bug: [Babel] sqlite if: End of file during parsing
Eric Schulte writes: > > Thanks for the detailed reproduction information in your original email, > it made this issue much easier to solve. I've just pushed up a fix, > please let me know if the problem continues. Eric, seems to work perfectly now. Thank you so much for your help. Phil
Re: [O] Bug: [Babel] sqlite if: End of file during parsing
Philip Rooke writes: > Eric Schulte writes: > >> Does the following work with the addition of ":results scalar"? > > Yes, there is no error although the format of the result is different to > the one database line query or the equivalent shell command. This is > what happens for me: > > #+begin_src sqlite :db ob-bug.db :results output scalar > select f_name || " " || l_name from person; > #+end_src > > #+results: > : "Joe Bloggs" > : "Fred Smith" > Hi Phil, Thanks for the detailed reproduction information in your original email, it made this issue much easier to solve. I've just pushed up a fix, please let me know if the problem continues. Best, -- Eric Schulte http://cs.unm.edu/~eschulte/
Re: [O] Bug: [Babel] sqlite if: End of file during parsing
Eric Schulte writes: > Does the following work with the addition of ":results scalar"? Yes, there is no error although the format of the result is different to the one database line query or the equivalent shell command. This is what happens for me: #+begin_src sqlite :db ob-bug.db :results output scalar select f_name || " " || l_name from person; #+end_src #+results: : "Joe Bloggs" : "Fred Smith" Phil
Re: [O] Bug: [Babel] sqlite if: End of file during parsing
Does the following work with the addition of ":results scalar"? #+begin_src sqlite :db ob-bug.db :results output scalar select f_name || " " || l_name from person; #+end_src If so could you send me the contents of the results block? It appears that ob-sqlite is choking trying to parse the results into a table. Thanks, Philip Rooke writes: > 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-
[O] Bug: [Babel] sqlite if: End of file during parsing
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-ele