On 28/01/2013 12:08 PM, Larry Brasfield wrote:
Nathan Chung wrote:
SQLite version: 3.6.12
OS: Mac OS X 10.6.8
*Summary:
The SQLite3 shell accepts some dot commands ending in semicolons while
rejecting others without displaying proper error messages. The
behavior of the dot commands could be more consistent. Examples
include "header off;" and "header on;". The shell accepts "header
off;" while rejecting "header on;" without a proper error message.
*Steps to reproduce:
1. Launch SQLite3 shell with a populated database and type in
".header on".
2. Try a select statement. The retrieved table will show the field
headers.
3. Type in ".header off;".
4. Try a select statement. The retrieved table will not show the
field headers.
5. Type in ".header on;".
6. Try a select statement. The retrieved table will still not show the
field headers. Note that the ".header on;" command from the previous
step did not generate any error messages even though the command was
rejected.
7. There may be other dot commands displaying other inconsistent
behaviors. I have only verified the issue with "header on;" and
"header off;".
The code for the shell command decoder is not written to perform as
you expect. It is very simple, (which is also a virtue), and focused
on accepting correctly composed commands. The shell is considered to
be a tool for easily performing basic operations upon a SQLite
database, in the hands of more software-savvy people than those who
would be lost without detailed and "consistent" error reporting. I
dare say that said code, if modified to meet your expectations, would
be less suited to its purpose, harder to maintain and understand, and
would divert effort from SQLite itself. I say this as one who has
found reason to modify that code and who is glad that part of the task
consumed little time.
".header on;" -- does nothing
".header off;" -- disables headers
I'm with OP on this one. The error message doesn't need to be "helpful"
-- in fact I'm fine if it accepts semicolons, given that most things you
type in the shell require them. Turning apparently-successful commands
into no-ops is never a good idea, though.
My guess is that it's trivial to fix, especially if the decision is to
allow semicolons and other trailing garbage (though `.header foo' would
still silently "succeed"). Probably a one-liner along the lines of
s/strcmp/strncmp/, or some such.
$0.02
Ryan
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users