Cursor c=db.rawQuery(
"SELECT name FROM sqlite_master WHERE type='table' AND name='mytable'", null);
改写成Cursor c = db.query()应该是怎样呢
"SELECT name FROM sqlite_master WHERE type='table' AND name='mytable'", null);
改写成Cursor c = db.query()应该是怎样呢
调试欢乐多
table:表名。相当于select语句from关键字后面的部分。如果是多表联合查询,可以用逗号将两个表名分开。
columns:要查询出来的列名。相当于select语句select关键字后面的部分。
selection:查询条件子句,相当于select语句where关键字后面的部分,在条件子句允许使用占位符“?”
selectionArgs:对应于selection语句中占位符的值,值在数组中的位置与占位符在语句中的位置必须一致,否则就会有异常。
groupBy:相当于select语句group by关键字后面的部分
having:相当于select语句having关键字后面的部分
orderBy:相当于select语句order by关键字后面的部分,如:personid desc, age asc;
limit:指定偏移量和获取的记录数,相当于select语句limit关键字后面的部分。Cursor cursor = db.query("person", new String[]{"personid,name,age"}, "name like ?", new String[]{"%传智%"}, null, null, "personid desc", "1,2");
Cursor c = db.query("sqlite_master", new String[]{"name"}, "type=? and name=?", new String[]{table,mytable}, null, null, null);
送分了,有人没