user3734429
user3734429

Reputation: 322

Android ContentResolver length of value

I want to filter the Calllog only to known numbes but I get a crash in the len() function (no such function: len (code 1))

cursor = context.getContentResolver().query(CallLog.Calls.CONTENT_URI, null,
                CallLog.Calls.TYPE + "=" + CallLog.Calls.INCOMING_TYPE +
                " AND len(" + CallLog.Calls.NUMBER + ") > 3",
                null, CallLog.Calls.DATE);

Thanks for the help

Upvotes: 0

Views: 191

Answers (1)

Mohammad Zarei
Mohammad Zarei

Reputation: 1802

You should use length instead of len.

For a string value X, the length(X) function returns the number of characters (not bytes) in X prior to the first NUL character. Since SQLite strings do not normally contain NUL characters, the length(X) function will usually return the total number of characters in the string X. For a blob value X, length(X) returns the number of bytes in the blob. If X is NULL then length(X) is NULL. If X is numeric then length(X) returns the length of a string representation of X.

Upvotes: 1

Related Questions