[OT] Idea to get all columns from multiple tables in DB
doob at me.com
Fri Jan 10 20:32:07 UTC 2020
On 2020-01-09 00:03, Steven Schveighoffer wrote:
> Yeah, this is generally the case when generating SQL from types. I like
> to write queries to make them the most efficient I can, without having
> to deal with quirks between ORM requirements and the data in the table
> (I'm dealing with an existing data layout, which does not lend itself
> always to ORM usage).
Sure, but you don't need an ORM to do what I suggested. Something like this:
connection.query("SELECT " ~ fieldsToSQL!User ~ " FROM user").byItem!User;
Where "fieldsToSQL!User" would expand to:
"user.first_name, user.last_name, user.age"
Or whatever naming convention you have in the table.
I'm sure you can come up with a better API.
More information about the Digitalmars-d