Shell Feature Request: spaces before dot commands

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Shell Feature Request: spaces before dot commands

nomad
[SQLite version 3.22.0 2017-11-27 17:56:14]

The SQLite shell only recognizes .dot commands without leading spaces.
For clarity I like to sometimes indent a block of SQL and change
settings or run dot commands within a transaction, e.g.:

    BEGIN
        .mode csv
        .import ...
    COMMIT;

Unfortunately at present the above are parsed as SQL statements and
don't fail until the next ";".

I would like to request a change to the parsing behaviour to recognize
"<spaces>.command" the same as ".command".

Thanks,
Mark
--
Mark Lawrence
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Shell Feature Request: spaces before dot commands

Simon Slavin-3
On 4 Mar 2020, at 12:19pm, [hidden email] wrote:

>    I like to sometimes indent a block of SQL and change
> settings or run dot commands within a transaction, e.g.:
>
>    BEGIN
>        .mode csv
>        .import ...
>    COMMIT;

Dot commands are not SQL commands, they are instructions to the shell application.  Transactions, CASE structures, WITH structures, and other such things do not affect them.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Shell Feature Request: spaces before dot commands

nomad
On Wed Mar 04, 2020 at 12:44:09PM +0000, Simon Slavin wrote:
> On 4 Mar 2020, at 12:19pm, [hidden email] wrote:
>
> >    I like to sometimes indent a block of SQL and change
> > settings or run dot commands within a transaction, e.g.:
> >
> >    BEGIN
> >        .mode csv
> >        .import ...
> >    COMMIT;

> Dot commands are not SQL commands, they are instructions to the shell
> application.  Transactions, CASE structures, WITH structures, and
> other such things do not affect them.

Well commands like .import create a table. Since SQLite supports
transactional DDL there is certainly a relevance between BEGIN/COMMIT
and a call to .import, no?

But that is all kind of beside my point: I do not see a technical
necessity for dot commands to have no leading space, and my programming
experience would be better of without that requirement.

--
Mark Lawrence
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users