in reply to sql builder module - feedback request
It may be something worth considering, although I'm sure you have your reasons for having the interface like it is.# instead of this $select = new SQL::Builder::Select; $select->column('col1', 'col2'); $select->table('table'); $select->order_by('col1'); $select->limit_value('10'); $select->limit_offset('10'); ########## # you could do this: $select = new SQL::Builder::Select; $select->column('col1','col2') ->table('table') ->order_by('col1') ->limit_value('10') ->limit_offset('10');
I've tried doing similar automagic query generation like this before, and in general it can get very ugly no matter how hard you try, with stuff like this: where_ne_or, where_gt_or, etc... You have to find your own balance between simplicity of interface and the domain of queries which you want to be able to represent.
One other thing I've noticed is that I don't see any provision for column aggregates like count() and max() and friends, in fact any SQL functions! Right now your module is a powerful logic combinator (just ANDs and ORs). But think about whether (and how) you want to represent queries like
By all means, you don't have to have provisions in your module to make these queries, but it might be beneficial to think about more common queries that are more than just AND/OR combinations.select count(*) from polygons where sin(angle1)>(width*height)
Update: Come to think of it, you have a lot of similar code in the where_* methods -- you may want to consider using AUTOLOAD for these.
blokhead
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: sql builder module - feedback request
by fireartist (Chaplain) on Nov 22, 2002 at 09:57 UTC |