10

URI によって、またはいくつかのパラメーターを where パラメーターに渡すことによって、コンテンツ リゾルバーで削除できます。

パラメータを SQL インジェクションセーフにするにはどうすればよいですか?
ContentResolver でプリペアド ステートメントを使用することは可能ですか?

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

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

1 に答える 1

18

定位置パラメーターを使用します。

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

例えば

ContentResolver cr = ...;
String where = "nameid=?";
String[] args = new String[] { "george" };
cr.delete( Stuff.CONTENT_URI, where, args );
于 2010-02-27T09:01:11.310 に答える