Sha256: da310e15f9912b77fc86d08ba7a9b7d35bd3b1366916a40a92faab6e9f51b31d

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

# To run this script, run the following in a mysql instance:
#
#   drop database if exists weblog_development;
#   create database weblog_development;
#   grant all on weblog_development.* to blog@localhost;
#   flush privileges;

require 'jdbc_common'
require 'db/mysql'

class MysqlSimpleTest < Test::Unit::TestCase
  include SimpleTestMethods
  include ActiveRecord3TestMethods

  def test_string_quoting_oddity
    s = "0123456789a'a"
    assert_equal "'0123456789a\\'a'", ActiveRecord::Base.connection.quote(s)

    s2 = s[10,3]
    assert_equal "a'a", s2
    assert_equal "'a\\'a'", ActiveRecord::Base.connection.quote(s2)
  end

  def test_table_name_quoting_with_dot
    s = "weblog_development.posts"
    assert_equal "`weblog_development`.`posts`", ActiveRecord::Base.connection.quote_table_name(s)
  end

  def test_update_all_with_limit
    assert_nothing_raised { Entry.update_all({:title => "test"}, {}, {:limit => 1}) }
  end
end

class MysqlHasManyThroughTest < Test::Unit::TestCase
  include HasManyThroughMethods
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-jdbc-adapter-1.0.2-java test/mysql_simple_test.rb
activerecord-jdbc-adapter-1.0.1-java test/mysql_simple_test.rb
activerecord-jdbc-adapter-1.0.0-java test/mysql_simple_test.rb
activerecord-jdbc-adapter-1.0.0.beta2-java test/mysql_simple_test.rb