Class SQLResult

java.lang.Object
com.blackrook.sql.SQLResult
All Implemented Interfaces:
Iterable<SQLRow>

public class SQLResult extends Object implements Iterable<SQLRow>
The data encapsulation of the result of a query ResultSet.
Author:
Matthew Tropiano
  • Field Details

    • columnNames

      protected String[] columnNames
      Query Columns.
    • rowCount

      protected int rowCount
      Rows affected or returned in the query.
    • nextId

      protected Object[] nextId
      Next id, if generated.
    • update

      protected boolean update
      Was this an update query?
    • rows

      protected List<SQLRow> rows
      List of rows of associative data.
  • Method Details

    • getColumnNames

      public String[] getColumnNames()
      Gets the names of the columns.
      Returns:
      the column names in this result.
    • getRowCount

      public int getRowCount()
      Gets the amount of affected/returned rows from this query.
      Returns:
      the amount of records in this result.
    • isUpdate

      public boolean isUpdate()
      Returns:
      true if this came from an update, false otherwise.
    • getRows

      public List<SQLRow> getRows()
      Retrieves the rows from the query result.
      Returns:
      a list of the rows in this result.
    • getRow

      public SQLRow getRow()
      Gets the first row, or only row in this result, or null if no rows.
      Returns:
      the row in this result.
    • getId

      public Object getId()
      Returns:
      the generated id from the last query, if any, or null if none.
    • getIds

      public Object[] getIds()
      Returns:
      the list of generated ids from the last query.
    • iterator

      public SQLResult.SQLResultIterator iterator()
      Specified by:
      iterator in interface Iterable<SQLRow>