RE: [PEAR] DB::autoExecute limitations
| From: | Lukas Smith | Date: | Tue, 27 May 2003 15:08:46 +0000 |
| Subject: | RE: [PEAR] DB::autoExecute limitations | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5623@lists.php.net to get a copy of this message | ||
> From: culley harrelson [mailto:culley@fastmail.fm]
> Sent: Tuesday, May 27, 2003 4:59 PM
> First of all I love autoExecute-- it works great for vanilla inserts
and
> updates. This is a minor annoyance and there are plenty of work
around
> but I thought I would mention it anyway.
>
> Most everything gets interpreted as a string so it is impossible to
> access other database entities, database constants, functions,
> sub-selects etc. It sure would be nifty to be able to generate
something
> like:
>
> update my_table a set col1 = col2, date_field = to_char('YYYY-MM-DD',
> current_date), denormalized_summary_field = (select max(amount) from
> other_table b where b.id = a.id) where id = 1;
>
> Maybe an additional optional parameter that specified data types? I
> don't know what this would entail so I might be asking for the
impossible
> here. Meanwhile I can always generate my sql manually when I need to
get
> fancy :)
well PEAR DB supports 3 datatypes with specific placeholders:
? - parameter is escaped and quotes placed around it
! - taken as is
& - lob (dunno if autoexecute can handle this)
there will never be more I am pretty sure.
MDB supports more datatypes (like date etc).
However I chose to exclude autoexecute from MDB because I am not
convinced that this method makes sense. It basically abusing the
prepared concept and it has nothing to do with abstraction but only
"ease of use" and therefore belongs in a layer above the abstraction
layer (like in DataObject or QueryTool).
My 2 cents
Regards,
Lukas