首页 > 数据库技术 > 详细

SQLite的时候判断语句是否纯在:出现RuntimeException

时间:2014-04-14 15:43:49      阅读:462      评论:0      收藏:0      [点我收藏+]

写SQLite的时候判断语句是否纯在:

public boolean exist(long id) {
String filter = FRIEND_KEY_ID + "=" + id;
Cursor cursor = m_db.query(DATABASE_TABLE_FRIEND,
new String[]{FRIEND_KEY_ID, FRIEND_KEY_TEXT}, filter, null, null, null, null);
if (cursor != null && cursor.getCount()>0)
{
  Log.v("Database", "Exist");
  return true;
}
else {
    Log.v("Database", "Doesn‘t exist");
    return false;
  }
}

 

04-14 11:52:17.323: E/AndroidRuntime(1058): java.lang.RuntimeException: An error occured while executing doInBackground()

An Exception is checked, and a RuntimeException is unchecked.

Checked means that the compiler requires that your handle the exeception in a catch, or declare your method as throwing it (or one of it‘s ancestors).

Generally, throw a checked exception if the caller of the API is expected to handle the exception, and an unchecked exception if it is something the caller would not normally be able to handle, such as an error with one of the parameters, i.e. a programming mistake.

 

代码修改正确后实现,开始条件语句错误

SQLite的时候判断语句是否纯在:出现RuntimeException,布布扣,bubuko.com

SQLite的时候判断语句是否纯在:出现RuntimeException

原文:http://www.cnblogs.com/bruceyo/p/3663781.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!