2
0
mirror of https://github.com/boostorg/mysql.git synced 2026-01-28 07:22:26 +00:00

Made value a proper class

This commit is contained in:
ruben
2020-05-16 17:30:30 +01:00
parent 9346225096
commit 3e10845104
17 changed files with 148 additions and 110 deletions

View File

@@ -22,7 +22,6 @@
void print_employee(const boost::mysql::row& employee)
{
using boost::mysql::operator<<; // Required for mysql::value objects to be streamable, due to ADL rules
std::cout << "Employee '"
<< employee.values()[0] << " " // first_name (type std::string_view)
<< employee.values()[1] << "' earns " // last_name (type std::string_view)
@@ -92,7 +91,7 @@ void main_impl(int argc, char** argv)
result = conn.query("SELECT salary FROM employee WHERE first_name = 'Underpaid'");
auto rows = result.fetch_all();
assert(rows.size() == 1);
[[maybe_unused]] auto salary = std::get<double>(rows[0].values()[0]);
[[maybe_unused]] double salary = rows[0].values()[0].get<double>();
assert(salary == 10000);
// Notify the MySQL server we want to quit, then close the underlying connection.