Using the LIMIT statement in a SQLite query

前端 未结 3 2023
栀梦
栀梦 2020-11-27 16:38

I have a query that selects rows in a ListView without having a limit. But now that I have implemented a SharedPreferences that the user can select

3条回答
  •  情书的邮戳
    2020-11-27 17:06

    For anyone stumbling across this answer looking for a way to use a LIMIT clause with an OFFSET, I found out from this bug that Android uses the following regex to parse the limit clause of a query:

    From

    LIMIT clause is checked with following sLimitPattern.

    private static final Pattern sLimitPattern = Pattern.compile("\\s*\\d+\\s*(,\\s*\\d+\\s*)?");
    

    Note that the regex does accept the format offsetNumber,limitNumber even though it doesn't accept the OFFSET statement directly.

提交回复
热议问题