[nycphp-talk] PEAR DB vs successors
Rick
rick at napalmriot.com
Thu Mar 22 16:24:34 EDT 2007
David Mintz wrote:
> A couple of naive questions here. I hear PEAR::DB is deprecated in
> favor of MDB2. If that's so,
>
> * does that mean we should definitely use MDB2 instead of DB in new
> projects that we undertake?
I would use MDB2 over DB personally, or switch to PDO.
> * what is MDB there for?
It was the version before MDB2, and is obsolete.
>
> * DB had a nice autoExecute(), but its counterpart in MDB2 requires
> you to tell it the datatype of each parameter. If I intend to use
> MySQL and not planning to support other backends (except maybe
> something like SQLite), is there any reason not to lie to it and say
> that everything is 'text'? My motivation is Laziness, shorter code,
> less hard-coded SQL, e.g.:
Laziness is a great motivator in many cases; this is quite possibly the
worst though. If you are trying to "work around" prepared queries, then
don't use them. Otherwise, use them right. :p So yes, there's plenty
of reasons not to lie to it and say everything is 'text,' especially if
everything _isn't_ text.
>
> $db->autoExecute($this->table, $this->data, DB_AUTOQUERY_UPDATE,
> $where );
>
> * Suppose you like the PEAR::Auth module. It supports DB but not its
> successors. Write your own storage container that wraps MDB2? Is it
> worth it?
Well if you like PEAR::Auth and plan to switch to MDB2, then it would
likely be worth it I suppose.
>
> Thanks,
>
> --
> David Mintz
> http://davidmintz.org/
More information about the talk
mailing list