Re: MDB Questions - switching to MDB, failover and so on...
| From: | Raphaël Gertz | Date: | Sun, 16 Jul 2006 16:28:21 +0000 |
| Subject: | Re: MDB Questions - switching to MDB, failover and so on... | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-43494@lists.php.net to get a copy of this message | ||
> Le dimanche 16 juillet 2006 14:49, Matt Friedman a écrit :
> Hi,
>
> We've relied on PEAR::DB and DB_DataObject for quite some time now. But the
> more I read about MDB the more attractive it looks, but I have a couple
> questions.
>
> How hard is it to move from DB to MDB, especially in the context that we
> need to continue to use DB_DataObject? Are the APIs compatible? What steps
> might need to be taken?
>
> Do any of the db layers support automated failover? We were trying to do
> this because we are going to be implementing replication but we found
> things a bit inflexible using just DB so we're probably going to rely on
> hardware failover instead. Has anyone considered this as a feature to add
> on the/a software layer?
>
> Many thanks,
If you simply need the getOne getAll fetchRow option you may switch to MDB2
the only change are that :
$this->db->getAll($req, null, array(), null, MDB2_FETCHMODE_ASSOC);
instead of
$this->db->getAll($req, array(), DB_FETCHMODE_ASSOC);
(if I remember well)
//PEARDB options
$options = array(
'debug' => 2,
'portability' => MDB2_PORTABILITY_ALL
);
//for getOne/getAll
$db->loadModule('Extended');
Last things, for check the error it's easyer :
if (PEAR::isError($object))
instead of the :
if (DB::isError($object))
rest don't change at all...
ps : MDB2 is still not E_STRICT compliant :'(
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]