14 using LC::operator
""_ct;
42 constexpr
static auto ClassName =
"StudentInfo"_ct;
46 return std::tie (ID_, StudentID_, Age_, Year_);
63 constexpr
static auto ClassName =
"Lecturer"_ct;
67 return std::tie (ID_,
Name_);
77 struct Student2Lecturer
83 constexpr
static auto ClassName =
"Student2Lecturer"_ct;
87 return std::tie (ID_, StudentID_, LecturerID_);
102 void OralFKeyTest::testBasicFKeys ()
106 auto student = Util::oral::AdaptPtr<Student, OralFactory> (db);
107 auto studentInfo = Util::oral::AdaptPtr<StudentInfo, OralFactory> (db);
111 { { 0,
"Student 1" }, { 0, 0, 18, 1 } },
112 { { 0,
"Student 2" }, { 0, 0, 19, 1 } },
113 { { 0,
"Student 3" }, { 0, 0, 19, 2 } },
116 for (
auto& [stud, info] : list)
118 student->Insert (stud);
119 info.StudentID_ = stud.ID_;
120 studentInfo->Insert (info);
123 namespace sph = oral::sph;
125 const auto& selected = student->Select (sph::f<&Student::ID_> == sph::f<&StudentInfo::StudentID_> &&
126 sph::f<&StudentInfo::Age_> > 18);
128 QCOMPARE (selected, expected);
ORAL_ADAPT_STRUCT(Student, ID_, Name_) struct StudentInfo
QSqlDatabase MakeDatabase(const QString &name=":memory:")
static constexpr auto ClassName