更新时间:2023-01-12 15:41:33
从API文档:
public void execSQL (String sql)
执行一个SQL语句不是SELECT或返回数据的其他SQL语句。
Execute a single SQL statement that is NOT a SELECT or any other SQL statement that returns data.
public Cursor rawQuery (String sql, String[] selectionArgs)
运行提供的SQL,并在结果集返回一个指针。
Runs the provided SQL and returns a Cursor over the result set.
如果你想例如 CREATE TABLE
不返回你可以用 execSQL()
,如果你想有一个值光标
的结果,使用 rawQuery()
(= SELECT
语句)。
If you want to e.g. CREATE TABLE
that does not return values you can use execSQL()
, if you want a Cursor
as result use rawQuery()
(=SELECT
statements).