many to many query progress (multiple joins)
This commit is contained in:
+6
-6
@@ -90,14 +90,14 @@ int main()
|
||||
mc.distinguished = true;
|
||||
auto insert_authors_sql = c.query(s)
|
||||
.insert()
|
||||
.into<author>(qh::authors)
|
||||
.into(qh::authors)
|
||||
.values(mc)
|
||||
.execute();
|
||||
|
||||
std::cout << "SQL: " << insert_authors_sql << "\n";
|
||||
|
||||
auto result = c.query(s)
|
||||
.select<author>()
|
||||
.select(qh::authors.columns)
|
||||
.from(qh::authors)
|
||||
.fetch_all();
|
||||
|
||||
@@ -115,7 +115,7 @@ int main()
|
||||
std::cout << "SQL: " << update_authors_sql << "\n";
|
||||
|
||||
auto authors = c.query(s)
|
||||
.select<author>()
|
||||
.select(qh::authors.columns)
|
||||
.from(qh::authors)
|
||||
.fetch_all<author>();
|
||||
|
||||
@@ -125,18 +125,18 @@ int main()
|
||||
|
||||
c.query(s)
|
||||
.insert()
|
||||
.into<book>(qh::books)
|
||||
.into(qh::books)
|
||||
.values({2, "It", mc.id, 1980})
|
||||
.execute();
|
||||
|
||||
c.query(s)
|
||||
.insert()
|
||||
.into<book>(qh::books)
|
||||
.into(qh::books)
|
||||
.values({3, "Misery", mc.id, 1984})
|
||||
.execute();
|
||||
|
||||
auto select_books_sql = c.query(s)
|
||||
.select<book>({qh::authors.last_name})
|
||||
.select(qh::books.columns, {qh::authors.last_name})
|
||||
.from(qh::books)
|
||||
.join_left(qh::authors)
|
||||
.on(qh::books.author_id == qh::authors.id)
|
||||
|
||||
Reference in New Issue
Block a user