Skip to content

Commit

Permalink
Add helpful debugging info to the ActiveRecord::StatementInvalid exce…
Browse files Browse the repository at this point in the history
…ption in ActiveRecord::ConnectionAdapters::SqliteAdapter#table_structure. Closes #7925. [court3nay]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6469 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
technoweenie committed Mar 27, 2007
1 parent 777deb9 commit 4b78a2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN* *SVN*


* Add helpful debugging info to the ActiveRecord::StatementInvalid exception in ActiveRecord::ConnectionAdapters::SqliteAdapter#table_structure. Closes #7925. [court3nay]

* SQLite: binary escaping works with $KCODE='u'. #7862 [tsuka] * SQLite: binary escaping works with $KCODE='u'. #7862 [tsuka]


* Base#to_xml supports serialized attributes. #7502 [jonathan] * Base#to_xml supports serialized attributes. #7502 [jonathan]
Expand Down
Expand Up @@ -286,7 +286,7 @@ def rename_column(table_name, column_name, new_column_name) #:nodoc:
protected protected
def table_structure(table_name) def table_structure(table_name)
returning structure = execute("PRAGMA table_info(#{table_name})") do returning structure = execute("PRAGMA table_info(#{table_name})") do
raise ActiveRecord::StatementInvalid if structure.empty? raise(ActiveRecord::StatementInvalid, "Could not find table '#{table_name}'") if structure.empty?
end end
end end


Expand Down Expand Up @@ -384,7 +384,7 @@ def default_primary_key_type
class SQLite3Adapter < SQLiteAdapter # :nodoc: class SQLite3Adapter < SQLiteAdapter # :nodoc:
def table_structure(table_name) def table_structure(table_name)
returning structure = @connection.table_info(table_name) do returning structure = @connection.table_info(table_name) do
raise ActiveRecord::StatementInvalid if structure.empty? raise(ActiveRecord::StatementInvalid, "Could not find table '#{table_name}'") if structure.empty?
end end
end end
end end
Expand Down

0 comments on commit 4b78a2a

Please sign in to comment.