diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-05 10:21:14 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-05 10:21:14 -0700 |
commit | d5e45931a0f3d36515d6048fd9cb13f641018571 (patch) | |
tree | 7d570ed6449649b625d43e70012f325da3d54ffc /activerecord | |
parent | 0f45f2366945a19e1413d15608b917e1b7987fa5 (diff) | |
download | rails-d5e45931a0f3d36515d6048fd9cb13f641018571.tar.gz rails-d5e45931a0f3d36515d6048fd9cb13f641018571.tar.bz2 rails-d5e45931a0f3d36515d6048fd9cb13f641018571.zip |
renaming exec in the mysql adapter
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/mysql/connection_test.rb | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 7d47d06ae1..ce2352486b 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -326,7 +326,7 @@ module ActiveRecord @statements.clear end - def exec(sql, name = 'SQL', binds = []) + def exec_query(sql, name = 'SQL', binds = []) log(sql, name) do result = nil @@ -708,7 +708,7 @@ module ActiveRecord def select(sql, name = nil, binds = []) @connection.query_with_result = true - rows = exec(sql, name, binds).to_a + rows = exec_query(sql, name, binds).to_a @connection.more_results && @connection.next_result # invoking stored procedures with CLIENT_MULTI_RESULTS requires this to tidy up else connection will be dropped rows end diff --git a/activerecord/test/cases/adapters/mysql/connection_test.rb b/activerecord/test/cases/adapters/mysql/connection_test.rb index 67bd8ec7e0..62ffde558f 100644 --- a/activerecord/test/cases/adapters/mysql/connection_test.rb +++ b/activerecord/test/cases/adapters/mysql/connection_test.rb @@ -49,18 +49,18 @@ class MysqlConnectionTest < ActiveRecord::TestCase end def test_exec_no_binds - @connection.exec('drop table if exists ex') - @connection.exec(<<-eosql) + @connection.exec_query('drop table if exists ex') + @connection.exec_query(<<-eosql) CREATE TABLE `ex` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `data` varchar(255)) eosql - result = @connection.exec('SELECT id, data FROM ex') + result = @connection.exec_query('SELECT id, data FROM ex') assert_equal 0, result.rows.length assert_equal 2, result.columns.length assert_equal %w{ id data }, result.columns - @connection.exec('INSERT INTO ex (id, data) VALUES (1, "foo")') - result = @connection.exec('SELECT id, data FROM ex') + @connection.exec_query('INSERT INTO ex (id, data) VALUES (1, "foo")') + result = @connection.exec_query('SELECT id, data FROM ex') assert_equal 1, result.rows.length assert_equal 2, result.columns.length @@ -68,13 +68,13 @@ class MysqlConnectionTest < ActiveRecord::TestCase end def test_exec_with_binds - @connection.exec('drop table if exists ex') - @connection.exec(<<-eosql) + @connection.exec_query('drop table if exists ex') + @connection.exec_query(<<-eosql) CREATE TABLE `ex` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `data` varchar(255)) eosql - @connection.exec('INSERT INTO ex (id, data) VALUES (1, "foo")') - result = @connection.exec( + @connection.exec_query('INSERT INTO ex (id, data) VALUES (1, "foo")') + result = @connection.exec_query( 'SELECT id, data FROM ex WHERE id = ?', nil, [[nil, 1]]) assert_equal 1, result.rows.length @@ -84,15 +84,15 @@ class MysqlConnectionTest < ActiveRecord::TestCase end def test_exec_typecasts_bind_vals - @connection.exec('drop table if exists ex') - @connection.exec(<<-eosql) + @connection.exec_query('drop table if exists ex') + @connection.exec_query(<<-eosql) CREATE TABLE `ex` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `data` varchar(255)) eosql - @connection.exec('INSERT INTO ex (id, data) VALUES (1, "foo")') + @connection.exec_query('INSERT INTO ex (id, data) VALUES (1, "foo")') column = @connection.columns('ex').find { |col| col.name == 'id' } - result = @connection.exec( + result = @connection.exec_query( 'SELECT id, data FROM ex WHERE id = ?', nil, [[column, '1-fuu']]) assert_equal 1, result.rows.length |