안드로이드 데이터 베이스에 질의 하기입니다.
Cursor
android.database.sqlite.SQLiteDatabase.query(boolean distinct, String table,
String[] columns, String selection, String[] selectionArgs, String groupBy,
String having, String orderBy, String limit)
public Cursor query (boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)
Since: API Level 1
Query the given URL, returning a Cursor over the result set.
Parameters
distinct | true if you want each row to be unique, false otherwise. 결과 셋이 유일한 값만 가져야 되는지 여부 결정하는 선택적 boolean 값 |
---|---|
table | The table name to compile the query against. 질의할 테이블 이름. |
columns | A list of which columns to return. Passing null will return all columns,
which is discouraged to prevent reading data from storage that isn't going to be
used. 결과 셋에 포함될 열들이 나열될 스트링 배열. |
selection | A filter declaring which rows to return, formatted as an SQL WHERE clause
(excluding the WHERE itself). Passing null will return all rows for the given
table. "WHERE" 구문이라 생각하면 될듯. 와일드 카드"?"가 포함될 수 있다. |
selectionArgs | You may include ?s in selection, which will be replaced by the values from
selectionArgs, in order that they appear in the selection. The values will be
bound as Strings. "WHERE" 구문에 있었던 와일드 카드 "?"를 대체할 선택 인자 문자열 배열. |
groupBy | A filter declaring how to group rows, formatted as an SQL GROUP BY clause
(excluding the GROUP BY itself). Passing null will cause the rows to not be
grouped. 그룹바이 구문. |
having | A filter declare which row groups to include in the cursor, if row grouping
is being used, formatted as an SQL HAVING clause (excluding the HAVING itself).
Passing null will cause all row groups to be included, and is required when row
grouping is not being used. 그룹바이 시 해빙구문 |
orderBy | How to order the rows, formatted as an SQL ORDER BY clause (excluding the
ORDER BY itself). Passing null will use the default sort order, which may be
unordered. 순서 제어. |
limit | Limits the number of rows returned by the query, formatted as LIMIT clause.
Passing null denotes no LIMIT clause. 리턴되는 행 갯수 제한 LIMIT |
* 제일 앞에 distinct 및 limit 는 선택적 옵션이고 나머지는 필수이다.
Returns
- A Cursor object, which is positioned before the first entry