Я использую sqllite для своего поискового модуля. Я выбираю несколько значений состояния в sqllite, используя приведенный ниже код. Ошибка возникает во время выполнения.Пожалуйста, помогите мне .......
Ошибка:
12-10 12:31:56.686: ERROR/AndroidRuntime(848): Uncaught handler: thread main exiting due to uncaught exception
12-10 12:31:56.686: ERROR/AndroidRuntime(848): android.database.sqlite.SQLiteException: unrecognized token: "'": , while compiling: select * from issues where Status IN (CLO,NEW)'
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at android.database.sqlite.SQLiteProgram.native_compile(Native Method)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at android.database.sqlite.SQLiteProgram.compile(SQLiteProgram.java:110)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:49)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:49)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1118)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1092)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at ez.com.Action_module_screen.setListval1(Action_module_screen.java:1062)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at ez.com.Action_module_screen$4.handleMessage(Action_module_screen.java:695)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at android.os.Handler.dispatchMessage(Handler.java:99)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at android.os.Looper.loop(Looper.java:123)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at android.app.ActivityThread.main(ActivityThread.java:4203)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at java.lang.reflect.Method.invokeNative(Native Method)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at java.lang.reflect.Method.invoke(Method.java:521)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
12-10 12:31:56.686: ERROR/AndroidRuntime(848): at dalvik.system.NativeStart.main(Native Method)
Мой код:
String sta=Search.status2;
String doc=Search.document;
String[] items=sta.split(",");
String statusFilter = " Status IN (" + items[0];
StringBuilder builder = new StringBuilder(statusFilter);
for (int j = 1; j < items.length; j++) {
builder.append(",");
builder.append(items[j]);
}
builder.append(')');
Cursor dbcur = myDB.rawQuery("select * from "+TABLE_NAME+" where " + builder.toString() + "'", null);
if(dbcur.moveToFirst())
{
int k=0;
System.out.println("enter first");
do
{
String title1=dbcur.getString(dbcur.getColumnIndex("Title"));
System.out.println("title"+title1);
String name1=dbcur.getString(dbcur.getColumnIndex("Name"));
System.out.println("name"+name1);
String open1=dbcur.getString(dbcur.getColumnIndex("Open"));
System.out.println("open"+open1);
String close1=dbcur.getString(dbcur.getColumnIndex("Close"));
System.out.println("close"+close1);
String no1=dbcur.getString(dbcur.getColumnIndex("No"));
System.out.println("no"+no1);
no.add(no1+","+k);
first.put(no1+","+k, title1);
second.put(no1+","+k,name1);
third.put(no1+","+k, open1);
fourth.put(no1+","+k,close1);
k=k+1;
mylist=sorting(no,1,true);
}while(dbcur.moveToNext());
}
dbcur.close();
myDB.close();