From 3f4cbccb9cf4cf03ce81c43cbd155a818df4c04f Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Tue, 30 Jan 2007 03:14:55 +0000 Subject: When dealing with SQLite3, use the table_info pragma helper, so that the bindings can do some translation for when sqlite3 breaks incompatibly between point releases. Also, make current_adapter? use is_a? instead of instance_of? to account correctly for adapter subclassing. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6091 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_record/connection_adapters/sqlite_adapter.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 199f53b8a7..da4efd394f 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -22,7 +22,7 @@ module ActiveRecord db.busy_timeout(config[:timeout]) unless config[:timeout].nil? - ConnectionAdapters::SQLiteAdapter.new(db, logger) + ConnectionAdapters::SQLite3Adapter.new(db, logger) end # Establishes a connection to the database that's used by all Active Record objects @@ -381,6 +381,14 @@ module ActiveRecord end end + class SQLite3Adapter < SQLiteAdapter # :nodoc: + def table_structure(table_name) + returning structure = @connection.table_info(table_name) do + raise ActiveRecord::StatementInvalid if structure.empty? + end + end + end + class SQLite2Adapter < SQLiteAdapter # :nodoc: def supports_count_distinct? #:nodoc: false -- cgit v1.2.3