Struct hdbconnect::ResultSet [] [src]

pub struct ResultSet { /* fields omitted */ }

Contains the result of a database read command, including the describing metadata.

In most cases, you will want to use the powerful method into_typed to convert the data from the generic format into your application specific format.

Methods

impl ResultSet
[src]

Returns true if no rows are contained

Returns true if more than 1 row is contained

Returns the number of contained rows

Returns a pointer to the last row

Returns a mutable pointer to the last row

Returns a mutable pointer to the last row

Removes the last row and returns it, or None if it is empty.

Returns the number of fields

Returns the name of the column at the specified index

Returns the value at the specified position.

FIXME Should be replaced with a method get_rows() -> Iterator.

Returns the number of result rows.

Fetches all not yet transported result lines from the server.

Bigger resultsets are typically not transported in one DB roundtrip; the number of roundtrips depends on the size of the resultset and the configured fetch_size of the connection.

Returns the accumulated server processing time of the calls that produced this resultset, i.e. the initial call and potentially a subsequent number of fetches.

Translates a generic resultset into a given rust type (that implements Deserialize).

A resultset is essentially a two-dimensional structure, given as a list of rows (a Vec<Row>), where each row is a list of fields (a Vec<TypedValue>); the name of each field is given in the metadata of the resultset.

The method supports a variety of target data structures, with the only strong limitation that no data loss is supported.

  • It depends on the dimension of the resultset what target data structure you can choose for deserialization:

    • You can always use a Vec<line_struct>, where line_struct matches the field list of the resultset.

    • If the resultset contains only a single line (e.g. because you specified TOP 1 in your select), then you can optionally choose to deserialize into a plain line_struct.

    • If the resultset contains only a single column, then you can optionally choose to deserialize into a Vec<plain_field>.

    • If the resultset contains only a single value (one row with one column), then you can optionally choose to deserialize into a plain line_struct, or a Vec<plain_field>, or a plain variable.

  • Also the translation of the individual field values provides a lot of flexibility. You can e.g. convert values from a nullable column into a plain field, provided that no NULL values are given in the resultset.

    Vice versa, you always can use an Option<plain_field>, even if the column is marked as NOT NULL.

  • Similarly, integer types can differ, as long as the concrete values can be assigned without loss.

Note that you need to specify the type of your target variable explicitly, so that into_typed() can derive the type it needs to serialize into:

#[derive(Deserialize)]
struct MyStruct {
    ...
}
let typed_result: Vec<MyStruct> = resultset.into_typed()?;

Trait Implementations

impl Debug for ResultSet
[src]

Formats the value using the given formatter.

impl Display for ResultSet
[src]

Formats the value using the given formatter. Read more