Example usage for java.sql SQLWarning setNextWarning

List of usage examples for java.sql SQLWarning setNextWarning

Introduction

In this page you can find the example usage for java.sql SQLWarning setNextWarning.

Prototype

public void setNextWarning(SQLWarning w) 

Source Link

Document

Adds a SQLWarning object to the end of the chain.

Usage

From source file:Main.java

private static void throwWarning() throws SQLException {
    SQLWarning rootWarning = new SQLWarning("Outter warning");
    SQLWarning containedWarning = new SQLWarning("Inner warning");
    rootWarning.setNextWarning(containedWarning);
    throw rootWarning;
}

From source file:net.starschema.clouddb.jdbc.BQConnection.java

/**
 * <p>//from  ww w  . j  a  va 2  s  . co  m
 * <h1>Implementation Details:</h1><br>
 * If SQLWarningList is empty returns null else it returns the first item
 * Contained inside <br>
 * Subsequent warnings will be chained to this SQLWarning.
 * </p>
 * 
 * @return SQLWarning (The First item Contained in SQLWarningList) + all
 *         others chained to it
 */
@Override
public SQLWarning getWarnings() throws SQLException {
    if (this.isclosed) {
        throw new BQSQLException("Connection is closed.");
    }
    if (this.SQLWarningList.isEmpty()) {
        return null;
    }

    SQLWarning forreturn = this.SQLWarningList.get(0);
    this.SQLWarningList.remove(0);
    if (!this.SQLWarningList.isEmpty()) {
        for (SQLWarning warning : this.SQLWarningList) {
            forreturn.setNextWarning(warning);
        }
    }
    return forreturn;
}