in reply to RFC - A multi table SQL Builder
Personally, I haven't seen such a module in the DBIx namespace, but I'd really like such a module to allow for better performance in Class::DBI, as there, the joins on multiple tables are implemented on the Perl side of things. This approach is good, as it allows for huge flexibility, but as 99% of my use cases can be handled on the SQL side of things, I'd really like to declare the paths through my schema and have Perl figure out how to get from one table to the next via joins.
Consider looking at how SQL::AbstractSearch does things, but in any case, such a module would be very fine in my eyes.
I know you have your API laid out already, but here are some ideas how I'd like to use the module to declare joins in a Class::DBI setting:
__PACKAGE__->has_many_direct( abcds => [ a => 'b.ab' => 'c.bc' => 'd.c +d' ] );
or, maybe by declaring the "fast path" options outside of the "has_many" section would be easier, as then all generated queries could use it:
package A; __PACKAGE__->direct_join( b => 'b.ab' ); package B; __PACKAGE__->direct_join( c => 'c.bc' ); # ... and so on
but that "solution" has the drawback of only allowing/suggesting one path through the table schema, where you might have more than one, say, a movie, having connections to a person via both, the roles and the directors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RFC - A multi table SQL Builder
by dragonchild (Archbishop) on Oct 18, 2004 at 12:50 UTC |