diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-12 16:39:29 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-26 13:44:08 -0700 |
commit | d7207cf504b67243c0b7debaff70d948bb8be7a8 (patch) | |
tree | c5c9fd9eff9c7c33fb97b114ed2ced9088fbc687 /activerecord/test/cases/adapters | |
parent | 76d08057860d61cf16893bbfecbc7c7ccec74386 (diff) | |
download | rails-d7207cf504b67243c0b7debaff70d948bb8be7a8.tar.gz rails-d7207cf504b67243c0b7debaff70d948bb8be7a8.tar.bz2 rails-d7207cf504b67243c0b7debaff70d948bb8be7a8.zip |
type casting bound value based on column associated with value
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r-- | activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb index 52630c5ad4..969029db51 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb @@ -95,6 +95,24 @@ module ActiveRecord assert_equal [[1, 'foo']], result.rows end + + def test_exec_typecasts_bind_vals + conn = Base.sqlite3_connection :database => ':memory:', + :adapter => 'sqlite3', + :timeout => 100 + + conn.exec('create table ex(id int, data string)') + conn.exec('INSERT INTO ex (id, data) VALUES (1, "foo")') + column = conn.columns('ex').find { |col| col.name == 'id' } + + result = conn.exec( + 'SELECT id, data FROM ex WHERE id = ?', 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 |