开发者

How is advised to use the contentResolver's delete method to be injection safe?

开发者 https://www.devze.com 2022-12-21 05:10 出处:网络
You can delete with content resolver by URI or by passing some parameters to the where parameter开发者_Go百科.

You can delete with content resolver by URI or by passing some parameters to the where parameter开发者_Go百科.

How do you make the parameters to be SQL Injection Safe?

Is it possible to use Prepared Statements with ContentResolver?

act.getContentResolver().delete(myuriwithid,null,null);

act.getContentResolver().delete(mybaseuri," name = '"+this.name"'",null);


Use positional parameters.

public final int delete (Uri url, String where, String[] selectionArgs)

e.g.

ContentResolver cr = ...;
String where = "nameid=?";
String[] args = new String[] { "george" };
cr.delete( Stuff.CONTENT_URI, where, args );
0

精彩评论

暂无评论...
验证码 换一张
取 消