For 1) I meant to say that whenever a connection to an sqlite adapter is made, either by Sequel.connect('sqlite://....') or by Sequel.sqlite(), the options hash always includes after_connect: with a callable object of my choice
On Thursday, July 25, 2013 12:18:50 PM UTC-4, Heberto del Rio wrote: > > That works!, thanks > > Another question: > > 1.- I want to redefine the method connect when it is called either by > Sequel.connect('sqlite://....') or by Sequel.sqlite(.... so that it always > includes: after_connect: a_callable_object to have a default behavior for > all the stablished connections. > > 2.- I want to redefine the method complex_expression_sql_append in > lib/sequel/adapters/shared/sqlite.rb > > How do I do this? Should I open the classes Sequel::SQLite::Database and > Sequel::SQLite::DatasetMethods and work inside them by calling super ... or > there is a better way? > > Heberto del Rio > > On Thursday, July 25, 2013 10:21:23 AM UTC-4, Jeremy Evans wrote: >> >> On Thursday, July 25, 2013 6:07:38 AM UTC-7, Heberto del Rio wrote: >> >>> The point for me is, even in case it is decided not to implement this >>> option in SQLite, how to have access to the SQLite::Database connection >>> created when the user call Sequel.connect('sqlite://...') or Sequel.sqlite, >>> so it is up to the user to call the create_function. The only way I have >>> found (but that is due to my lack of knowledge on Sequel, I'm a newbie) is >>> to do the following: DB.pool.first.create_function(...., but it is not >>> clean, in my opinion. Is there any option on the framework to have access >>> to the actual connection (after initialization) in order to do things like >>> these? >> >> >> Use the :after_connect Database option. It accepts a callable value that >> is called with each underlying connection created by the connection pool. >> >> Thanks, >> Jeremy >> > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to sequel-talk+unsubscr...@googlegroups.com. To post to this group, send email to sequel-talk@googlegroups.com. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/groups/opt_out.