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