SQLiteDatabase.SqliteMaxLikePatternLength Field

Definition

Maximum Length Of A LIKE Or GLOB Pattern The pattern matching algorithm used in the default LIKE and GLOB implementation of SQLite can exhibit O(N^2) performance (where N is the number of characters in the pattern) for certain pathological cases.

[Android.Runtime.Register("SQLITE_MAX_LIKE_PATTERN_LENGTH")]
public const int SqliteMaxLikePatternLength = 50000;
[<Android.Runtime.Register("SQLITE_MAX_LIKE_PATTERN_LENGTH")>]
val mutable SqliteMaxLikePatternLength : int

Field Value

Value = 50000
Attributes

Remarks

Maximum Length Of A LIKE Or GLOB Pattern The pattern matching algorithm used in the default LIKE and GLOB implementation of SQLite can exhibit O(N^2) performance (where N is the number of characters in the pattern) for certain pathological cases. To avoid denial-of-service attacks the length of the LIKE or GLOB pattern is limited to SQLITE_MAX_LIKE_PATTERN_LENGTH bytes. The default value of this limit is 50000. A modern workstation can evaluate even a pathological LIKE or GLOB pattern of 50000 bytes relatively quickly. The denial of service problem only comes into play when the pattern length gets into millions of bytes. Nevertheless, since most useful LIKE or GLOB patterns are at most a few dozen bytes in length, cautious application developers may want to reduce this parameter to something in the range of a few hundred if they know that external users are able to generate arbitrary patterns.

Java documentation for android.database.sqlite.SQLiteDatabase.SQLITE_MAX_LIKE_PATTERN_LENGTH.

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