简体   繁体   English

如何在Java中读取SQLite查询结果

[英]How can read SQLite query result in java

How can read the following result in java? 如何在Java中读取以下结果?

I would like your help. 需要您的帮助。

Strint query = select case when exists (select * from [entry] where title='Hanim') then cast (1 as bit) else cast (0 as bit) end
Cursor cursor = mdb.rawQuery(query,null);
cursor.moveToFirst();
cursor.getInt(cursor.getColumnIndex(query));
if (cursor.moveToFirst()){
 do{
  String data = cursor.getString(cursor.getColumnIndex("data"));
 .
 .              // do something you need
 }while(cursor.moveToNext());
 }
   cursor.close();
String query="select case when exists 
(select * from [entry] 
where title='Hanim') 
then cast (1 as bit) else cast (0 as bit) end
as [result]"
Cursor cursor=mdb.rawQuery(query,null);
int cIX=cursor.getColumnIndex("result");
data=cursor.getString(cIX);

if we dont add a beer we can not read with java. 如果不添加啤酒,则无法使用Java读取。 for this reason the as [result] was added to the title. 因此,将as [结果]添加到标题中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM