Skip to content

Commit

Permalink
removing useless code. [rails#4988 state:resolved]
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information
tenderlove authored and jeremy committed Jun 27, 2010
1 parent 8d95453 commit abd568b
Showing 1 changed file with 4 additions and 15 deletions.
Expand Up @@ -151,7 +151,7 @@ def quoted_date(value) #:nodoc:
# DATABASE STATEMENTS ======================================

def execute(sql, name = nil) #:nodoc:
catch_schema_changes { log(sql, name) { @connection.execute(sql) } }
log(sql, name) { @connection.execute(sql) }
end

def update_sql(sql, name = nil) #:nodoc:
Expand All @@ -176,15 +176,15 @@ def select_rows(sql, name = nil)
end

def begin_db_transaction #:nodoc:
catch_schema_changes { @connection.transaction }
@connection.transaction
end

def commit_db_transaction #:nodoc:
catch_schema_changes { @connection.commit }
@connection.commit
end

def rollback_db_transaction #:nodoc:
catch_schema_changes { @connection.rollback }
@connection.rollback
end

# SCHEMA STATEMENTS ========================================
Expand Down Expand Up @@ -391,17 +391,6 @@ def copy_table_contents(from, to, columns, rename = {}) #:nodoc:
end
end

def catch_schema_changes
return yield
rescue ActiveRecord::StatementInvalid => exception
if exception.message =~ /database schema has changed/
reconnect!
retry
else
raise
end
end

def sqlite_version
@sqlite_version ||= SQLiteAdapter::Version.new(select_value('select sqlite_version(*)'))
end
Expand Down

0 comments on commit abd568b

Please sign in to comment.