After a lengthy, fruitless search for an option to make the sqlite3
shell do this, I've modified shell.c to emit a column header row, (after
.headers ON), even when the result set is empty.
The reason for this is to facilitate creation of tab-separated-value,
column-name-headed, text tables for import elsewhere. It bugged me a
lot that the shell came so close to being able to do it but seemed to
treat an empty result as a special case. (It presently will never emit
a header when there are 0 result rows.)
Having done this work, in a careful manner, I wonder if I should offer a
shell.c patch to make it available for others. I imagine this has
bothered others with similar purposes and expectations. Alternatively,
maybe somebody can briefly explain why it's really fine to sometimes get
nothing when headers have been requested, in a non-interactive context.
To retain the old behavior with previously valid input, this behavior
could be kludgedly activated by adding a third argument value for the
.headers command, "ALWAYS" in addition to "ON" and "OFF". Or a
compile-time switch may be better. (cleaner, certainly) I have neither
in place now because I never want to not see a header after entering
.headers ON .
Even if nobody is much interested now, I'll be happy to provide this to
anybody who stumbles across this post in the archives during a similar
(but not so fruitless) search. Just decode my email address and use it.
Cheers,
--
Larry Brasfield
firstinitial.lastn...@something.org
where computer is really something.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users