Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [propel-dev] Peer::DATABASE_NAME

propel
Discussion topic

Back to topic list

Re: [propel-dev] Peer::DATABASE_NAME

Reply

Author Robert Bruce <rob at tdd dot org dot uk>
Full name Robert Bruce <rob at tdd dot org dot uk>
Date 2007-04-04 04:17:52 PDT
Message On Wed, April 4, 2007 12:08 pm, Hans Lellelid wrote:
> Robert Bruce wrote:
>> 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?
>
> Default datasource. The only place Propel is actually [indirectly]
> concerned with database name is when it creates the connection. Even
> then, it's just passing the DSN you provide in runtime conf to the the
> PDO constructor, so it never actually knows what the name of the
> database is. (And with databases like SQLite there's only a filename,
> not an separate database name.)
>
> 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, so like your suggestion to rename, there are a few places in which
this leads to confusion, even the description of the method getDefaultDB
in the php doc comments says it's getting the default database name.

Rob

« Previous message in topic | 44 of 44 | Next message in topic »

Messages

Show all messages in topic

Powered by propel? Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2007-02-16 05:47:19 PST
     Re: [propel-dev] Powered by propel? Robert Bruce <rob at tdd dot org dot uk> Robert Bruce <rob at tdd dot org dot uk> 2007-02-16 06:53:40 PST
         Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 07:03:42 PST
             Re: [propel-dev] Powered by propel? Robert Bruce <rob at tdd dot org dot uk> Robert Bruce <rob at tdd dot org dot uk> 2007-02-16 08:03:56 PST
                 Re: [propel-dev] Powered by propel? Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2007-02-16 07:05:19 PST
                     Re: [propel-dev] Powered by propel? Robert Bruce <rob at tdd dot org dot uk> Robert Bruce <rob at tdd dot org dot uk> 2007-02-16 08:09:30 PST
                         Re: [propel-dev] Powered by propel? Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2007-02-16 07:11:14 PST
                         Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 07:14:41 PST
                 Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 07:15:28 PST
             Re: [propel-dev] Powered by propel? Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2007-02-16 07:06:55 PST
                 Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 07:13:31 PST
                     Re: [propel-dev] Powered by propel? Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2007-02-16 07:14:19 PST
                         Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 07:20:43 PST
                             Re: [propel-dev] Powered by propel? Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2007-02-16 07:31:14 PST
                                 Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 07:36:55 PST
                                     Re: [propel-dev] Powered by propel? Robert Bruce <rob at tdd dot org dot uk> Robert Bruce <rob at tdd dot org dot uk> 2007-02-16 08:47:38 PST
                                         Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 07:55:58 PST
             Re: [propel-dev] Powered by propel? =?ISO-8859-1?Q?David_Z=FClke?= <dz at bitxtender dot com> =?ISO-8859-1?Q?David_Z=FClke?= <dz at bitxtender dot com> 2007-02-16 14:36:45 PST
                 Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 14:41:00 PST
                     Re: [propel-dev] Powered by propel? Robert Bruce <rob at thirddimensiondesign dot co dot uk> Robert Bruce <rob at thirddimensiondesign dot co dot uk> 2007-02-16 15:26:45 PST
                         Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 16:22:22 PST
                         Re: [propel-dev] Powered by propel? Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2007-02-16 17:18:24 PST
                             Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 17:57:01 PST
                                 Re: [propel-dev] Powered by propel? hlellelid Hans Lellelid 2007-02-16 18:01:04 PST
                                     Re: [propel-dev] Powered by propel? Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2007-02-16 18:39:56 PST
Page: of 2 « Previous | Next »
Messages per page: