Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext
connection::async_read_some_rows (3 of 4 overloads)

Reads a batch of rows.

Synopsis
template<
    class SpanElementType,
    class... StaticRow,
    class CompletionToken>
auto
async_read_some_rows(
    static_execution_state< StaticRow... >& st,
    span< SpanElementType > 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 connection's 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).

The type SpanElementType must be the underlying row type for one of the types in the StaticRow parameter pack (i.e., one of the types in underlying_row_t<StaticRow>...). 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, SpanElementType must exactly be underlying_row_t<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.


PrevUpHomeNext