473,324 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

PEAR DB_DataObject auto-generator multiple databases

Tom
I'm using the DB_DataObject script createTables.php to auto-generate
the necessary database schema on two databases. Using the .ini
approach (not the in-line PHP approach) to configure DB_DataObject in
my script. Everything is by the book, but I'm having a big problem:

Here's my main.ini file:
[DB_DataObject]

database_one = mysql://user:password@localhost/one
database_two = mysql://user:password@localhost/one
schema_location = /home/user/classes/dataobjects
class_location = /home/user/classes/dataobjects
require_prefix = /home/user/classes/dataobjects
class_prefix = DataObject_

And here's my database connect file:
<?php
// separate classes for each database
class DataObject_one extends DB_DataObject { var $_database = 'one'; }
class DataObject_two extends DB_DataObject { var $_database = 'two'; }
$config = parse_ini_file('/home/user/classes/main.ini', TRUE);
foreach($config as $class=>$value) {
$options = &PEAR::getStaticProperty($class,'options');
$options = $value;
}
$DB = DataObject_one::factory("tableName");
// etc...
?>

The problem is that the auto-generator createTables.php copies
everything into one directory, regardless of the number of databases
you enter in your .ini file, which means, as is the case for me in this
example, if you have two tables with the same name on different
databases, it'll keep overwriting the same file, and the resulting
class is the LAST one you enter in your .ini file.

So my question is this: is there a way to specify different
subdirectories for different databases in your initial configuration
file? If not, is there no other solution than giving every table a
unique name across an entire MySQL server if you don't want to do any
coding?

Any insight is much appreciated !

Dec 15 '06 #1
0 1648

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sarah | last post by:
I'm having problems getting the FormBuilder package to work. I've spent the last 3hrs reading what little documentation and examples I could find and the idea seems great, if only it'll actually...
3
by: junkmail | last post by:
on a win 2k server apparantly it is saying i dont have it. or it cant find it. im using mySQL 4.1 php 4.3.x apache 3.0.53 im new to php and am doing some tutorials, but when i run the sripts...
0
by: Christian Decker | last post by:
Hi, I'm pretty new to Object Oriented design in PHP (although I'm using PHP since a long time, and I also code with Java, so this is not a problem for me) and I need some help with...
7
by: Michael G | last post by:
Hi, Is PEAR DB worth using? Slower? Other problems? Or should a person just wrap db functions in a user-defined class? Mike
1
by: IchBin | last post by:
I am new to PHP and I am running on Windoze XP SP 2. Just noticed that the PEAR installed dir structure I have (to DB subdir) is : C:\php5.2\PEAR\pear\DB My registry vars are:...
1
by: hel | last post by:
Hi I have just adopted a PHP project and need some help understanding DB_DataObject. I've looked around on the web and can't find a simple explanation. Basically, my MySQL database has no...
0
by: Ken Loomis | last post by:
Hello: On Fedora Core 5 - PHP5 I have read the installation and configure portions of the PHP Manual and searched the web and newsgroups for hours and I cannot figure out whether I can simply...
1
by: IchBin | last post by:
I remember having problems with pear when I first installed it but got it running some time ago. This is on a windoze XP SP OS. I did not think it was correct because it pointed to...
1
by: mmr315 | last post by:
pl help me how to use DB_DataObject database abstraction layer class in php
2
by: Sam | last post by:
Recently started using DB_DataObject with a Postgresql DB. Seems pretty nice, but I am not sure if insert() is supposed to be able to return the id of a recently returned object. It just seems to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.