io.vertx.ext.sql

## Class ResultSet

- java.lang.Object
- - io.vertx.ext.sql.ResultSet

-     public class ResultSet
      extends Object

  Represents the results of a SQL query.

  It contains a list for the column names of the results, and a list of `JsonArray` - one for each row of the results.

  Author:
    Tim Fox

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResultSet()` Default constructor
    `ResultSet(JsonObject json)` Create a result-set from JSON
    `ResultSet(List<String> columnNames, List<JsonArray> results, ResultSet next)` Create a result-set
    `ResultSet(ResultSet other)` Copy constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `List<String>` | `getColumnNames()` Get the column names
    `ResultSet` | `getNext()` Get the next result set
    `int` | `getNumColumns()` Return the number of columns in the result set
    `int` | `getNumRows()` Return the number of rows in the result set
    `JsonArray` | `getOutput()` Get the registered outputs
    `List<JsonArray>` | `getResults()` Get the results
    `List<JsonObject>` | `getRows()` Get the rows - each row represented as a JsonObject where the keys are the column names and the values are the column values.
    `List<JsonObject>` | `getRows(boolean caseInsensitive)` Get the rows - each row represented as a JsonObject where the keys are the column names and the values are the column values.
    `int` | `hashCode()`
    `ResultSet` | `setColumnNames(List<String> columnNames)`
    `ResultSet` | `setNext(ResultSet next)`
    `ResultSet` | `setOutput(JsonArray output)`
    `ResultSet` | `setResults(List<JsonArray> results)`
    `JsonObject` | `toJson()` Convert to JSON

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ResultSet

          public ResultSet()

      Default constructor

    - #### ResultSet

          public ResultSet(ResultSet other)

      Copy constructor
      Parameters:
        `other` - result-set to copy

    - #### ResultSet

          public ResultSet(List<String> columnNames,
                           List<JsonArray> results,
                           ResultSet next)

      Create a result-set
      Parameters:
        `columnNames` - the column names
        `results` - the results

    - #### ResultSet

          public ResultSet(JsonObject json)

      Create a result-set from JSON
      Parameters:
        `json` - the json

  - ### Method Detail

    - #### toJson

          public JsonObject toJson()

      Convert to JSON
      Returns:
        json object

    - #### getResults

          public List<JsonArray> getResults()

      Get the results
      Returns:
        the results

    - #### setResults

          public ResultSet setResults(List<JsonArray> results)

    - #### getOutput

          public JsonArray getOutput()

      Get the registered outputs
      Returns:
        the outputs

    - #### setOutput

          public ResultSet setOutput(JsonArray output)

    - #### getColumnNames

          public List<String> getColumnNames()

      Get the column names
      Returns:
        the column names

    - #### setColumnNames

          public ResultSet setColumnNames(List<String> columnNames)

    - #### getNext

          public ResultSet getNext()

      Get the next result set
      Returns:
        the next resultset

    - #### setNext

          public ResultSet setNext(ResultSet next)

    - #### getRows

          public List<JsonObject> getRows()

      Get the rows - each row represented as a JsonObject where the keys are the column names and the values are the column values. Beware that it's legal for a query result in SQL to contain duplicate column names, in which case one will overwrite the other if using this method. If that's the case use `getResults()` instead. Be aware that column names are defined as returned by the database, this means that even if your SQL statement is for example:

          SELECT a, b FROM table

      the column names are not required to be:

          a

      and

          b

      and could be in fact

          A

      and

          B

      . For cases when there is the need for case insentivitity you should see `getRows(boolean)`
      Returns:
        the rows represented as JSON object instances

    - #### getRows

          public List<JsonObject> getRows(boolean caseInsensitive)

      Get the rows - each row represented as a JsonObject where the keys are the column names and the values are the column values. Beware that it's legal for a query result in SQL to contain duplicate column names, in which case one will overwrite the other if using this method. If that's the case use `getResults()` instead. Special note, when encoding the row JSON to a String or Buffer the column names will be as they returned by the database server regardless of the case sensitivity chosen on this method call.
      Parameters:
        `caseInsensitive` - - treat column names as case insensitive, i.e.: FoO equals foo equals FOO
      Returns:
        the rows represented as JSON object instances

    - #### getNumRows

          public int getNumRows()

      Return the number of rows in the result set
      Returns:
        the number of rows

    - #### getNumColumns

          public int getNumColumns()

      Return the number of columns in the result set
      Returns:
        the number of columns

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2021 Eclipse. All rights reserved.