diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-15 16:24:04 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-26 13:44:10 -0700 |
commit | 9d46e0d012e5c4687af4d14584f1230e71d7d654 (patch) | |
tree | 1cceb5d1951e872dc7f5f8759b08031496cdfb1b /activerecord/test | |
parent | e2813479f96e6dbfcfcde667797298611a9c9311 (diff) | |
download | rails-9d46e0d012e5c4687af4d14584f1230e71d7d654.tar.gz rails-9d46e0d012e5c4687af4d14584f1230e71d7d654.tar.bz2 rails-9d46e0d012e5c4687af4d14584f1230e71d7d654.zip |
bind parameters are now typecast
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb | 14 |
1 files changed, 14 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 0b295c9613..70de8c5e6c 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -41,6 +41,20 @@ module ActiveRecord assert_equal [['1', 'foo']], result.rows end + + def test_exec_typecasts_bind_vals + string = @connection.quote('foo') + @connection.exec("INSERT INTO ex (id, data) VALUES (1, #{string})") + + column = @connection.columns('ex').find { |col| col.name == 'id' } + result = @connection.exec( + 'SELECT id, data FROM ex WHERE id = $1', nil, [[column, '1-fuu']]) + + assert_equal 1, result.rows.length + assert_equal 2, result.columns.length + + assert_equal [['1', 'foo']], result.rows + end end end end |