2018-08-31 13:22 GMT+02:00 Robert Klein <roklein@roklein.de>:
On Fri, 31 Aug 2018 12:24:33 +0200
Cecil Westerhof <cldwesterhof@gmail.com> wrote:

> 2018-08-31 11:17 GMT+02:00 Robert Klein <roklein@roklein.de>:
>
> > Hi Cecil,
> >
> > On Fri, 31 Aug 2018 10:47:50 +0200
> > Cecil Westerhof <cldwesterhof@gmail.com> wrote:
> > 
> > > I have a strange problem with org-babel and SQLite.
> > >
> > > I have a database that is created with:
> > >     CREATE TABLE "quotes" (
> > >         quoteID         TEXT           PRIMARY KEY,
> > >         quote           TEXT NOT NULL  UNIQUE,
> > >         lastUsed        TEXT,
> > >         totalUsed       INT  DEFAULT 'unused'
> > >     )
> > >
> > > When using:
> > >     #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames yes
> > >     SELECT   lastUsed
> > >     ,        totalUsed
> > >     FROM     quotes
> > >     ORDER BY lastused  ASC
> > >     ,        totalUsed DESC
> > >     LIMIT    40
> > >     #+END_SRC
> > >
> > > Everything is fine. But when I use (add the quote field in the
> > > select): #+BEGIN_SRC sqlite :db
> > > ~/Twitter/twitter.sqlite :colnames yes SELECT   quote
> > >     ,        lastUsed
> > >     ,        totalUsed
> > >     FROM     quotes
> > >     ORDER BY lastused  ASC
> > >     ,        totalUsed DESC
> > >     LIMIT    40
> > >     #+END_SRC
> > >
> > > I get:
> > >     executing Sqlite code block...
> > >     Wrote /tmp/babel-27920y_/ob-input-2792BTG
> > >     org-babel-read: End of file during parsing
> > >
> > > What could be the problem?
> > > 
> >
> > does it work outside of org/babel/emacs, that is, when you use the
> > query in a command line sqlite session, does it work?  “quote” is
> > also a function in sqlite, so this might be your issue.
> > 
>
> Yes, in sqlite3 and sqlitebrowser it works without problems.
> In org-babel even 'SELECT *' goes wrong.
>

I can't reproduce the issue, it works for me.  What are your org-mode
and Emacs versions?

GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian
Org-mode version 8.2.10 (release_8.2.10 @ /usr/share/emacs/25.1/lisp/org/)
 

Can you provide an ECM (Example, complete, minimal) org-mode setup /
Emacs initialization file?
 
(add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)

; Make babel results blocks lowercase
(setq org-babel-results-keyword "results")

(defun bh/display-inline-images ()
  (condition-case nil
      (org-display-inline-images)
    (error nil)))

(org-babel-do-load-languages
 (quote org-babel-load-languages)
 (quote ((emacs-lisp . t)
         (sqlite . t)
         (dot . t)
         (ditaa . t)
         (R . t)
         (python . t)
         (ruby . t)
         (gnuplot . t)
         (clojure . t)
         (sh . t)
         (ledger . t)
         (org . t)
         (plantuml . t)
         (latex . t))))

; Do not prompt to confirm evaluation
; This may be dangerous - make sure you understand the consequences
; of setting this -- see the docstring for details
(setq org-confirm-babel-evaluate nil)

; Use fundamental mode when editing plantuml blocks with C-c '
(add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))

Is this what you need, or do you need more?

--
Cecil Westerhof