游标中的冻结moveToFirst()

时间:2013-07-31 06:17:58

标签: java android cursor sqlite

API 10,Android 2.3.3

我有代码

 Cursor c = myDataBase.rawQuery("select * from linhas as l where    exists"+ 
                "(select * from linhas_ruas_ida as l1, linhas_ruas_ida as l2,ruas as r1,ruas as r2 where l1.id_linha = l2.id_linha and l1.id_rua = r1._id and l2.id_rua = r2._id and r1.nome = '"+rua1+"' and r2.nome = \""+rua2+"\" and l.codigo = l1.id_linha and l1.posicao <= l2.posicao)"+
                "or exists (select * from linhas_ruas_volta as l1, linhas_ruas_volta as l2,ruas as r1,ruas as r2 where l1.id_linha = l2.id_linha and l1.id_rua = r1._id and l2.id_rua = r2._id and r1.nome = \""+rua1+"\" and r2.nome = \""+rua2+"\" and l.codigo = l1.id_linha and l1.posicao <= l2.posicao)"+
            "or exists (select * from linhas_ruas_ida as l1, linhas_ruas_volta as l2,ruas as r1,ruas as r2 where l1.id_linha = l2.id_linha and l1.id_rua = r1._id and l2.id_rua = r2._id and r1.nome = \""+rua1+"\" and r2.nome = \""+rua2+"\" and l.codigo = l1.id_linha)",null);  

c.moveToFirst();

所以,我的应用程序冻结在c.moveToFirst()行; [我在调试模式中可以看到]

如果我更改SQL,例如

("select * from linhas as l where 1")

工作正常!!!

P.S

private SQLiteDatabase myDataBase; 

EXPLAIN SQL

0 个答案:

没有答案