SQLite Command Line Shell -init

allora, prima di proseguire con quello che vorrei scrivere, devo assolutamente
spendere due parole…sulla Command Line Shell di sqlite.


Che dire, è semplicemente fantastica ed il giovine programmatore
deve assolutamente impadronirsene.
Primo perchè forma il carattere, e secondo perchè è leggera e potente.
Vediamo un po…qui si usa linux.
Per la fava e la rava di come aprire la SQLite Command Line Shell in tutto il
suo splendore potete tranquillamente saccheggiare il web.
Qui vi mostro alcune cosette che a me sono utili.
Cominciamo con aprire questa potentissima arma ,la line shell, con alcuni parametri già impostati
in automatico senza dover scrivere sempre cose del tipo

.headers on
.mode column
.timer on

etc etc.,
niente di piu facile,

bc@hal9000:~/bc1966$ vi setconsole
.headers on
.mode column
.timer on

il solito wq!
e quindi se facciamo così

bc@hal9000:~/bc1966$ sqlite3 test.db
SQLite version 3.7.13
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> SELECT test_id,sample_id,type_id,lowest,highest FROM halflives LIMIT 5;
1|421|526|519|37.8|37.8|6|518
2|420|530|519|35.0|37.0|2|517
3|264|530|519|4.0|8.0|7|522
4|264|526|519|-20.0|-20.0|1|517
5|264|526|519|20.0|25.0|1|514
sqlite>

ma se facciamo così


bc@hal9000:~/bc1966$ sqlite3 -init setconsole test.db
SQLite version 3.7.13
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> SELECT test_id,sample_id,type_id,lowest,highest FROM halflives LIMIT 5;
test_id    sample_id  type_id    lowest     highest
---------- ---------- ---------- ---------- ----------
421        526        519        37.8       37.8
420        530        519        35.0       37.0
264        530        519        4.0        8.0
264        526        519        -20.0      -20.0
264        526        519        20.0       25.0
CPU Time: user 0.000000 sys 0.000000
sqlite>

 

alla prossima

Questa voce è stata pubblicata in python, sqlite, xls. Contrassegna il permalink.

Lascia un commento