Sha256: be89f59142abd9482306e0efe34631e6af74a2ba45d5626f07c473101d2ddf79

Contents?: true

Size: 959 Bytes

Versions: 13

Compression:

Stored size: 959 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(table_name) do
          raise(ActiveRecord::StatementInvalid, "Could not find table '#{table_name}'") if structure.empty?
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
activerecord-2.0.4 lib/active_record/connection_adapters/sqlite3_adapter.rb
activerecord-2.0.5 lib/active_record/connection_adapters/sqlite3_adapter.rb
activerecord-2.0.0 lib/active_record/connection_adapters/sqlite3_adapter.rb
activerecord-2.0.1 lib/active_record/connection_adapters/sqlite3_adapter.rb
activerecord-2.0.2 lib/active_record/connection_adapters/sqlite3_adapter.rb
radiant-0.6.5.1 vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
radiant-0.6.5 vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
radiant-0.6.7 vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
radiant-0.6.6 vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
radiant-0.6.9 vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
radiant-0.6.8 vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
spree-0.0.9 vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
spree-0.2.0 vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb