zoukankan      html  css  js  c++  java
  • SQLite的时候判断语句是否纯在:出现RuntimeException

    写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.

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

  • 相关阅读:
    Django REST Framework
    Django REST Framework 序列化和校验 知识点
    Django REST Framework 数码宝贝
    浏览器的跨域解决方案
    Django Rest Framework 简介及 初步使用
    javaScript
    jQuery 事件流的概念
    jQuery 文档操作
    Django
    crm 系统项目(三) 业务
  • 原文地址:https://www.cnblogs.com/bruceyo/p/3663781.html
Copyright © 2011-2022 走看看