aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-15 16:11:48 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-26 13:44:09 -0700
commitffb999125a60cbdcee2e6709df019d55f21b22a6 (patch)
treef533122d42061e74b5ffe2b5055fb6fa58edd3be /activerecord/test/cases
parenteb83eb6c98ae95a994dcac07d2c6246f7fd61962 (diff)
downloadrails-ffb999125a60cbdcee2e6709df019d55f21b22a6.tar.gz
rails-ffb999125a60cbdcee2e6709df019d55f21b22a6.tar.bz2
rails-ffb999125a60cbdcee2e6709df019d55f21b22a6.zip
initial exec() method is working in pg adapter
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
index 7b72151b57..a61482256a 100644
--- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
@@ -5,6 +5,8 @@ module ActiveRecord
class PostgreSQLAdapterTest < ActiveRecord::TestCase
def setup
@connection = ActiveRecord::Base.connection
+ @connection.exec('drop table if exists ex')
+ @connection.exec('create table ex(id serial primary key, data character varying(255))')
end
def test_table_alias_length
@@ -12,6 +14,21 @@ module ActiveRecord
@connection.table_alias_length
end
end
+
+ def test_exec_no_binds
+ result = @connection.exec('SELECT id, data FROM ex')
+ assert_equal 0, result.rows.length
+ assert_equal 2, result.columns.length
+ assert_equal %w{ id data }, result.columns
+
+ string = @connection.quote('foo')
+ @connection.exec("INSERT INTO ex (id, data) VALUES (1, #{string})")
+ result = @connection.exec('SELECT id, data FROM ex')
+ assert_equal 1, result.rows.length
+ assert_equal 2, result.columns.length
+
+ assert_equal [['1', 'foo']], result.rows
+ end
end
end
end