PATCH: Multiple INI files for DB_DataObject
| From: | Joe Stump | Date: | Fri, 05 Dec 2003 20:56:15 +0000 |
| Subject: | PATCH: Multiple INI files for DB_DataObject | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-24208@lists.php.net to get a copy of this message | ||
I've attached a diff that fixes my earlier problem (NOTE: evidently
attachments don't go to the list - check out
http://professorx.jcssolutions.com/~jstump/DataObject-append-definitions.diff).
My problem was that I
needed to concat 1 -> N database configs into a single [INI] in
$_DB_DATAOBJECT. Here is an example setup:
(all of these ini files are for a single database: "mydb")
/path1/to/database1.ini (contains tables users and test)
/path2/to/database2.ini (contains tables foo and bar)
/path3/to/database3.ini (contains tables sessions and tester)
<?php
DB_DataObject::_appendDefinitions('mydb','/path1/to/database1.ini');
DB_DataObject::_appendDefinitions('mydb','/path2/to/database2.ini');
DB_DataObject::_appendDefinitions('mydb','/path3/to/database3.ini');
?>
Now when you load up a PEAR DBDO you should have all three of the above
INI definitions in your data object along with whatever definition you
have in the data object you are currently using. Also, it keeps track of
which ini files it has already loaded and only loads them once. This also
slighly alters the behavior of _loadDefinitions() (to use
_appendDefinitions()).
I hope this helps someone else. If the author wants me to clean this up
for submission please email me off list.
Flame away!
--Joe
--
Joe Stump <joe@joestump.net>
http://www.joestump.net
"Label makers are proof God wants Sys Admins to be happy."