On Oct 8, 6:25 pm, coolesting <[email protected]> wrote: > Yeah, i am creating multipe Database objects, but the case as not the > same as you said, i not use the block, but with a function for > creating the Sequel connect, the code as the following, > > def db(name, type) > Sequel.connect("#{type}://db/#{name}/data.db") > end > > So, i use the SINATRA as the Controller layer, then, > > get '/' do > blog = db('myblog', 'sqlite') > #do something > #do something > > pictures = db('pictures', 'mysql') > #do something > #do something > > records = db('records', 'postgresql') > #do something > #do something > > end > > after do > #So, we are here for closing the database connect at once. > #What should i do , or we should do nothing. > end
You would probably want to run the following for all of the Database objects you are creating: db.disconnect Sequel::DATABASES.delete(db) The first line disconnects the underlying connections for the database. The second removes the reference that Sequel keeps to the Database objects, allowing them to be garbage collected. I'm not sure why you are creating Database objects inside a Sinatra action. I would generally consider it a bad design, but I suppose depending on your app you may need to do so. Jeremy 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.
