jeudi 5 mars 2015

Is it possible to execute a query against a sqlite database with a single line terminal command?

I want to perform an insert in a sqlite database, programatically from my app. I don't want to create a Database adapter, or any of that... Instead, since it's a simple statement, I thought about running a shell command.


Normally, I would do like:



# sqlite3 database.db


And then:



sqlite3> INSERT INTO table VALUES (something);


But, I would like to know if it is possible to run a query against a sqlite database in a single command?


If so, I could use the Runtime.getRuntime().exec('command') method from within my app.


Aucun commentaire:

Enregistrer un commentaire