Methods
- S
- T
Instance Public methods
setup()
Link
# File activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb, line 7 def setup @conn = ActiveRecord::Base.connection @conn.exec_query('drop table if exists ex') @conn.exec_query(" CREATE TABLE `ex` ( `id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `number` integer, `data` varchar(255)) ") end
test_client_encoding()
Link
test_exec_insert_number()
Link
# File activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb, line 26 def test_exec_insert_number insert(@conn, 'number' => 10) result = @conn.exec_query('SELECT number FROM ex WHERE number = 10') assert_equal 1, result.rows.length # if there are no bind parameters, it will return a string (due to # the libmysql api) assert_equal '10', result.rows.last.last end
test_exec_insert_string()
Link
# File activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb, line 37 def test_exec_insert_string str = 'いただきます!' insert(@conn, 'number' => 10, 'data' => str) result = @conn.exec_query('SELECT number, data FROM ex WHERE number = 10') value = result.rows.last.last if "<3".respond_to?(:encoding) # FIXME: this should probably be inside the mysql AR adapter? value.force_encoding(@conn.client_encoding) # The strings in this file are utf-8, so transcode to utf-8 value.encode!(Encoding::UTF_8) end assert_equal str, value end
test_pk_and_sequence_for()
Link
test_pk_and_sequence_for_with_custom_index_type_pk()
Link
# File activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb, line 74 def test_pk_and_sequence_for_with_custom_index_type_pk @conn.exec_query('drop table if exists ex_with_custom_index_type_pk') @conn.exec_query(" CREATE TABLE `ex_with_custom_index_type_pk` ( `id` INT(11) DEFAULT NULL auto_increment, PRIMARY KEY USING BTREE (`id`)) ") pk, seq = @conn.pk_and_sequence_for('ex_with_custom_index_type_pk') assert_equal 'id', pk assert_equal @conn.default_sequence_name('ex_with_custom_index_type_pk', 'id'), seq end
test_pk_and_sequence_for_with_non_standard_primary_key()
Link
# File activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb, line 62 def test_pk_and_sequence_for_with_non_standard_primary_key @conn.exec_query('drop table if exists ex_with_non_standard_pk') @conn.exec_query(" CREATE TABLE `ex_with_non_standard_pk` ( `code` INT(11) DEFAULT NULL auto_increment, PRIMARY KEY (`code`)) ") pk, seq = @conn.pk_and_sequence_for('ex_with_non_standard_pk') assert_equal 'code', pk assert_equal @conn.default_sequence_name('ex_with_non_standard_pk', 'code'), seq end
test_tables_quoting()
Link