lundi 31 août 2015

SQLite: Escaping Special Characters

Is there a common way within Android to escape all of the characters that aren't allowed in a SQLite database? For instance, "You\'Me'". Instead of me figuring out every single character that has isn't allowed and creating a bunch or replace statements. I'm looking for something like the following.

value = SQLite.escapeString(value);
// insert data
//Retrieve data
value = SQLite.unescapeString(cursor.getString(0));

Is this wishful thinking or is there something out there already that solves this?

Aucun commentaire:

Enregistrer un commentaire