I have a ContentProvider, and I would like to make a query that returns the rows of a table where the values of a specific column is not null. In SQL you can use the column IS NOT NULL
, but I cannot figure out what is the equivalent statement in case of ContentProviders.
I have tried so far:
SQL like syntax.
getContentProvider().query(uri,
null,
Contract.Table.COLUMN + " is not null",
null,
null);
SQL like syntax with selection arguments.
getContentProvider().query(uri,
null,
Contract.Table.COLUMN + " is not null",
new String[0],
null);
Is on equal with real null
value.
getContentProvider().query(uri,
null,
Contract.Table.COLUMN + " != ?",
new String[]{null},
null);
Is not equal with "null"
string.
getContentProvider().query(uri,
null,
Contract.Table.COLUMN + " != ?",
new String[]{"null"},
null);
Thank you!
ContentProvider
s are not standardized. Each of them may interpret query parameters in any given way. (In fact, most content providers only use a few parameters at all.)