Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android examples #61

Open
4a-j opened this issue Nov 6, 2015 · 1 comment
Open

Android examples #61

4a-j opened this issue Nov 6, 2015 · 1 comment

Comments

@4a-j
Copy link

4a-j commented Nov 6, 2015

I don't know whether you'd want to list it under "Java" or "Android" -- I note that you have both "C#" and ".NET" -- but the platform provides its own database API.

The object you're running queries against can be either a ContentResolver:

Cursor result = contentResolver.query(uri, projection, selection, args, orderBy);

or an SQLiteDatabase object:

Cursor result = database.query(table, projection, selection, args, groupBy, having, orderBy);

In either case, your selection string should contain question marks, which are bound to the args array from left to right, as in this example:

static final String my_table = "users";
static final String[] my_projection = new String[] { "username", "last_login" };
String checkdate = "2015-11-01";
Cursor result = object.query(my_table, my_projection, "date(last_login) < date(?)", new String[] { checkdate }, null, null, null);

@petdance
Copy link
Owner

petdance commented Nov 6, 2015

Excellent, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants