Re: Extending Pear DB class. Is it possible?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It appears that you want to extend DB_coomon not DB. The reason is because

    $dbh = MyDB::connect( $dsn );

returns an instance of the DB_common class. However, DB_common is the base
class for writing a PEAR DB driver class.  And, what is really returned by
DB::connect() is an instance of the driver class that extends DB_comon.
Creating a MyDB_Common will not work either, unless you edit all the DB
database driver class files to extend MyDB_common instead of DB_Common. If
you are doing this for a specific database, then what you should is extend
the corresponding driver class, i.e, mymysql.php.  You would then use
'mymysql' instead of 'mysql' as the driver name.

What functionallity do you wish to add to DB?

-- bob

On Mon, 17 May 2004, Ross Honniball wrote:

> Hi all,
>
> I'd like to extend the standard Pear DB class, but there is something a bit
> curly about it.
>
> PHP lets me create a class like:
>
>    class mydb extends DB {  functions etc. }
>
> however the new class mydb will not include all the functions. I think it
> is only including all the functions defined in the 'common.php' file.
>
> The 'mydb' class above won't, for example, have the 'query' function, even
> after successfully connecting to a database.
>
> Anyone know how to go about extending the Pear DB class?
> .
> . Ross Honniball. JCU Bookshop Cairns, Qld, Australia.
> .
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux