Login | Register
My pages Projects Community openCollabNet

propel
Reply to message

* = Required fields
* Subject
* Body
Attachments
Send reply to
Topic
Author (directly in email)
Please type the letters in the image above.

Original message

Author Robert Bruce <rob@thirddimensiondesign.co.uk>
Full name Robert Bruce <rob@thirddimensiondesign.co.uk>
Date 2007-04-03 17:36:33 PDT
Message Hans Lellelid wrote:
> Robert Bruce wrote:
>
>> Hans Lellelid wrote:
>>
>>
>>> Robert Bruce wrote:
>>>
>>>
>>>
>>>> I want to reuse the generated classes for multiple databases, so
>>>> effectively they exist as part of a shared library for instances of my
>>>> application. However because the DATABASE_NAME constant in the Peer
>>>> classes is set to the name of the database against which they were
>>>> originally built, I can't (to my knowledge) dynamically use a different
>>>> database.
>>>>
>>>>
>>>>
>>> Well, you effectively can change your database at runtime. The
>>> DATABASE_NAME constant is simply an identifier that tells Propel "use
>>> the connection info associated with that key in the configuration file".
>>> The DATABASE_NAME need have no actual relationship with the actual
>>> name of your database in your RDBMS.
>>>
>>> To change a database name (or any other properties of the connection) at
>>> runtime you can use the Propel::setConnection() (I think that's a valid
>>> method...) or setConfiguration().
>>>
>>> Does that help?
>>>
>>> Hans
>>>
>>> --------------------​--------------------​--------------------​---------
>>> To unsubscribe, e-mail: dev-unsubscribe@prop​el.tigris.org
>>> For additional commands, e-mail: dev-help at propel dot tigris dot org
>>>
>>>
>>>
>>>
>> Okay, I understand what you are saying, wouldn't Propel::Init() also set
>> the configuration? As that's the method I've used. So it's actually a
>> DATASOURCE_NAME rather than a DATABASE_NAME ?
>>
>>
> Yes, that's correct -- Propel::init() will work fine too, unless you
> want to change it after Propel was already initialized. Yes, you're
> correct this is a datasource name; thank you - that's a better term for
> me to use in the future. In fact, we should probably rename that for
> Propel 2.0, since this is a cause of much confusion (understandably).
>
> Hans
>
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: dev-unsubscribe@prop​el.tigris.org
> For additional commands, e-mail: dev-help at propel dot tigris dot org
>
>
Just another question, the static method Propel::getDefaultDB is that
meant to return the name of the default database or the name of the
default datasource?