martes, 20 de diciembre de 2011

Using sqlite from the command line

Show and format the sql expression:
sqlite3 -separator ' ' test.db "select * from users where username='admin'" |awk {'print "username: " $1 "\npassword: " $2 '}

Insert data:
sqlite3 test.db "insert into users values ('user2','user2','test2')"
echo $?

if exit status equals zero means that everything run smoothly