To edit in sqlite3 CLI multiline SQL statements?

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

To edit in sqlite3 CLI multiline SQL statements?

csanyipal
Hello,

can one edit a multiline SQL statement in the sqlite3 CLI?

Say I entered the following multiline SQL statement:

sqlite> SELECT 1 UNION ALL
    ...> SELECT 2 UNION ALL
    ...> SELECT 3
    ...> ;

Then after a while I want to run it again, then how can I use the bash
history to get back my multiline SQL statement, to eventually modify it
and re-run it again?

Is there a way to do this in sqlite3 CLI?

--
Best, Paul Chany
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Best, Pál
Reply | Threaded
Open this post in threaded view
|

Re: To edit in sqlite3 CLI multiline SQL statements?

Simon Slavin-3
On 18 Jan 2020, at 9:30pm, Csanyi Pal <[hidden email]> wrote:

> can one edit a multiline SQL statement in the sqlite3 CLI?

No.

But if you make a multiline SQL statement in a text file you can paste it into the CLI all in one operation.
_______________________________________________
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: To edit in sqlite3 CLI multiline SQL statements?

Keith Medcalf
In reply to this post by csanyipal

While there are lines to be edited:
  Press up arrow until line is recalled
  Edit the line
  Press the ENTER key to enter that line

Maybe you have to compile your own to include readline (on Linux), but it works for me.  Both Linux and Windows.

--
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.

>-----Original Message-----
>From: sqlite-users <[hidden email]> On
>Behalf Of Csanyi Pal
>Sent: Saturday, 18 January, 2020 14:31
>To: [hidden email]
>Subject: [sqlite] To edit in sqlite3 CLI multiline SQL statements?
>
>Hello,
>
>can one edit a multiline SQL statement in the sqlite3 CLI?
>
>Say I entered the following multiline SQL statement:
>
>sqlite> SELECT 1 UNION ALL
>    ...> SELECT 2 UNION ALL
>    ...> SELECT 3
>    ...> ;
>
>Then after a while I want to run it again, then how can I use the bash
>history to get back my multiline SQL statement, to eventually modify it
>and re-run it again?
>
>Is there a way to do this in sqlite3 CLI?
>
>--
>Best, Paul Chany
>_______________________________________________
>sqlite-users mailing list
>[hidden email]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
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: To edit in sqlite3 CLI multiline SQL statements?

Jose Isaias Cabrera-4
In reply to this post by Simon Slavin-3

Simon Slavin, on Saturday, January 18, 2020 04:58 PM, wrote...
>
> On 18 Jan 2020, at 9:30pm, Csanyi Pal, on
>
> > can one edit a multiline SQL statement in the sqlite3 CLI?
>
> No.
>
> But if you make a multiline SQL statement in a text file you can paste it into the CLI all in one operation.

Well, you could, but you need to hit the up arrow for every new line in that multiline, and edit the line. But, I agree with Simon: the best way to do it, is to use some text editor, and make the changes in the text editor and copy and paste to the CLI. Thanks.

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