| Home | Libraries | People | FAQ | More

###### any_connection::execute (1 of 2 overloads)

Executes a text query or prepared statement.

###### Synopsis

    template<
        class ExecutionRequest,
        class ResultsType>
    void
    execute(
        ExecutionRequest&& req,
        ResultsType& result,
        error_code& err,
        diagnostics& diag);

###### Description

Sends `req` to the server for execution and reads the response into `result`. `result` may be either a `results` or `static_results` object. `req` should may be either a type convertible to `string_view` containing valid SQL or a bound prepared statement, obtained by calling `statement::bind`. If a string, it must be encoded using the connection's character set. Any string parameters provided to `statement::bind` should also be encoded using the connection's character set.

After this operation completes successfully, `result.has_value() == true`.

Metadata in `result` will be populated according to `this->meta_mode()`.