Sha256: 3998bfb57e86e59f6920b1d022a436b22e9e623f66f871baa8575d51a1c87f9e

Contents?: true

Size: 1.25 KB

Versions: 9

Compression:

Stored size: 1.25 KB

Contents

# frozen-string-literal: true

Sequel::DataObjects.load_driver 'do_sqlite3'
Sequel.require 'adapters/shared/sqlite'

module Sequel
  module DataObjects
    Sequel.synchronize do
      DATABASE_SETUP[:sqlite3] = proc do |db|
        db.extend(Sequel::DataObjects::SQLite::DatabaseMethods)
        db.extend_datasets Sequel::SQLite::DatasetMethods
        db.set_integer_booleans
      end
    end

    # Database and Dataset support for SQLite databases accessed via DataObjects.
    module SQLite
      # Instance methods for SQLite Database objects accessed via DataObjects.
      module DatabaseMethods
        extend Sequel::Database::ResetIdentifierMangling
        include Sequel::SQLite::DatabaseMethods
        
        private
        
        # Default to a single connection for a memory database.
        def connection_pool_default_options
          o = super
          uri == 'sqlite3::memory:' ? o.merge(:max_connections=>1) : o
        end
        
        # Execute the connection pragmas on the connection
        def setup_connection(conn)
          connection_pragmas.each do |s|
            com = conn.create_command(s)
            log_connection_yield(s, conn){com.execute_non_query}
          end
          super
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
sequel-4.41.0 lib/sequel/adapters/do/sqlite3.rb
sequel-4.40.0 lib/sequel/adapters/do/sqlite3.rb
sequel-4.39.0 lib/sequel/adapters/do/sqlite3.rb
tdiary-5.0.2 vendor/bundle/gems/sequel-4.37.0/lib/sequel/adapters/do/sqlite3.rb
sequel-4.38.0 lib/sequel/adapters/do/sqlite3.rb
sequel-4.37.0 lib/sequel/adapters/do/sqlite3.rb
sequel-4.36.0 lib/sequel/adapters/do/sqlite3.rb
tdiary-5.0.1 vendor/bundle/gems/sequel-4.35.0/lib/sequel/adapters/do/sqlite3.rb
sequel-4.35.0 lib/sequel/adapters/do/sqlite3.rb