parseSqliteSelector function
Parses the table/query selector tail of a SQLite path (omp's
parseSqliteSelector). Throws StateError with omp's messages on
unsupported combinations.
Implementation
SqliteSelector parseSqliteSelector(String subPath, String queryString) {
final normalizedSubPath = subPath.replaceFirst(RegExp('^:+'), '').trim();
final params = Uri.splitQueryString(queryString);
final rawSelector = _parseRawQuerySelector(normalizedSubPath, params);
if (rawSelector != null) return rawSelector;
if (normalizedSubPath.isEmpty) {
if (params.isNotEmpty) {
throw StateError(
'SQLite query parameters require a table selector or q=SELECT...',
);
}
return const SqliteListSelector();
}
return _parseTableSelector(normalizedSubPath, params);
}