RE: [PEAR-BUG] Bug #12568 [Opn->Csd]: documentation bug

From: Date: Mon, 03 Dec 2007 07:17:24 +0000
Subject: RE: [PEAR-BUG] Bug #12568 [Opn->Csd]: documentation bug
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-48640@lists.php.net to get a copy of this message
Hi Till! klimpong@gmail.com write: > > On 3 Dec 2007 03:54:55 -0000, PEAR Bug Database > <pear-qa@lists.php.net> wrote: > > (...) > > FYI: This bug existed in two of the examples contained in > the API docs. > > The tutorial at sf.net, i.e. the "End-user Documentation" does not > > contain this bug. > > Ok, glad you fixed it all. :) > > > Are we really about to adopt a "one (public?) class per file" rule? > > I believe it will be announced, or rather proposed within the > next 2 or 3 weeks. I'm all for it > > Btw, I have some other questions about your class. I am on PHP 5.2.3 > when I tested this, my problem is as follows. > > You allow MDB2 to be passed into the class and you test for instanceof > MDB2_Common somewhere in the code. I'm checking for instanceof MDB2_Driver_Common. [1] > My problem is, as soon as I do > MDB2::factory() or MDB2::connect() with a dsn like > "pgsql://foo:bar@localhost/foobar" the object is of type > MDB2_Driver_Pgsql (or similar). So it pretty much failed for me the > entire time. Failed? Is an exception being thrown? If so, with what message? Each MDB2 driver (including MDB2_Driver_pgsql) extends MDB2_Driver_Common. [2] The instanceof operator supports polymorphism, i.e. the following expression evaluates to true unless MDB2::factory() returns an instance of PEAR_Error: MDB2::factory('pgsql://foo:bar@localhost/foobar') instanceof MDB2_Driver_Common > > What did I oversee? > > Second thing is, I frequently create my own DBAL doing this: > > class till_MDB2 extends MDB2 > { > } This shouldn't make any difference. > > Now, this ain't MDB2 either now and I couldn't figure out if I can > recast it so I can re-use my object. Any idea? Could it be that your call to MDB2::factory()/MDB2::connect() returns a PEAR error object? If a PEAR error is passed to XML_Query2XML::factory() a XML_Query2XML_DBException is thrown. [3] > > Cheers, > Till > Cheers, Lukas [1] http://pear.php.net/package/XML_Query2XML/docs/1.5.0/__filesource/fsource_XM L_Query2XML__XML_Query2XML-1.5.0XMLQuery2XML.php.html#a2321 [2] http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Common.html [3] http://pear.php.net/package/XML_Query2XML/docs/1.5.0/__filesource/fsource_XM L_Query2XML__XML_Query2XML-1.5.0XMLQuery2XML.php.html#a2333

« previous php.pear.dev (#48640) next »