Re: Re: PEAR DB abstraction layers
| From: | Martin Jansen | Date: | Mon, 19 Apr 2004 15:10:44 +0000 |
| Subject: | Re: Re: PEAR DB abstraction layers | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-28039@lists.php.net to get a copy of this message | ||
On Mon Apr 19, 2004 at 03:2920PM +0200, Lukas Smith wrote:
> Martin Jansen wrote:
> >On Mon Apr 19, 2004 at 03:0932PM +0200, Lukas Smith wrote:
> >>The type stuff is optional. The only difference when you dont want to
> >>use the types is that a few parameters will have to be set as "null".
> >
> >
> >This sounds potentially cumbersome to me and I believe that one of DB's
> >strengths is the straightforward API. So shouldn't we (resp. you)
> >consider to use the "no-types" style per default, so that people don't
> >need to perform wrenches like passing NULL values when using MDB?
>
> The difference is as follows:
> $db->getRow($query, $params, $fetchmode)
> $mdb2->getRow($query, $types, $params, $param_types, $fetchmode);
>
> If you dont want to use the type abstraction then you will need to set
> $types and $param_types to null. However if you just want to run the
> query you will have to do the same for both API's:
> $db->getRow($query)
> $mdb2->getRow($query);
Is this the only place where passing NULL values to suppress type
handling is necessary? If yes, then I do not see a real problem. (See
below.)
> The above example does highlight another difference:
> MDB[2] only supports the ? placeholder. The DB placeholder ! and & are
> not supported because this is handled through the $param_types array.
I guess this "problem" can easily be solved by solid documentation.
(Which looks like the most important problem of MDB at the moment.)
> Anyways moving the types related params to the end of the parameter list
> would evade this problem, however I dont think it would be very logical
> for the enduser. I guess the question is if a wrapper around MDB2 which
> "hides" all of these features is still not faster than DB (especially
> when using the unbuffered query mode).
Without knowing the API of MDB, I suppose one can also set the fetch
mode globally, no? If that's the case, passing a bunch of NULL values
is no real problem.
--
- Martin Martin Jansen
http://martinjansen.com/