Beispiel #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;
  }
Beispiel #2
0
 @Override
 protected void cancelWorks() {
   if (requestWorker != null && params.isCancelFast()) {
     requestWorker.interrupt();
   }
   IOUtil.closeQuietly(request);
 }
Beispiel #3
0
 @Override
 protected void onFinished() {
   if (tracker != null) {
     tracker.onFinished(request);
   }
   clearRawResult();
   IOUtil.closeQuietly(request);
   callback.onFinished();
 }
Beispiel #4
0
 @Override
 public void close() throws IOException {
   if (inputStream != null) {
     IOUtil.closeQuietly(inputStream);
   }
   if (connection != null) {
     connection.disconnect();
   }
 }
Beispiel #5
0
 private void clearRawResult() {
   if (rawResult instanceof Closeable) {
     IOUtil.closeQuietly((Closeable) rawResult);
   }
   rawResult = null;
 }