我必须做什么来实现的SQLite的rawQuery()方法? [英] What must I do to implement SQLite's rawQuery() method?
问题描述
我试图使用SQLite rawQuery方法的基础上,code位置:
I'm trying to use the SQLite rawQuery method, based on the code here:
...但我得到*的方法rawQuery(字符串,字符串[])是未定义的类型OdaaDBOpenHelper
Authorize_Activity_DynamicControls.java *这个code:
...but I get "*The method rawQuery(String, String[]) is undefined for the type OdaaDBOpenHelper Authorize_Activity_DynamicControls.java*" with this code:
OdaaDBOH = new OdaaDBOpenHelper(this);
. . .
private boolean RecordExists(String _id) {
// This:
Cursor cursor = OdaaDBOH.rawQuery("select 1 from NAPOLEON_DYNAMITE_TABLE where _id=%s",
// or this:
//Cursor cursor = OdaaDOdaaDBOpenHelperBOH.rawQuery("select 1 from
NAPOLEON_DYNAMITE_TABLE where _id=%s",
new String[] { _id });
boolean exists = (cursor.getCount() > 0);
cursor.close();
return exists;
}
. . .
// from referenced unit:
public class OdaaDBOpenHelper extends SQLiteOpenHelper {
我它既使用我SQLiteOpenHelper派生类的实例名称,并使用类试
名字本身(在上面的code注释掉)。
I tried it both using the instance name of my SQLiteOpenHelper-derived class, and using the class name itself (commented out in the code above).
我必须做什么来实现rawQuery()或导致其被认可/承认?
What must I do to implement rawQuery() or cause it to be recognized/acknowledged?
推荐答案
从这个问题的正确答案:
From that question correct answer:
的考虑到MDB是你SqlLiteDatabase类... 的
OdaaDBOH 应的一个实例 SQLiteDatabase
如果你想使用 rawQuery
就可以了,最有可能您所提供的实施 SQLiteOpenHelper
在那里,这当然没有一个方法 rawQuery
。
OdaaDBOH should be an instance of a SQLiteDatabase
if you want to use rawQuery
on it, most likely you are providing the implementation of a SQLiteOpenHelper
there, which of course doesn't have a method rawQuery
.
这篇关于我必须做什么来实现的SQLite的rawQuery()方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!