On Fri, Apr 20, 2012 at 06:11:02PM +0200, Rafael Fernández López wrote: > Hello all, > > Ok, so here is the report. Studying the source code I got to the interesting > part: > > connection_specification.rb (in activerecord/connection_adapters/abstract) > > def self.establish_connection(spec = ENV["DATABASE_URL"]) > … > remove_connection > connection_handler.establish_connection name, spec > end > > And here is where all the work comes… I tracked all this process, and the > "problem" resides in that sqlite3 gem as well as the sqlite_adapter.rb (in > active_record/connection_adapters) does not implement the "connect" method. > > The sqlite gem only performs a sqlite3_open call in the initialize method. > There is a close method, but there isn't an open method. So the dummy one is > called that does nothing, and you end with only the new closed connection. > And a nice point to remark is also that this only happens when we have DDL > transactions. With DDL transactions disabled (as in my previous email) the > connection is recreated instead of reopened, and for this reason this works > out of the box.
I don't understand this at all. Simply instantiating a SQLite database object will give you an open connection: db = SQLite3::Database.new ':memory:' # => it's open now -- Aaron Patterson http://tenderlovemaking.com/
pgp3aQtvgvau1.pgp
Description: PGP signature
