示例#1
0
  public boolean tableIsExist() throws DbException {
    if (this.isCheckedDatabase()) {
      return true;
    }

    Cursor cursor =
        db.execQuery(
            "SELECT COUNT(*) AS c FROM sqlite_master WHERE type='table' AND name='"
                + tableName
                + "'");
    if (cursor != null) {
      try {
        if (cursor.moveToNext()) {
          int count = cursor.getInt(0);
          if (count > 0) {
            this.setCheckedDatabase(true);
            return true;
          }
        }
      } catch (Throwable e) {
        throw new DbException(e);
      } finally {
        IOUtil.closeQuietly(cursor);
      }
    }

    return false;
  }
示例#2
0
 @Override
 protected void cancelWorks() {
   if (requestWorker != null && params.isCancelFast()) {
     requestWorker.interrupt();
   }
   IOUtil.closeQuietly(request);
 }
示例#3
0
 @Override
 protected void onFinished() {
   if (tracker != null) {
     tracker.onFinished(request);
   }
   clearRawResult();
   IOUtil.closeQuietly(request);
   callback.onFinished();
 }
示例#4
0
 @Override
 public void close() throws IOException {
   if (inputStream != null) {
     IOUtil.closeQuietly(inputStream);
   }
   if (connection != null) {
     connection.disconnect();
   }
 }
示例#5
0
 private void clearRawResult() {
   if (rawResult instanceof Closeable) {
     IOUtil.closeQuietly((Closeable) rawResult);
   }
   rawResult = null;
 }