#include <userver/storages/query.hpp>
Holds a query, its name and logging mode; used by all the SQL databases of userver.
Prefer using via Embedding SQL/YQL files via userver_add_sql_library or use a const variable with name
specified as NameLiteral.
- Note
- You may write a query in
.sql
file and generate a header file with Query from it. See Embedding SQL/YQL files via userver_add_sql_library for more information.
Definition at line 28 of file query.hpp.
◆ Name
String with query name.
Definition at line 31 of file query.hpp.
◆ NameView
Zero terminated view to the query name.
Definition at line 34 of file query.hpp.
◆ LogMode
Enumerator |
---|
kFull | Output name and optionally statement.
|
kNameOnly | Output only name.
|
Definition at line 52 of file query.hpp.
◆ Query() [1/3]
Constructor that omits dynamic initialization and relies on statement
and name
being string literals.
Definition at line 66 of file query.hpp.
◆ Query() [2/3]
storages::Query::Query |
( |
const char * | statement, |
|
|
std::optional< Name > | name = std::nullopt, |
|
|
LogMode | log_mode = LogMode::kFull ) |
|
inline |
◆ Query() [3/3]
storages::Query::Query |
( |
std::string | statement, |
|
|
std::optional< Name > | name = std::nullopt, |
|
|
LogMode | log_mode = LogMode::kFull ) |
|
inline |
◆ GetLogMode()
LogMode storages::Query::GetLogMode |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- logging mode
Definition at line 84 of file query.hpp.
◆ GetOptionalName()
std::optional< Name > storages::Query::GetOptionalName |
( |
| ) |
const |
|
inline |
- Returns
- optional queury name suitable for construction of a new Query
Definition at line 78 of file query.hpp.
◆ GetOptionalNameView()
std::optional< NameView > storages::Query::GetOptionalNameView |
( |
| ) |
const |
|
noexcept |
- Returns
- view to the query name that is alive as long as *this is alive
◆ GetStatementView()
- Returns
- zero terminated view to the statement that is alive as long as *this is alive
The documentation for this class was generated from the following file: