lundi 2 novembre 2015

How to prevent SQL injection in android?

In my code i have to insert multiple values with a single insert query. For example INSERT INTO table_name (column_1, column_2) VALUES (value1, val1),(value2,value). To prevent sql injection i found the below sample.

SQLiteDatabase db = dbHelper.getWritableDatabase();

SQLiteStatement stmt = db.compileStatement(“SELECT * FROM Country WHERE code = ?”);

stmt.bindString(1, “India”);

stmt.execute();

But how "Complile Statement" will help in case of my code??

Aucun commentaire:

Enregistrer un commentaire