samedi 28 novembre 2015

Inserting JSON into an SQLite Database (Issue with double quotes)? [duplicate]

This question already has an answer here:

So I have this issue where I take a JSON string from an api search and I want to store that string in my database. This is stored in the 'json' variable. The trouble is, nothing is being passed into the database.

I believe that this is because of how the engine is parsing quotes. I am using android studio.

Cursor c = db.rawQuery("INSERT INTO past_searches (query, json) VALUES ('"+query+"','"+json+"')", null);

Any suggestions?

Aucun commentaire:

Enregistrer un commentaire