Freigeben über


DatabaseUtils.AppendEscapedSQLString(StringBuilder, String) Method

Definition

Appends an SQL string to the given StringBuilder, including the opening and closing single quotes.

[Android.Runtime.Register("appendEscapedSQLString", "(Ljava/lang/StringBuilder;Ljava/lang/String;)V", "")]
public static void AppendEscapedSQLString (Java.Lang.StringBuilder? sb, string? sqlString);
[<Android.Runtime.Register("appendEscapedSQLString", "(Ljava/lang/StringBuilder;Ljava/lang/String;)V", "")>]
static member AppendEscapedSQLString : Java.Lang.StringBuilder * string -> unit

Parameters

sb
StringBuilder

the StringBuilder that the SQL string will be appended to

sqlString
String

the raw string to be appended, which may contain single quotes

Attributes

Remarks

Appends an SQL string to the given StringBuilder, including the opening and closing single quotes. Any single quotes internal to sqlString will be escaped.

This method is deprecated because we want to encourage everyone to use the "?" binding form. However, when implementing a ContentProvider, one may want to add WHERE clauses that were not provided by the caller. Since "?" is a positional form, using it in this case could break the caller because the indexes would be shifted to accomodate the ContentProvider's internal bindings. In that case, it may be necessary to construct a WHERE clause manually. This method is useful for those cases.

Java documentation for android.database.DatabaseUtils.appendEscapedSQLString(java.lang.StringBuilder, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to