java.sql.SQLException.setNextException()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中java.sql.SQLException.setNextException()方法的一些代码示例,展示了SQLException.setNextException()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SQLException.setNextException()方法的具体详情如下:
包路径:java.sql.SQLException
类名称:SQLException
方法名:setNextException

SQLException.setNextException介绍

[英]Obsolete. Appends ex to the end of this chain.
[中]淘汰的将ex附加到此链的末端。

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Rolls up SQL exceptions by taking each proceeding exception
 * and making it a child of the previous using the <code>setNextException</code>
 * method of SQLException.
 */
public static SQLException rollupSqlExceptions(Collection<SQLException> exceptions) {
  SQLException parent = null;
  for (SQLException exception : exceptions) {
    if (parent != null) {
      exception.setNextException(parent);
    }
    parent = exception;
  }
  return parent;
}

代码示例来源:origin: robovm/robovm

/**
   * Chains a supplied {@code SQLWarning} to this {@code SQLWarning}.
   *
   * @param w
   *            the {@code SQLWarning} linked to this {@code SQLWarning}.
   */
  public void setNextWarning(SQLWarning w) {
    super.setNextException(w);
  }
}

代码示例来源:origin: robovm/robovm

/**
 * Obsolete. Appends {@code ex} to the end of this chain.
 */
public void setNextException(SQLException ex) {
  if (next != null) {
    next.setNextException(ex);
  } else {
    next = ex;
  }
}

代码示例来源:origin: org.postgresql/postgresql

@Override
public void handleError(SQLException error) {
 if (firstException == null) {
  firstException = lastException = error;
  return;
 }
 lastException.setNextException(error);
 lastException = error;
}

代码示例来源:origin: oblac/jodd

/**
 * Rolls up SQL exceptions by taking each proceeding exception
 * and making it a child of the previous using the <code>setNextException</code>
 * method of SQLException.
 */
public static SQLException rollupSqlExceptions(final Collection<SQLException> exceptions) {
  SQLException parent = null;
  for (SQLException exception : exceptions) {
    if (parent != null) {
      exception.setNextException(parent);
    }
    parent = exception;
  }
  return parent;
}

代码示例来源:origin: postgresql/postgresql

public void handleError(SQLException newError) {
  if (error == null)
    error = newError;
  else
    error.setNextException(newError);
}

代码示例来源:origin: postgresql/postgresql

public void handleError(SQLException newError) {
  if (error == null)
    error = newError;
  else
    error.setNextException(newError);
}

代码示例来源:origin: postgresql/postgresql

public void handleError(SQLException newError) {
  if (error == null)
    error = newError;
  else
    error.setNextException(newError);
}

代码示例来源:origin: postgresql/postgresql

public void handleError(SQLException error) {
  if (sqle == null)
  {
    sqle = error;
  }
  else
  {
    sqle.setNextException(error);
  }
}

代码示例来源:origin: postgresql/postgresql

public void handleError(SQLException error) {
  if (sqle == null)
  {
    sqle = error;
  }
  else
  {
    sqle.setNextException(error);
  }
}

代码示例来源:origin: postgresql/postgresql

public void handleError(SQLException newError) {
  if (error == null)
    error = newError;
  else
    error.setNextException(newError);
}

代码示例来源:origin: apache/incubator-shardingsphere

private void throwSQLExceptionIfNecessary(final Collection<SQLException> exceptions) throws SQLException {
  if (exceptions.isEmpty()) {
    return;
  }
  SQLException ex = new SQLException();
  for (SQLException each : exceptions) {
    ex.setNextException(each);
  }
  throw ex;
}

代码示例来源:origin: apache/incubator-shardingsphere

private void throwSQLExceptionIfNecessary(final Collection<SQLException> exceptions) throws SQLException {
  if (exceptions.isEmpty()) {
    return;
  }
  SQLException ex = new SQLException();
  for (SQLException each : exceptions) {
    ex.setNextException(each);
  }
  throw ex;
}

代码示例来源:origin: apache/incubator-shardingsphere

private void throwSQLExceptionIfNecessary(final Collection<SQLException> exceptions) throws SQLException {
  if (exceptions.isEmpty()) {
    return;
  }
  SQLException ex = new SQLException();
  for (SQLException each : exceptions) {
    ex.setNextException(each);
  }
  throw ex;
}

代码示例来源:origin: apache/incubator-shardingsphere

private void throwSQLExceptionIfNecessary(final Collection<SQLException> exceptions) throws SQLException {
    if (exceptions.isEmpty()) {
      return;
    }
    SQLException ex = new SQLException();
    for (SQLException each : exceptions) {
      ex.setNextException(each);
    }
    throw ex;
  }
}

代码示例来源:origin: apache/incubator-shardingsphere

private void throwSQLExceptionIfNecessary(final Collection<SQLException> exceptions) throws SQLException {
  if (exceptions.isEmpty()) {
    return;
  }
  SQLException ex = new SQLException();
  for (SQLException each : exceptions) {
    ex.setNextException(each);
  }
  throw ex;
}

代码示例来源:origin: oblac/jodd

/**
 * Closes all assigned result sets and then closes the query. Query becomes closed.
 */
protected SQLException closeQuery() {
  SQLException sqlException = closeQueryResultSets();
  if (statement != null) {
    try {
      statement.close();
    } catch (SQLException sex) {
      if (sqlException == null) {
        sqlException = sex;
      } else {
        sqlException.setNextException(sex);
      }
    }
    statement = null;
  }
  query = null;
  queryState = CLOSED;
  return sqlException;
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void log_all_sql_exceptions() {
 SQLException root = new SQLException("this is root", "123");
 SQLException next = new SQLException("this is next", "456");
 root.setNextException(next);
 DatabaseUtils.log(Loggers.get(getClass()), root);
 assertThat(logTester.logs(LoggerLevel.ERROR)).contains("SQL error: 456. Message: this is next");
}

代码示例来源:origin: apache/ignite

/**
 * Send the batch.
 *
 * @param batch Batch.
 */
private void sendBatch(Batch batch) {
  DmlPageProcessingResult pageRes = processPage(cctx, batch);
  batch.clear();
  updateCnt += pageRes.count();
  if (failedKeys == null)
    failedKeys = new ArrayList<>();
  failedKeys.addAll(F.asList(pageRes.errorKeys()));
  if (pageRes.error() != null) {
    if (err == null)
      err = pageRes.error();
    else
      err.setNextException(pageRes.error());
  }
}

代码示例来源:origin: org.postgresql/postgresql

private void rollbackIfRequired(boolean autosave, SQLException e) throws SQLException {
 if (autosave
   && getTransactionState() == TransactionState.FAILED
   && (getAutoSave() == AutoSave.ALWAYS || willHealOnRetry(e))) {
  try {
   // ROLLBACK and AUTOSAVE are executed as simple always to overcome "statement no longer exists S_xx"
   execute(restoreToAutoSave, SimpleQuery.NO_PARAMETERS, new ResultHandlerDelegate(null),
     1, 0, QUERY_NO_RESULTS | QUERY_NO_METADATA | QUERY_EXECUTE_AS_SIMPLE);
  } catch (SQLException e2) {
   // That's O(N), sorry
   e.setNextException(e2);
  }
 }
 throw e;
}

相关文章