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

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext
connection::query (1 of 2 overloads)

(Deprecated) Executes a SQL text query.

Synopsis
void
query(
    string_view query_string,
    results& result,
    error_code& err,
    diagnostics& diag);
Description

Sends query_string to the server for execution and reads the response into result. query_string should 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().

Security

If you compose query_string by concatenating strings manually, your code is vulnerable to SQL injection attacks. If your query contains patameters unknown at compile time, use prepared statements instead of this function.

Deprecation notice

This function is only provided for backwards-compatibility. For new code, please use execute or async_execute instead.


PrevUpHomeNext