diff --git a/bin/innodb_ruby_generate_mysql_collations b/bin/innodb_ruby_generate_mysql_collations new file mode 100755 index 0000000..5bb91dd --- /dev/null +++ b/bin/innodb_ruby_generate_mysql_collations @@ -0,0 +1,96 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# To update lib/innodb/mysql_collations.rb, run this with a path to the MySQL source directory +# containing CHARSET_INFO collation definitions, e.g.: + +# bundle exec bin/innodb_ruby_generate_mysql_collations ~/git/mysql-server > lib/innodb/mysql_collations.rb + +MysqlCharsetInfo = Struct.new( + :number, + :primary_number, + :binary_number, + :state, + :csname, + :m_coll_name, + :comment, + :tailoring, + :coll_param, + :ctype, + :to_lower, + :to_upper, + :sort_order, + :uca, + :tab_to_uni, + :tab_from_uni, + :caseinfo, + :state_maps, + :ident_map, + :strxfrm_multiply, + :caseup_multiply, + :casedn_multiply, + :mbminlen, + :mbmaxlen, + :mbmaxlenlen, + :min_sort_char, + :max_sort_char, + :pad_char, + :escape_with_backslash_is_dangerous, + :levels_for_compare, + :cset, + :coll, + :pad_attribute +) + +charset_infos = [] + +raise "First argument must be the path to a modern MySQL source tree" unless (ARGV.size == 1) && Dir.exist?(ARGV[0]) + +Dir.glob(File.join(ARGV[0], "strings/ctype-**.cc")).each do |filename| + content = File.read(filename) + warn "Parsing #{filename}..." + + # Global individual constants e.g. CHARSET_INFO my_charset_utf8mb4_general_ci = { ... } + charset_info_strings = content.scan(/^CHARSET_INFO \w+ = ({.*?})/m).flatten + + # Global array of constants e.g. CHARSET_INFO compiled_charsets[] = { { ... }, { ... } }; + content.match(/CHARSET_INFO \w+\[\] = {\s*(?:{.*?}\s*,\s*)+/m) + &.match(0) + &.gsub(/CHARSET_INFO \w+\[\] = {/, "") + &.scan(/{.*?}/m) + &.each do |s| + charset_info_strings.push(s) + end + + charset_info_strings = charset_info_strings.map do |x| + x.gsub(%r{/\*.*?\*/}, "").gsub(%r{//.*?$}, "").gsub(/\s+/, " ").gsub(/["']/, "") + end + + charset_infos += charset_info_strings.map do |charset_info_string| + matches = charset_info_string.match(/{(?.*?)}/) + + MysqlCharsetInfo.new(*matches[:definition].split(",").map(&:strip).map { |x| x =~ /^[0-9]+$/ ? x.to_i : x }) + end +end + +if charset_infos.empty? + warn "No MySQL collations found... bad path provided?" + exit 1 +end + +warn "Found #{charset_infos.size} collations, generating output." + +puts "# frozen_string_literal: true" +puts +puts "# Generated at #{Time.now.utc} using innodb_ruby_generate_mysql_collations. Do not edit!" +puts + +puts "# rubocop:disable all" +charset_infos.sort_by(&:number).each do |charset_info| + puts format("Innodb::MysqlCollation.add(id: %d, name: %s, character_set_name: %s, mbminlen: %i, mbmaxlen: %i)", + charset_info.number, + charset_info.m_coll_name.inspect, + charset_info.csname.inspect, + charset_info.mbminlen, + charset_info.mbmaxlen) +end diff --git a/lib/innodb.rb b/lib/innodb.rb index d3ab183..62ea524 100644 --- a/lib/innodb.rb +++ b/lib/innodb.rb @@ -22,6 +22,8 @@ def self.debug=(value) require "innodb/version" require "innodb/stats" require "innodb/checksum" +require "innodb/mysql_collation" +require "innodb/mysql_collations" require "innodb/mysql_type" require "innodb/record_describer" require "innodb/sys_data_dictionary" diff --git a/lib/innodb/mysql_collation.rb b/lib/innodb/mysql_collation.rb new file mode 100644 index 0000000..f9d639d --- /dev/null +++ b/lib/innodb/mysql_collation.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +module Innodb + class MysqlCollation + class DuplicateIdError < StandardError; end + class DuplicateNameError < StandardError; end + + @collations = [] + @collations_by_id = {} + @collations_by_name = {} + + class << self + attr_reader :collations + end + + def self.add(kwargs) + raise DuplicateIdError if @collations_by_id.key?(kwargs[:id]) + raise DuplicateNameError if @collations_by_name.key?(kwargs[:name]) + + collation = new(**kwargs) + @collations.push(collation) + @collations_by_id[collation.id] = collation + @collations_by_name[collation.name] = collation + @all_fixed_ids = nil + collation + end + + def self.by_id(id) + @collations_by_id[id] + end + + def self.by_name(name) + @collations_by_name[name] + end + + def self.all_fixed_ids + @all_fixed_ids ||= Innodb::MysqlCollation.collations.select(&:fixed?).map(&:id).sort + end + + attr_reader :id + attr_reader :name + attr_reader :character_set_name + attr_reader :mbminlen + attr_reader :mbmaxlen + + def initialize(id:, name:, character_set_name:, mbminlen:, mbmaxlen:) + @id = id + @name = name + @character_set_name = character_set_name + @mbminlen = mbminlen + @mbmaxlen = mbmaxlen + end + + def fixed? + mbminlen == mbmaxlen + end + + def variable? + !fixed? + end + end +end diff --git a/lib/innodb/mysql_collations.rb b/lib/innodb/mysql_collations.rb new file mode 100644 index 0000000..19b08ec --- /dev/null +++ b/lib/innodb/mysql_collations.rb @@ -0,0 +1,292 @@ +# frozen_string_literal: true + +# Generated at 2024-11-26 00:42:28 UTC using innodb_ruby_generate_mysql_collations. Do not edit! + +# rubocop:disable all +Innodb::MysqlCollation.add(id: 1, name: "big5_chinese_ci", character_set_name: "big5", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 2, name: "latin2_czech_cs", character_set_name: "latin2", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 3, name: "dec8_swedish_ci", character_set_name: "dec8", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 4, name: "cp850_general_ci", character_set_name: "cp850", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 5, name: "latin1_german1_ci", character_set_name: "latin1", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 6, name: "hp8_english_ci", character_set_name: "hp8", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 7, name: "koi8r_general_ci", character_set_name: "koi8r", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 8, name: "latin1_swedish_ci", character_set_name: "latin1", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 9, name: "latin2_general_ci", character_set_name: "latin2", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 10, name: "swe7_swedish_ci", character_set_name: "swe7", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 11, name: "ascii_general_ci", character_set_name: "ascii", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 12, name: "ujis_japanese_ci", character_set_name: "ujis", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 13, name: "sjis_japanese_ci", character_set_name: "sjis", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 14, name: "cp1251_bulgarian_ci", character_set_name: "cp1251", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 15, name: "latin1_danish_ci", character_set_name: "latin1", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 16, name: "hebrew_general_ci", character_set_name: "hebrew", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 17, name: "filename", character_set_name: "filename", mbminlen: 1, mbmaxlen: 5) +Innodb::MysqlCollation.add(id: 18, name: "tis620_thai_ci", character_set_name: "tis620", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 19, name: "euckr_korean_ci", character_set_name: "euckr", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 20, name: "latin7_estonian_cs", character_set_name: "latin7", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 21, name: "latin2_hungarian_ci", character_set_name: "latin2", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 22, name: "koi8u_general_ci", character_set_name: "koi8u", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 23, name: "cp1251_ukrainian_ci", character_set_name: "cp1251", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 24, name: "gb2312_chinese_ci", character_set_name: "gb2312", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 25, name: "greek_general_ci", character_set_name: "greek", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 26, name: "cp1250_general_ci", character_set_name: "cp1250", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 27, name: "latin2_croatian_ci", character_set_name: "latin2", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 28, name: "gbk_chinese_ci", character_set_name: "gbk", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 29, name: "cp1257_lithuanian_ci", character_set_name: "cp1257", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 30, name: "latin5_turkish_ci", character_set_name: "latin5", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 31, name: "latin1_german2_ci", character_set_name: "latin1", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 32, name: "armscii8_general_ci", character_set_name: "armscii8", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 33, name: "utf8mb3_general_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 34, name: "cp1250_czech_cs", character_set_name: "cp1250", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 35, name: "ucs2_general_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 36, name: "cp866_general_ci", character_set_name: "cp866", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 37, name: "keybcs2_general_ci", character_set_name: "keybcs2", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 38, name: "macce_general_ci", character_set_name: "macce", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 39, name: "macroman_general_ci", character_set_name: "macroman", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 40, name: "cp852_general_ci", character_set_name: "cp852", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 41, name: "latin7_general_ci", character_set_name: "latin7", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 42, name: "latin7_general_cs", character_set_name: "latin7", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 43, name: "macce_bin", character_set_name: "macce", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 44, name: "cp1250_croatian_ci", character_set_name: "cp1250", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 45, name: "utf8mb4_general_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 46, name: "utf8mb4_bin", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 47, name: "latin1_bin", character_set_name: "latin1", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 48, name: "latin1_general_ci", character_set_name: "latin1", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 49, name: "latin1_general_cs", character_set_name: "latin1", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 50, name: "cp1251_bin", character_set_name: "cp1251", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 51, name: "cp1251_general_ci", character_set_name: "cp1251", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 52, name: "cp1251_general_cs", character_set_name: "cp1251", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 53, name: "macroman_bin", character_set_name: "macroman", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 54, name: "utf16_general_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 55, name: "utf16_bin", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 56, name: "utf16le_general_ci", character_set_name: "utf16le", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 57, name: "cp1256_general_ci", character_set_name: "cp1256", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 58, name: "cp1257_bin", character_set_name: "cp1257", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 59, name: "cp1257_general_ci", character_set_name: "cp1257", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 60, name: "utf32_general_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 61, name: "utf32_bin", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 62, name: "utf16le_bin", character_set_name: "utf16le", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 63, name: "binary", character_set_name: "binary", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 64, name: "armscii8_bin", character_set_name: "armscii8", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 65, name: "ascii_bin", character_set_name: "ascii", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 66, name: "cp1250_bin", character_set_name: "cp1250", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 67, name: "cp1256_bin", character_set_name: "cp1256", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 68, name: "cp866_bin", character_set_name: "cp866", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 69, name: "dec8_bin", character_set_name: "dec8", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 70, name: "greek_bin", character_set_name: "greek", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 71, name: "hebrew_bin", character_set_name: "hebrew", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 72, name: "hp8_bin", character_set_name: "hp8", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 73, name: "keybcs2_bin", character_set_name: "keybcs2", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 74, name: "koi8r_bin", character_set_name: "koi8r", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 75, name: "koi8u_bin", character_set_name: "koi8u", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 76, name: "utf8mb3_tolower_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 77, name: "latin2_bin", character_set_name: "latin2", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 78, name: "latin5_bin", character_set_name: "latin5", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 79, name: "latin7_bin", character_set_name: "latin7", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 80, name: "cp850_bin", character_set_name: "cp850", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 81, name: "cp852_bin", character_set_name: "cp852", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 82, name: "swe7_bin", character_set_name: "swe7", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 83, name: "utf8mb3_bin", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 84, name: "big5_bin", character_set_name: "big5", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 85, name: "euckr_bin", character_set_name: "euckr", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 86, name: "gb2312_bin", character_set_name: "gb2312", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 87, name: "gbk_bin", character_set_name: "gbk", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 88, name: "sjis_bin", character_set_name: "sjis", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 89, name: "tis620_bin", character_set_name: "tis620", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 90, name: "ucs2_bin", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 91, name: "ujis_bin", character_set_name: "ujis", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 92, name: "geostd8_general_ci", character_set_name: "geostd8", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 93, name: "geostd8_bin", character_set_name: "geostd8", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 94, name: "latin1_spanish_ci", character_set_name: "latin1", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 95, name: "cp932_japanese_ci", character_set_name: "cp932", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 96, name: "cp932_bin", character_set_name: "cp932", mbminlen: 1, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 97, name: "eucjpms_japanese_ci", character_set_name: "eucjpms", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 98, name: "eucjpms_bin", character_set_name: "eucjpms", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 99, name: "cp1250_polish_ci", character_set_name: "cp1250", mbminlen: 1, mbmaxlen: 1) +Innodb::MysqlCollation.add(id: 101, name: "utf16_unicode_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 102, name: "utf16_icelandic_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 103, name: "utf16_latvian_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 104, name: "utf16_romanian_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 105, name: "utf16_slovenian_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 106, name: "utf16_polish_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 107, name: "utf16_estonian_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 108, name: "utf16_spanish_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 109, name: "utf16_swedish_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 110, name: "utf16_turkish_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 111, name: "utf16_czech_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 112, name: "utf16_danish_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 113, name: "utf16_lithuanian_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 114, name: "utf16_slovak_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 115, name: "utf16_spanish2_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 116, name: "utf16_roman_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 117, name: "utf16_persian_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 118, name: "utf16_esperanto_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 119, name: "utf16_hungarian_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 120, name: "utf16_sinhala_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 121, name: "utf16_german2_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 122, name: "utf16_croatian_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 123, name: "utf16_unicode_520_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 124, name: "utf16_vietnamese_ci", character_set_name: "utf16", mbminlen: 2, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 128, name: "ucs2_unicode_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 129, name: "ucs2_icelandic_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 130, name: "ucs2_latvian_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 131, name: "ucs2_romanian_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 132, name: "ucs2_slovenian_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 133, name: "ucs2_polish_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 134, name: "ucs2_estonian_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 135, name: "ucs2_spanish_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 136, name: "ucs2_swedish_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 137, name: "ucs2_turkish_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 138, name: "ucs2_czech_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 139, name: "ucs2_danish_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 140, name: "ucs2_lithuanian_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 141, name: "ucs2_slovak_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 142, name: "ucs2_spanish2_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 143, name: "ucs2_roman_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 144, name: "ucs2_persian_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 145, name: "ucs2_esperanto_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 146, name: "ucs2_hungarian_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 147, name: "ucs2_sinhala_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 148, name: "ucs2_german2_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 149, name: "ucs2_croatian_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 150, name: "ucs2_unicode_520_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 151, name: "ucs2_vietnamese_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 159, name: "ucs2_general_mysql500_ci", character_set_name: "ucs2", mbminlen: 2, mbmaxlen: 2) +Innodb::MysqlCollation.add(id: 160, name: "utf32_unicode_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 161, name: "utf32_icelandic_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 162, name: "utf32_latvian_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 163, name: "utf32_romanian_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 164, name: "utf32_slovenian_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 165, name: "utf32_polish_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 166, name: "utf32_estonian_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 167, name: "utf32_spanish_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 168, name: "utf32_swedish_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 169, name: "utf32_turkish_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 170, name: "utf32_czech_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 171, name: "utf32_danish_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 172, name: "utf32_lithuanian_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 173, name: "utf32_slovak_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 174, name: "utf32_spanish2_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 175, name: "utf32_roman_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 176, name: "utf32_persian_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 177, name: "utf32_esperanto_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 178, name: "utf32_hungarian_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 179, name: "utf32_sinhala_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 180, name: "utf32_german2_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 181, name: "utf32_croatian_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 182, name: "utf32_unicode_520_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 183, name: "utf32_vietnamese_ci", character_set_name: "utf32", mbminlen: 4, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 192, name: "utf8mb3_unicode_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 193, name: "utf8mb3_icelandic_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 194, name: "utf8mb3_latvian_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 195, name: "utf8mb3_romanian_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 196, name: "utf8mb3_slovenian_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 197, name: "utf8mb3_polish_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 198, name: "utf8mb3_estonian_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 199, name: "utf8mb3_spanish_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 200, name: "utf8mb3_swedish_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 201, name: "utf8mb3_turkish_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 202, name: "utf8mb3_czech_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 203, name: "utf8mb3_danish_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 204, name: "utf8mb3_lithuanian_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 205, name: "utf8mb3_slovak_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 206, name: "utf8mb3_spanish2_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 207, name: "utf8mb3_roman_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 208, name: "utf8mb3_persian_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 209, name: "utf8mb3_esperanto_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 210, name: "utf8mb3_hungarian_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 211, name: "utf8mb3_sinhala_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 212, name: "utf8mb3_german2_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 213, name: "utf8mb3_croatian_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 214, name: "utf8mb3_unicode_520_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 215, name: "utf8mb3_vietnamese_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 223, name: "utf8mb3_general_mysql500_ci", character_set_name: "utf8mb3", mbminlen: 1, mbmaxlen: 3) +Innodb::MysqlCollation.add(id: 224, name: "utf8mb4_unicode_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 225, name: "utf8mb4_icelandic_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 226, name: "utf8mb4_latvian_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 227, name: "utf8mb4_romanian_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 228, name: "utf8mb4_slovenian_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 229, name: "utf8mb4_polish_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 230, name: "utf8mb4_estonian_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 231, name: "utf8mb4_spanish_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 232, name: "utf8mb4_swedish_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 233, name: "utf8mb4_turkish_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 234, name: "utf8mb4_czech_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 235, name: "utf8mb4_danish_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 236, name: "utf8mb4_lithuanian_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 237, name: "utf8mb4_slovak_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 238, name: "utf8mb4_spanish2_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 239, name: "utf8mb4_roman_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 240, name: "utf8mb4_persian_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 241, name: "utf8mb4_esperanto_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 242, name: "utf8mb4_hungarian_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 243, name: "utf8mb4_sinhala_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 244, name: "utf8mb4_german2_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 245, name: "utf8mb4_croatian_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 246, name: "utf8mb4_unicode_520_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 247, name: "utf8mb4_vietnamese_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 248, name: "gb18030_chinese_ci", character_set_name: "gb18030", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 249, name: "gb18030_bin", character_set_name: "gb18030", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 250, name: "gb18030_unicode_520_ci", character_set_name: "gb18030", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 255, name: "utf8mb4_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 256, name: "utf8mb4_de_pb_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 257, name: "utf8mb4_is_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 258, name: "utf8mb4_lv_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 259, name: "utf8mb4_ro_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 260, name: "utf8mb4_sl_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 261, name: "utf8mb4_pl_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 262, name: "utf8mb4_et_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 263, name: "utf8mb4_es_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 264, name: "utf8mb4_sv_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 265, name: "utf8mb4_tr_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 266, name: "utf8mb4_cs_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 267, name: "utf8mb4_da_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 268, name: "utf8mb4_lt_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 269, name: "utf8mb4_sk_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 270, name: "utf8mb4_es_trad_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 271, name: "utf8mb4_la_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 273, name: "utf8mb4_eo_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 274, name: "utf8mb4_hu_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 275, name: "utf8mb4_hr_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 277, name: "utf8mb4_vi_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 278, name: "utf8mb4_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 279, name: "utf8mb4_de_pb_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 280, name: "utf8mb4_is_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 281, name: "utf8mb4_lv_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 282, name: "utf8mb4_ro_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 283, name: "utf8mb4_sl_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 284, name: "utf8mb4_pl_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 285, name: "utf8mb4_et_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 286, name: "utf8mb4_es_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 287, name: "utf8mb4_sv_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 288, name: "utf8mb4_tr_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 289, name: "utf8mb4_cs_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 290, name: "utf8mb4_da_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 291, name: "utf8mb4_lt_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 292, name: "utf8mb4_sk_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 293, name: "utf8mb4_es_trad_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 294, name: "utf8mb4_la_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 296, name: "utf8mb4_eo_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 297, name: "utf8mb4_hu_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 298, name: "utf8mb4_hr_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 300, name: "utf8mb4_vi_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 303, name: "utf8mb4_ja_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 304, name: "utf8mb4_ja_0900_as_cs_ks", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 305, name: "utf8mb4_0900_as_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 306, name: "utf8mb4_ru_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 307, name: "utf8mb4_ru_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 308, name: "utf8mb4_zh_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 309, name: "utf8mb4_0900_bin", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 310, name: "utf8mb4_nb_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 311, name: "utf8mb4_nb_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 312, name: "utf8mb4_nn_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 313, name: "utf8mb4_nn_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 314, name: "utf8mb4_sr_latn_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 315, name: "utf8mb4_sr_latn_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 316, name: "utf8mb4_bs_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 317, name: "utf8mb4_bs_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 318, name: "utf8mb4_bg_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 319, name: "utf8mb4_bg_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 320, name: "utf8mb4_gl_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 321, name: "utf8mb4_gl_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 322, name: "utf8mb4_mn_cyrl_0900_ai_ci", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) +Innodb::MysqlCollation.add(id: 323, name: "utf8mb4_mn_cyrl_0900_as_cs", character_set_name: "utf8mb4", mbminlen: 1, mbmaxlen: 4) diff --git a/spec/innodb/mysql_collation_spec.rb b/spec/innodb/mysql_collation_spec.rb new file mode 100644 index 0000000..9ca5fad --- /dev/null +++ b/spec/innodb/mysql_collation_spec.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +require "spec_helper" + +describe Innodb::MysqlCollation do + describe ".collations" do + it "is an Array" do + Innodb::MysqlCollation.collations.should be_an_instance_of Array + end + + # The count/minmax here can be updated when lib/innodb/mysql_collations.rb is updated, but it should probably never + # decrease, only increase. Proceed with caution. + + it "has 287 entries" do + Innodb::MysqlCollation.collations.count.should eql 287 + end + + it "has entries from id 1 to 323" do + Innodb::MysqlCollation.collations.map(&:id).minmax.should eql [1, 323] + end + + it "has only Innodb::MysqlCollation entries" do + Innodb::MysqlCollation.collations.map(&:class).uniq.should eql [Innodb::MysqlCollation] + end + + it "has mbminlen values of 1, 2, 4" do + Innodb::MysqlCollation.collations.map(&:mbminlen).sort.uniq.should eql [1, 2, 4] + end + + it "has mbmaxlen values of 1, 2, 3, 4, 5" do + Innodb::MysqlCollation.collations.map(&:mbmaxlen).sort.uniq.should eql [1, 2, 3, 4, 5] + end + end + + describe ".by_id" do + it "can look up utf8mb4_general_ci by id" do + Innodb::MysqlCollation.by_id(45).name.should eql "utf8mb4_general_ci" + end + end + + describe ".by_name" do + it "can look up utf8mb4_general_ci by name" do + Innodb::MysqlCollation.by_name("utf8mb4_general_ci").id.should eql 45 + end + end + + describe "#fixed?" do + it "works properly for two example collations" do + Innodb::MysqlCollation.by_name("ascii_general_ci").fixed?.should be true + Innodb::MysqlCollation.by_name("utf8mb4_general_ci").fixed?.should be false + end + end + + describe "#variable?" do + it "works properly for two example collations" do + Innodb::MysqlCollation.by_name("ascii_general_ci").variable?.should be false + Innodb::MysqlCollation.by_name("utf8mb4_general_ci").variable?.should be true + end + end +end