Re: Extending PEAR DB
| From: | Benjamin R. Webb | Date: | Wed, 25 Apr 2001 07:42:52 +0000 |
| Subject: | Re: Extending PEAR DB | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-311@lists.php.net to get a copy of this message | ||
Ok, I have some as yet untested code that should add a
DB_FETCHMODE_OBJECT fetchmode that would change the
return type to an object. I've not attached it because
I'm not sure that this is the correct direction to take.
I'm appealing to the group for input. I see two obvious
ways of implementing the return of objects from queries:
adding DB_FETCHMODE_OBJECT, as I have done, and writing
some new functions to support the different data type.
There are good and bad sides to both. Adding a new
FETCHMODE in this way breaks the consistancy of always
returning an array, but allows the use of functions like
getAll() and getRow(). Adding functions adds well, functions
and I have seen some resistance displayed to that idea
in previous discussions on this list.
I'm asking the group to respond because I am a novice with
PEAR, so I'm not yet qualified to define the direction of the
DB module.
I'm sure you're wondering what I'm doing jumping in like this
when I addmittedly don't know PEAR, so I'll explain.
I've been a programmer for a number of years now, but during
the last six months or so I finally picked up PHP. I
immediately fell in love with it, and so started working with
it on a daily basis. While doing some proof of concept work
with PHP I coded a quick and _very_ dirty MySQL database
object. I never intended to keep it, I mainly wrote it to
reduce the amount of typing I had to do. Because it was fast
and I was working with small datasets, the default return for
this object was an array of row objects.
I've since been asked to get this into production as soon as
possible. By far the weakest link in all of my code was that
database object, so I immediately began looking for a published
library that included a robust database layer. I didn't have
to look far to find PEAR, but the specific functionality I need
is, as you know, not yet implemented. I have several pages
that rely on that method that returned an array of rows. Since
the data remains small, I have no reason to change this. It
would be a great deal of work to upgrade the trashy object I
wrote, but I can extend the PEAR DB module to include this
in half a night. Hence, I'm using PEAR
In the great open source tradition, I want to contribute my work
back into the general codebase, so I am asking the group to
give me the proper direction.
Thanks,
Benjamin R. Webb
"Benjamin R. Webb" <brwebb@transmuto.com> wrote:
> All,
> I would like to add a fetchmode to DB, specifically an object mode.
> This would allow support of (for example) mysql_fetch_object().
> I don't, of course, want to do this if a) it's already done or b)
> someone else is working on it. Otherwise, I have a need to get it done
> this week.
> Note: if it's in the latest CVS, I apologize. I know it's not in the
> version I currently have, and I noticed on Tom's tutorial that he
> indicates that it is not yet supported.
> Benjamin R. Webb
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, e-mail: pear-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: pear-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net