Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 909

Show
Ignore:
Timestamp:
03/14/05 23:48:39 (4 years ago)
Author:
david
Message:

Fixed that SQLite3 exceptions are caught and reported properly #823 [yerejm]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r898 r909  
    11*SVN* 
     2 
     3* Fixed that SQLite3 exceptions are caught and reported properly #823 [yerejm] 
    24 
    35* Added that all types of after_find/after_initialized callbacks are triggered if the explicit implementation is present, not only the explicit implementation itself 
  • trunk/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb

    r885 r909  
    406406              nil 
    407407            end 
    408           rescue => e 
     408          rescue Exception => e 
    409409            log_info("#{e.message}: #{sql}", name, 0) 
    410410            raise ActiveRecord::StatementInvalid, "#{e.message}: #{sql}" 
  • trunk/activerecord/test/connections/native_sqlite/connection.rb

    r652 r909  
    1414  unless File.exist?(db_file) 
    1515    puts "SQLite database not found at #{db_file}. Rebuilding it." 
    16     sqlite_command = "sqlite #{db_file} 'create table a (a integer); drop table a;'" 
     16    sqlite_command = %Q{sqlite #{db_file} "create table a (a integer); drop table a;"} 
    1717    puts "Executing '#{sqlite_command}'" 
    1818    raise SqliteError.new("Seems that there is no sqlite executable available") unless system(sqlite_command) 
  • trunk/activerecord/test/connections/native_sqlite3/connection.rb

    r652 r909  
    1414  unless File.exist?(db_file) 
    1515    puts "SQLite3 database not found at #{db_file}. Rebuilding it." 
    16     sqlite_command = "sqlite3 #{db_file} 'create table a (a integer); drop table a;'" 
     16    sqlite_command = %Q{sqlite3 #{db_file} "create table a (a integer); drop table a;"} 
    1717    puts "Executing '#{sqlite_command}'" 
    1818    raise SqliteError.new("Seems that there is no sqlite3 executable available") unless system(sqlite_command) 
  • trunk/activerecord/test/finder_test.rb

    r666 r909  
    232232    assert_equal 1, topics.size 
    233233    assert_equal "Mary", topics[0].author_name 
     234  end 
     235 
     236  def test_find_with_bad_sql 
     237    assert_raises(ActiveRecord::StatementInvalid) { Topic.find_by_sql "select 1 from badtable" } 
    234238  end 
    235239