[development] Flex API, XML API modules are they needed?
Larry Garfield
larry at garfieldtech.com
Wed Feb 11 07:02:31 UTC 2009
On Tuesday 10 February 2009 9:22:26 pm David Metzler wrote:
> This was a primary concern for me. I still haven't figured out why
> database drivers never do this....? It seems so straightforward to
> think of parameters as key value pairs. What I did here was to
> rewrite the parameters array into one that was numerically based
> because hey the postgres driver needed numerical bind arguments. I
> just got tired of hand rolling arrays arrays as parameters when I had
> a perfectly good $form_values array or simplexml object to use as the
> parameter source.
>
> If DBTNG allows extra parameters to be passed that don't get used in
> the query then it's probably close enough for what most people need,
> and the XML to array conversion api would get you the rest of the way
> there anyway.
PDO gets cranky if your argument count does not exactly match your placeholder
count. DBTNG doesn't do any extra checking on top of that for you, so yes you
do need to make sure you pass in only those values that you need and nothing
else.
Some databases support reusing placeholders. Some do not. Who knows why;
database vendors are silly people. PDO has gone back and forth on whether it
tries to emulate reuse on databases that don't natively support it or not (a
process that was frequently buggy, according to PDO's principal author, Wez
Furlong), creating a situation where unless you know your precise version down
to the .z level you can't reliably assume that it's going to work. So we
assume that you can't reuse placeholders.
Any XML-to-array conversion should happen outside the DB layer, IMO.
--
Larry Garfield
larry at garfieldtech.com
More information about the development
mailing list