Книга: Beginning Android

Regular Queries

Regular Queries

The query() method takes the discrete pieces of a SELECT statement and builds the query from them. The pieces, in the order they appear as parameters to query(), are as follows:

1. The name of the table to query against

2. The list of columns to retrieve

3. The WHERE clause, optionally including positional parameters

4. The list of values to substitute in for those positional parameters

5. The GROUP BY clause, if any

6. The ORDER BY clause, if any

7. The HAVING clause, if any

These can be null when they are not needed (except the table name, of course):

String[] columns = {"ID", "inventory"};
String[] parms = {"snicklefritz"};
Cursor result = db.query("widgets", columns, "name=?",
 parms, null, null, null);

Оглавление книги


Генерация: 0.366. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз