auto PostgresInstructorServerService::createTrip(DataSource::Id a_studentId, time_t startTime) -> bool
{
try
{
auto l_transaction(this->m_session.beginTransaction(Transaction::IsolationLevel::Serializable));
auto const l_createdTripId = (DWord) this->m_session.createQuery(LR"(
insert into "Trips"
("studentId", "beginDate") values (?, ?)
returning "id"
)")
.bind(1, a_studentId)
.bind(2, ctime (&startTime))
.getUniqueResult()[1];
l_transaction.commit();
return true;
}
catch (const NoResultException& exception)
{
// TODO: Log exception msg
return false;
}
}