From 25e5b0c4a8d0045715a6ad11e2898585826e4e9b Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Mon, 17 Aug 2009 13:56:59 +0100 Subject: Remove support for SQLite 2. If you're still using it, please install the plugin from git://github.com/rails/sqlite2_adapter.git --- .../connection_adapters/sqlite3_adapter.rb | 5 --- .../connection_adapters/sqlite_adapter.rb | 40 ++-------------------- 2 files changed, 3 insertions(+), 42 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index 5eef692d05..d933bc924d 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -24,11 +24,6 @@ module ActiveRecord module ConnectionAdapters #:nodoc: class SQLite3Adapter < SQLiteAdapter # :nodoc: - def table_structure(table_name) - structure = @connection.table_info(quote_table_name(table_name)) - raise(ActiveRecord::StatementInvalid, "Could not find table '#{table_name}'") if structure.empty? - structure - end end end end diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 0c18c38642..5ed7094169 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -4,27 +4,6 @@ require 'active_support/core_ext/kernel/requires' module ActiveRecord class Base class << self - # Establishes a connection to the database that's used by all Active Record objects - def sqlite_connection(config) # :nodoc: - parse_sqlite_config!(config) - - unless self.class.const_defined?(:SQLite) - require_library_or_gem(config[:adapter]) - - db = SQLite::Database.new(config[:database], 0) - db.show_datatypes = "ON" if !defined? SQLite::Version - db.results_as_hash = true if defined? SQLite::Version - db.type_translation = false - - # "Downgrade" deprecated sqlite API - if SQLite.const_defined?(:Version) - ConnectionAdapters::SQLite2Adapter.new(db, logger, config) - else - ConnectionAdapters::DeprecatedSQLiteAdapter.new(db, logger, config) - end - end - end - private def parse_sqlite_config!(config) # Require database. @@ -328,9 +307,9 @@ module ActiveRecord end def table_structure(table_name) - returning structure = execute("PRAGMA table_info(#{quote_table_name(table_name)})") do - raise(ActiveRecord::StatementInvalid, "Could not find table '#{table_name}'") if structure.empty? - end + structure = @connection.table_info(quote_table_name(table_name)) + raise(ActiveRecord::StatementInvalid, "Could not find table '#{table_name}'") if structure.empty? + structure end def alter_table(table_name, options = {}) #:nodoc: @@ -445,18 +424,5 @@ module ActiveRecord end end - - class SQLite2Adapter < SQLiteAdapter # :nodoc: - def rename_table(name, new_name) - move_table(name, new_name) - end - end - - class DeprecatedSQLiteAdapter < SQLite2Adapter # :nodoc: - def insert(sql, name = nil, pk = nil, id_value = nil) - execute(sql, name = nil) - id_value || @connection.last_insert_rowid - end - end end end -- cgit v1.2.3