Sha256: 36131052993c62eb9749e5520fa4823a3b7c6c199327d59037f6dca10c51b056

Contents?: true

Size: 977 Bytes

Versions: 39

Compression:

Stored size: 977 Bytes

Contents

require 'active_record/connection_adapters/sqlite_adapter'

module ActiveRecord
  class Base
    # sqlite3 adapter reuses sqlite_connection.
    def self.sqlite3_connection(config) # :nodoc:
      parse_sqlite_config!(config)

      unless self.class.const_defined?(:SQLite3)
        require_library_or_gem(config[:adapter])
      end

      db = SQLite3::Database.new(
        config[:database],
        :results_as_hash => true,
        :type_translation => false
      )

      db.busy_timeout(config[:timeout]) unless config[:timeout].nil?

      ConnectionAdapters::SQLite3Adapter.new(db, logger)
    end
  end

  module ConnectionAdapters #:nodoc:
    class SQLite3Adapter < SQLiteAdapter # :nodoc:
      def table_structure(table_name)
        returning structure = @connection.table_info(quote_table_name(table_name)) do
          raise(ActiveRecord::StatementInvalid, "Could not find table '#{table_name}'") if structure.empty?
        end
      end
    end
  end
end

Version data entries

39 entries across 38 versions & 12 rubygems

Version Path
3mix-castronaut-0.5.0.2 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
masover-castronaut-0.4.4.4 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
masover-castronaut-0.4.4.5 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
masover-castronaut-0.5.0.1 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
p8-castronaut-0.6.1.1 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.4.1 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.4.2 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.4.3 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.4.4 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.4.5 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.4.6 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.5.0 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.5.1 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.5.2 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.5.3 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.5.4 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.6.0 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.6.1 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.7.4 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
relevance-castronaut-0.7.5 vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb