How should multi table queries look?
This is an open discussion for how multi table queries should look.
Purpose:
Even though single table queries are good, we want to extend QueryC++ to handle multi table quieres, i.e.:
SELECT a.name, b.age FROM person a, animal b WHERE a.id = b.owner_id;
This issue is to discuss how we could formulate this.
Initial proposal:
@looopTools initial proposal is to make a separate class (name to be decide, here called MultiQueryClass) where the tables to work on can be added as part of the constructor:
MultiQueryClass query(std::map<table, std::string_view>& tables);
Where the string_view
is the name of the table as from the example above it would be a
or b
.
Additionally, you should also be able to add the tables later, with a function:
add_tables(std::map<table, string_view>& tables);
add_table(table, std::string_view name);
A select for instance could look like query.SELECT((tbla, cola), (tblb, colb)).WHERE().EQ((tbla, columa), (tbla, columnb))
.
But is this acceptable, do we have alternatives?