diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-08-17 19:46:32 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-08-17 19:46:32 -0300 |
commit | 4b339f44bdaa307004db2345ac9c950d9f508814 (patch) | |
tree | 855748bc8f1df1a8b1d327810be229af05ee522e /activerecord/lib | |
parent | c01c8967a02537f132d437d5ae15332982119651 (diff) | |
parent | 25e5b0c4a8d0045715a6ad11e2898585826e4e9b (diff) | |
download | rails-4b339f44bdaa307004db2345ac9c950d9f508814.tar.gz rails-4b339f44bdaa307004db2345ac9c950d9f508814.tar.bz2 rails-4b339f44bdaa307004db2345ac9c950d9f508814.zip |
Merge commit 'rails/master'
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | 40 |
2 files changed, 3 insertions, 42 deletions
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 4f0b06d1bb..5a49fc2d2f 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. @@ -329,9 +308,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: @@ -446,18 +425,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 |