Re: db_dataobject and multiple databases
| From: | Matthew Deir | Date: | Wed, 18 Oct 2006 19:35:16 +0000 |
| Subject: | Re: db_dataobject and multiple databases | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25535@lists.php.net to get a copy of this message | ||
HI Ian,
Thanks for the quick reply.
I'm using an array:
$do_options = &PEAR::getStaticProperty('DB_DataObject','options');
$do_options = array(
// 'database' => 'mysql://apache:apache@localhost /mysql', 'database_adv_star' => 'mysql://apache:apache@localhost/adv_star', 'database_adv_massmail' => 'mysql://apache:apache@localhost/adv_massmail',
'database_adv_mailtracking' => ' mysql://apache:apache@localhost/adv_mailtracking',
'database_adv_reports' => 'mysql://apache:apache@localhost/adv_reports',
'database_adv_ats' => 'mysql://apache:apache@localhost/adv_ats','schema_location' => $GLOBALS['framework']['root']."/system/dataobjects", 'class_location' => $GLOBALS['framework']['root']."/system/dataobjects", 'require_prefix' => 'dataobjects/',
'class_prefix' => 'DO_'); On 10/18/06, Ian Warner <iwarner@triangle-solutions.com> wrote:
Matthew Deir wrote:
Hi,
I'm having difficulty getting db_dataobject setup correctly with
multiple databases that contain tables with the same name. I'm using
createTables.php to generate the classes but of course only one file
is created for the table that appears in several databases. Has
anyone run into anything similar? Any guidance is appreciated.
Info is here 3/4s down
http://pear.php.net/manual/en/package.database.db-dataobject.intro-configuration.php
Please send some code of what you are doing now, are you using ini? Array?
ie i think this is how you do it if i remember schema and all other
stuff are in the one place
hope that helps:
// Create the array of options for DataObjects
$config['DB_DataObject'] = array(
'database_admin' => 'mysqli://USER:PASS@localhost/admin',
'database_other' => 'mysqli://USER:PASS@localhost/other',
'schema_location' => ADMIN_DO . 'admin/schema',
'class_location' => ADMIN_DO . 'admin',
'require_prefix' => ADMIN_DO . 'admin',
'class_prefix' => 'DO_',
'db_driver' => 'MDB2',
'extends_location' => ADMIN_DO . 'admin/Inter.php',
'extends' => 'DB_Inter');
$options = &PEAR::getStaticProperty('DB_DataObject', 'options');
$options = $config['DB_DataObject'];
Thanks,
Matt.