| Author |
Message |
|
| haoboy |
Posted: Tue Aug 28, 2007 7:28 am |
|
|
|
Joined: 20 Jul 2007
Posts: 3
|
Has anyone played with mysql connection pooling in erlyweb? Any
catches here?
If I want to have two connection pools (such as to two databases), is
there an easy way to send the pool ID through all the plumbings of
erlydb-generated code to mysql driver?
Thanks.
- Haobo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Aug 28, 2007 8:12 am |
|
|
|
Guest
|
There isn't an easy way right now, but it would be easy to add an easy way
Let the models define a function such as
extra_erlydb_options() ->
[{pool_id, Id}].
and then in line 258 of erlydb.erl, check if this function is defined,
and if it is, append those extra options to the Options variable:
{ok, M80} = smerl:curry_replace(M70, driver, 1, [{DriverMod, Options}]),
Let me know if you encounter any problems.
Yariv
On 8/28/07, Haobo Yu <haoboy@gmail.com> wrote:
>
> Has anyone played with mysql connection pooling in erlyweb? Any
> catches here?
>
> If I want to have two connection pools (such as to two databases), is
> there an easy way to send the pool ID through all the plumbings of
> erlydb-generated code to mysql driver?
>
> Thanks.
>
> - Haobo
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Aug 28, 2007 8:29 am |
|
|
|
Guest
|
Actually, I forgot that you need to also get the database metadata
from the other connection pool. I'll have to think about the easiest
way for doing that...
On 8/28/07, Yariv Sadan <yarivsadan@gmail.com> wrote:
> There isn't an easy way right now, but it would be easy to add an easy way
>
> Let the models define a function such as
>
> extra_erlydb_options() ->
> [{pool_id, Id}].
>
> and then in line 258 of erlydb.erl, check if this function is defined,
> and if it is, append those extra options to the Options variable:
>
> {ok, M80} = smerl:curry_replace(M70, driver, 1, [{DriverMod, Options}]),
>
> Let me know if you encounter any problems.
>
> Yariv
>
> On 8/28/07, Haobo Yu <haoboy@gmail.com> wrote:
> >
> > Has anyone played with mysql connection pooling in erlyweb? Any
> > catches here?
> >
> > If I want to have two connection pools (such as to two databases), is
> > there an easy way to send the pool ID through all the plumbings of
> > erlydb-generated code to mysql driver?
> >
> > Thanks.
> >
> > - Haobo
> >
> >
> > > >
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Aug 28, 2007 8:35 am |
|
|
|
Guest
|
Ok... I think the best way to do it is to change the get_metadata()
function to return a list of {PoolId, Metadata} tuples (PoolId values
would come from the Options passed into erlydb:code_gen()). Then
erlydb:process_module() would have to be changed to so that before
generating the code for the mode, it takes into account the module's
pool_id value from the module's extra_erlydb_options() function (if
any) and matches it against the metadata for the connection pool. If
the module's pool_id option doesn't match any available metadata, or
if the module's table isn't found in the metadata, an error should be
thrown.
Let me know if you want to implement this. Otherwise, I'll do it
tomorrow or later this week.
Yariv
On 8/28/07, Yariv Sadan <yarivsadan@gmail.com> wrote:
> Actually, I forgot that you need to also get the database metadata
> from the other connection pool. I'll have to think about the easiest
> way for doing that...
>
> On 8/28/07, Yariv Sadan <yarivsadan@gmail.com> wrote:
> > There isn't an easy way right now, but it would be easy to add an easy way
> >
> > Let the models define a function such as
> >
> > extra_erlydb_options() ->
> > [{pool_id, Id}].
> >
> > and then in line 258 of erlydb.erl, check if this function is defined,
> > and if it is, append those extra options to the Options variable:
> >
> > {ok, M80} = smerl:curry_replace(M70, driver, 1, [{DriverMod, Options}]),
> >
> > Let me know if you encounter any problems.
> >
> > Yariv
> >
> > On 8/28/07, Haobo Yu <haoboy@gmail.com> wrote:
> > >
> > > Has anyone played with mysql connection pooling in erlyweb? Any
> > > catches here?
> > >
> > > If I want to have two connection pools (such as to two databases), is
> > > there an easy way to send the pool ID through all the plumbings of
> > > erlydb-generated code to mysql driver?
> > >
> > > Thanks.
> > >
> > > - Haobo
> > >
> > >
> > > > > >
> > >
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post recived from mailinglist |
|
|
| Back to top |
|
| haoboy |
Posted: Tue Aug 28, 2007 12:51 pm |
|
|
|
Joined: 20 Jul 2007
Posts: 3
|
Yariv,
I'd love to contribute but may not get to it this week. Please go
ahead and I'll chime in when appropriate.
Thanks.
- Haobo
On Aug 28, 2007, at 4:32 PM, Yariv Sadan wrote:
>
> Ok... I think the best way to do it is to change the get_metadata()
> function to return a list of {PoolId, Metadata} tuples (PoolId values
> would come from the Options passed into erlydb:code_gen()). Then
> erlydb:process_module() would have to be changed to so that before
> generating the code for the mode, it takes into account the module's
> pool_id value from the module's extra_erlydb_options() function (if
> any) and matches it against the metadata for the connection pool. If
> the module's pool_id option doesn't match any available metadata, or
> if the module's table isn't found in the metadata, an error should be
> thrown.
>
> Let me know if you want to implement this. Otherwise, I'll do it
> tomorrow or later this week.
>
> Yariv
>
> On 8/28/07, Yariv Sadan <yarivsadan@gmail.com> wrote:
>> Actually, I forgot that you need to also get the database metadata
>> from the other connection pool. I'll have to think about the easiest
>> way for doing that...
>>
>> On 8/28/07, Yariv Sadan <yarivsadan@gmail.com> wrote:
>>> There isn't an easy way right now, but it would be easy to add an
>>> easy way
>>>
>>> Let the models define a function such as
>>>
>>> extra_erlydb_options() ->
>>> [{pool_id, Id}].
>>>
>>> and then in line 258 of erlydb.erl, check if this function is
>>> defined,
>>> and if it is, append those extra options to the Options variable:
>>>
>>> {ok, M80} = smerl:curry_replace(M70, driver, 1, [{DriverMod,
>>> Options}]),
>>>
>>> Let me know if you encounter any problems.
>>>
>>> Yariv
>>>
>>> On 8/28/07, Haobo Yu <haoboy@gmail.com> wrote:
>>>>
>>>> Has anyone played with mysql connection pooling in erlyweb? Any
>>>> catches here?
>>>>
>>>> If I want to have two connection pools (such as to two
>>>> databases), is
>>>> there an easy way to send the pool ID through all the plumbings of
>>>> erlydb-generated code to mysql driver?
>>>>
>>>> Thanks.
>>>>
>>>> - Haobo
>>>>
>>>>
>>>>>>>
>>>>
>>>
>>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post recived from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|