Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i repeat last sql command executed in sqlite command line?

I am using android sqlite3 command line tool. How do I repeat the last command that I executed (similar to the / in sqlplus)? Tried up arrow and . - both didnt work. I am on Mac :(

like image 563
bschandramohan Avatar asked Feb 25 '11 09:02

bschandramohan


People also ask

Which command in SQLite is used to enter a record in a table?

In SQLite, the INSERT INTO statement is used to add new rows of data into a table. After you create the table, this command is used to insert records into the table. You can view the output by using the SELECT statement.

Which of the following commands are used to format the output in SQLite?

The sqlite3 program is able to show the results of a query in eight different formats: "csv", "column", "html", "insert", "line", "list", "tabs", and "tcl". You can use the ". mode" dot command to switch between these output formats.

Which command is used in SQLite for help?

Check the list of dot commands by using the ". help" at anytime. For example: Sqlite> .

How do I end SQLite?

You can terminate the sqlite3 program by typing your systems End-Of-File character (usually a Control-D). Use the interrupt character (usually a Control-C) to stop a long-running SQL statement.


1 Answers

I now fall into the same problem.

When I type up, it prints ^[[A.

when I type left, it prints ^[[D. And it is similar to down and right

And I found this question( Sqlite using command line) and solove it.

First, rename the sqlite3 to sqlite3_bak in android tools to make it disable, or you can directly remove it, if you can make sure you will not use it again.

Second, download the "autoconf" source from http://www.sqlite.org/download.html (second link, currently to http://www.sqlite.org/sqlite-autoconf-3071502.tar.gz ):

then cd to the decompressed directory and compile it via the terminal

$ ./configure
$ make
$ sudo make install

Third, put your "new sqlite3 binary" to /opt/local/bin directory or set a soft-link to this file. And source your .bash_profile or .bashrc.

like image 115
pktangyue Avatar answered Oct 03 '22 03:10

pktangyue