nikclayton

Mastodon: https://mastodon.social/@nikclayton

Posting this so that I can find it again, as apparently no one else has ever had this problem.

tl;dr: If you use #Windows, #Emacs, #sql-mode, and #SQLite, make sure you set the Emacs variable sql-sqlite-options to include the value -interactive.

If you don't do this (at least on my system) then the sqlite3.exe binary appears to buffer output. Then, when using sql-mode the sqlite> prompt is never shown. You can still type in SQL queries, they'll be executed and you get the results.

However, this breaks ob-sql-mode. Trying to use it interactively (by evaluating a code block) shows the error "No prompt found or `comint-prompt-regexp' not set properly").

The same error is shown when running the tests, with e.g.,:

% "c:\Program Files\Emacs\bin\emacs.exe" -batch -l ert -l ob-sql-mode-test.el  -f ert-run-tests-batch-and-exit
...
Test test-simple-select condition:
    (error "No prompt found or `comint-prompt-regexp' not set properly")
   FAILED  7/7  test-simple-select

Ran 7 tests, 0 results as expected, 7 unexpected (2019-02-12 20:28:23+0100)

7 unexpected results:
   FAILED  test-no-session
   FAILED  test-select-multiple-columns
   FAILED  test-select-smallint-column
   FAILED  test-select-sqlite-master
   FAILED  test-select-varchar-column
   FAILED  test-select-with-comments
   FAILED  test-simple-select

Setting the -interactive flag is sufficient to make the tests pass.

% "c:\Program Files\Emacs\bin\emacs.exe" -batch -l ert -l ob-sql-mode-test.el --eval="(add-to-list 'sql-sqlite-options \"-interactive\")" -f ert-run-tests-batch-and-exit
...
Ran 7 tests, 7 results as expected (2019-02-12 20:30:30+0100)