| Home | Libraries | People | FAQ | More

###### connection::async_read_some_rows (3 of 4 overloads)

Reads a batch of rows.

###### Synopsis

    template<
        class SpanStaticRow,
        class... StaticRow,
        class CompletionToken>
    auto
    async_read_some_rows(
        static_execution_state< StaticRow... >& st,
        span< SpanStaticRow > output,
        CompletionToken&& token);

###### Description

Reads a batch of rows of unspecified size into the storage given by `output`. At most `output.size()` rows will be read. If the operation represented by `st` has still rows to read, and `output.size() > 0`, at least one row will be read.

Returns the number of read rows.

If there are no more rows, or `st.should_read_rows() == false`, this function is a no-op and returns zero.

The number of rows that will be read depends on the input buffer size. The bigger the buffer, the greater the batch size (up to a maximum). You can set the initial buffer size in `connection`'s constructor, using `buffer_params::initial_read_size`. The buffer may be grown bigger by other read operations, if required.

Rows read by this function are owning objects, and don't hold any reference to the connection's internal buffers (contrary what happens with the dynamic interface's counterpart).

`SpanStaticRow`must exactly be one of the types in the `StaticRow` parameter pack. The type must match the resultset that is currently being processed by `st`. For instance, given `static_execution_state<T1, T2>`, when reading rows for the second resultset, `SpanStaticRow` must exactly be `T2`. If this is not the case, a runtime error will be issued.

This function can report schema mismatches.

###### Handler signature

The handler signature for this operation is `void(boost::mysql::error_code, std::size_t)`.

###### Object lifetimes

The storage that `output` references must be kept alive until the operation completes.