SQLite - CLI History dialogue
(1) By anonymous on 2020-12-02 11:18:59 [link] [source]
On Windows, pressing F7 in the CLI pops a dialogue box that contains all previously executed lines; if none have been executed, no dialogue box appears.
However, on selecting a particular line (by using up/down arrow to the desired line & pressing ENTER), that line is echoed to the CLI BUT it does NOT execute, neither as is nor after editing it AND typing semi-colon has no effect. What am I missing here?
(2) By Keith Medcalf (kmedcalf) on 2020-12-02 15:58:31 in reply to 1 [source]
See DOSKEY from the before times.
(3) By anonymous on 2020-12-02 16:26:02 in reply to 2 [link] [source]
I am aware of the contents of the link you provided; this does not help.
My problem is that, from the CLI,
- I can get the dialogue to pop up (F7)
- I can navigate and select particular lines (sung up/down arrow & pressing Enter
- The line I select echoes to the CLI with a line feed and it is NOT executed -typing ; and pressing Enter does nothing.
The CLI is 'supposed' to behave like the command prompt window and by and large it does. Steps 1 & 2 work with the command prompt window and Step 3 works with the Command Prompt window but NOT the SQLite window...my question is whether there is a way of overcoming this.
(4) By Larry Brasfield (LarryBrasfield) on 2020-12-02 18:53:06 in reply to 3 [link] [source]
Your supposition is bound to be disappointed as it is based on a false analogy.
The "command prompt window", (by which I presume you mean the cmd.exe program running as a process with connections to a conhost.exe (or, lately, a WindowsTerminal.exe)) process which provides a character based console-like window, makes use of features that go beyond simple reads from the stdin stream and writes to the stdout stream. The sqlite3.exe shell, built from shell.c, does very few platform specific or unique I/O.
There are several ways this could be "overcome". One would be to use the readline library (or whatever equivalents are available on Windows) instead of relying on that F7 popup feature which is unique to Windows. Provisions are already made for use of that library. (I have used them myself.) Another would be to write some code, preferably presenting the same application interface as the readline library, which would, conditionally for Windows, adapt that misplaced [a] conhost.exe functionality to effect the critical readline functions. Finally, you might persuade or shame some SQLite developer(s) into doing the latter. (I predict failure for that last option; I include it for completeness.)
[a. Putting line editing in the console is good for the crudest kind of line recall and modification, but it is the wrong place for anything as useful as context dependent token completion. So I see that as misplaced in conhost.exe and its modern successor. ]