mercredi 6 janvier 2016

execSQL: is bindargs better than?

I was wondering in the execSQL method which can take 1 or 2 arguments.
Why using the second method, if I can use an object to directly do my operation on an SQLite db?

In example:

db.execSQL("INSERT INTO "+ TableName +" VALUES (null, ?)",
        new Object[] { type.getName() })

is this better than using this

db.execSQL("INSERT INTO "+ TableName +" VALUES (null,"+  type.getName() +")")

is the 1st example more secure?
faster when executing?
easier to read...
or is it the same?

Aucun commentaire:

Enregistrer un commentaire