generated from Sithas/conan_template
База для ручки PostUserMedicationsExecutor.h
This commit is contained in:
@@ -10,20 +10,20 @@ MySQLMedicationsDAO::MySQLMedicationsDAO(mysqlx::Session& session): session_(ses
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<medication> MySQLMedicationsDAO::GetAll() const
|
||||
std::vector<medication_dto> MySQLMedicationsDAO::GetAll() const
|
||||
{
|
||||
static const string sql_script = "SELECT uuid, name, dose, unit, is_urgent FROM up_and_down.medications;";
|
||||
|
||||
mysqlx::SqlResult sql_result = session_.sql(sql_script).execute();
|
||||
list<mysqlx::Row> rows = sql_result.fetchAll();
|
||||
|
||||
vector<medication> ret;
|
||||
vector<medication_dto> ret;
|
||||
|
||||
if (rows.empty()) return ret;
|
||||
|
||||
for (const auto& row : rows)
|
||||
{
|
||||
medication m;
|
||||
medication_dto m;
|
||||
|
||||
m.uuid = row[0].get<string>();
|
||||
m.name = row[1].get<string>();
|
||||
@@ -37,7 +37,7 @@ std::vector<medication> MySQLMedicationsDAO::GetAll() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string MySQLMedicationsDAO::Create(const medication& m) const
|
||||
std::string MySQLMedicationsDAO::Create(const medication_dto& m) const
|
||||
{
|
||||
boost::uuids::random_generator generator;
|
||||
boost::uuids::uuid uuid = generator();
|
||||
|
||||
Reference in New Issue
Block a user