On Jan 1, 4:51 pm, "Tim Uckun" <[email protected]> wrote: > I want to port some of my code from DBI to sequel. > > Currently I have a class which holds a reference to an internal DBI database > connection but I thought as long as I am rewriting it I might consider > something a little more elegant. > > What would be the recommended way to extend sequel. For example I would > like people to use my code like this. > > db=DefaultDatabase.new(url) > > db.for_each_customer_database { | db| do_something} > > the idea is that my code knows where the default database server is, it > knows which databases in that server belongs to which customers etc... > > Should I take the same approach as before and store the sequel connection as > a class variable? Should I monkeypatch? Should I mix the sequel module?
Mixing in the Sequel module probably would not get you what you want. Storing the connection as a class variable wouldn't either, since Sequel uses a connection pool. I'm not sure what functionality you want to change. If you want to extend the connection objects themselves, you'll need to subclass an existing adapter. If you want to extend the Database objects, you can subclass Sequel::Database. You'll need to post a more specific example in order to get better support. Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
