Re: DB_DataObject without ini file
| From: | Alan Knowles | Date: | Mon, 13 Feb 2006 06:12:46 +0000 |
| Subject: | Re: DB_DataObject without ini file | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22945@lists.php.net to get a copy of this message | ||
Try testing the generator in CVS,
http://cvs.php.net/viewcvs.cgi/*checkout*/pear/DB_DataObject/DataObject/Generator.php?content-type=text%2Fplain&rev=1.109&pathrev=1.109
- add the line
generator_no_ini = true
To your config before generating the files, and it should embed the
schema in the class definition.....
Regards
Alan
On Fri, 2006-02-10 at 00:54 +0100, Didier Galland wrote:
> That's right I'm talking about the db.ini file.
> I remember too this thread where someone told that he has altered the
> generator, but I can't retrieve it (anyway he didn't publish his patch)
> nor the guy.
>
> I think the best way would be to write the table() and key() function
> via the derivedHookFunctions() of generator, but I don't know from
> where I must pull the info...
>
> I'm surprised that no one had this problem before...
>
> It would be nice if this become an option when generating tables
> (writing dbname.ini or overriding methods in the class). Alan ;-) ?
>
> Thanks for the help anyway.
>
> Didier
>
> Justin Patrin a écrit :
> > On 2/8/06, Nicholas Costa <ncosta@alum.rpi.edu> wrote:
> >
> >> Didier,
> >>
> >> Sure you can. Set up an array of configuration values and then set
> >> them using PEAR::getStaticProperty. Notice that the options are
> >> retrieved by reference, so that they may be set by the following line
> >> (important for PHP4):
> >>
> >> // DataObjects configuration
> >> $CONFIG['DataObject']['database'] =
> >> "mysql://<user>:<pass>@<host>/
> >> <db>";
> >> $CONFIG['DataObject']['schema_location'] =
> >> "<path/to/schema>";
> >> $CONFIG['DataObject']['class_location'] =
> >> "<path/to/classes>";
> >> $CONFIG['DataObject']['require_prefix'] =
> >> "<prefix>";
> >> $CONFIG['DataObject']['class_prefix'] =
> >> "<prefix>";
> >>
> >> // configure DataObjects
> >> $options = &PEAR::getStaticProperty('DB_DataObject',
> >> 'options');
> >> $options = $CONFIG['DataObject'];
> >>
> >
> > I thought this is what the OP meant as well, but he's talking about
> > the db.ini file which stored the schema info.
> >
> > To do this you can override the table() and key() methods in the
> > DataObjects. *Someone* has altered the generator to do this in the
> > past but it never made it into the main package. Try searching the
> > archives.
> >
> >
> >> -- Nick
> >>
> >>
> >> On Feb 7, 2006, at 10:58 AM, Didier Galland wrote:
> >>
> >>
> >>> Is it possible to use DB_DataObject without the dbname.ini file ?
> >>> I'm using the same auto generated files for multiple databases
> >>> (more than 50 indeed with exactly the same structure) and I have to
> >>> copy the dbname.ini file for each one (and at each structure
> >>> modification). I solved the probleme for dbname.links.ini by
> >>> overriding the links() method in each class file but can't figure
> >>> out how to do a similar thing for database structure.
> >>>
> >>> Maybe it would be possible to use the derivedHookFunctions() or
> >>> derivedHookVar() in this goal, but I don't know how...
> >>>
> >>> Thanks,
> >>>
> >>> Didier
> >>>
> >>>
> >
> > --
> > Justin Patrin
> >
> >
>
>
>
>
>
>
>
> ___________________________________________________________________________
> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels
> pour appeler la France et l'international.
> Téléchargez sur http://fr.messenger.yahoo.com
>