I have a generic DTO model that selects everything in a table, and generates an object from it.
So, instead of always writing SELECT x,y,z WHERE … in all my pages, I only have: $obj = new Obj($id);
But, this object lazy loads other objects (related tables, only when needed), and sometimes when you know something will be used, I want to the object to preload it’s relationships, so it selects from more than one table at a time.
Problem is, I need to generate more than one object from each select (so select from 3 tables, and create 3 objects, 1 for each table), without having to list all the columns in the table inside my object (SELECT a., b. FROM a,b; will list all fields from table a first, and then those from b, so i can tell them apart, if and only if i know how many fields each table has, and in what order they are).
In other words, it simplifies allot of the code and makes just one place for optimizations/fixes instead of multiple places scattered across the app.
The \G command will display your results vertically instead of horizontally. (easier to read on command line),