Sha256: dba5f8f50681fab5ad980f02e0073ffaa20511351bb15843ee0a1bef0704c945
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'jdbc_common' require 'db/mysql' class StatementEscapingTest < Test::Unit::TestCase include FixtureSetup def setup super ActiveRecord::Base.clear_active_connections! @config = ActiveRecord::Base.connection.config end def teardown ActiveRecord::Base.clear_active_connections! ActiveRecord::Base.establish_connection @config super end def test_false set_escape_processing false e1 = Entry.create! :title => "\\'{}{" e2 = Entry.find(e1.id) assert_equal "\\'{}{", e2.title end def set_escape_processing(value) ActiveRecord::Base.establish_connection @config.merge(:statement_escape_processing => value) end def test_not_set set_escape_processing nil verify_escaped end def verify_escaped e = Entry.create! :title => 'abc' rs = ActiveRecord::Base.connection.execute( "SELECT {fn concat(title, 'xyz')} AS title from entries WHERE id = #{e.id}") assert_equal 'abcxyz', rs.first['title'] end def test_true set_escape_processing true verify_escaped end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord-jdbc-adapter-1.3.0.beta2 | test/db/mysql/statement_escaping_test.rb |