Re: PEAR DB problem
| From: | Hrabcak Rado | Date: | Mon, 03 Feb 2003 13:37:42 +0000 |
| Subject: | Re: PEAR DB problem | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-3576@lists.php.net to get a copy of this message | ||
On Mon, 3 Feb 2003, Markus Wolff wrote:
>Am Mon, 3 Feb 2003 13:47:51 +0100 (CET) schrieb Hrabcak Rado
><hrabcak@phf.euke.sk>:
>
>> I'm trying to do this:
>> I have my own class. I want to use PEAR::DB object in it, which i create
>> in constructor. But it doesn't work as I expected.
>>
>> Here I have links to examples:
>>
>> http://duffy.sk/test/code.phps
>
>Haven´t looked at the other two, but you´re doing the object creation
>wrong. This is what you do:
>
>$this->db = new DB;
>$this->db->connect("pgsql://user@localhost/hrabcak",true);
>
>...and this is what you´re supposed to do:
>
>$this->db = DB::connect("pgsql://user@localhost/hrabcak",true);
>
>With "new DB" you just get an object of the generic DB base class,
>which doesn´t do a lot. Using the factory method DB::connect() gives
>you an object of a driver class specific to the database you´re using
>(in this case, PostgreSQL).
So this is only because a specific situation of PEAR::DB, isn't it?
Because I normally use $this->variable = new Class; and it works.
--
rado (duffy) hrabcak
.
.t-e-l. + 421 905 669 362 .m-a-i-l. duffy@duffy.sk
.i-c-q. 25915231 .w-e-b. www.duffy.sk