Skip to content

Commit 4d0942a

Browse files
Warn about missing MySQL encoding mappings
and fix a bug mapping them to "" instead of NULL.
1 parent 2e5e334 commit 4d0942a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

support/mysql_enc_to_ruby.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@
5252

5353
collations.each do |collation|
5454
mysql_col_idx = collation[2].to_i
55-
rb_enc = mysql_to_rb[collation[1]]
55+
rb_enc = mysql_to_rb.fetch(collation[1]) do |mysql_enc|
56+
$stderr.puts "WARNING: Missing mapping for collation \"#{collation[0]}\" with encoding \"#{mysql_enc}\" and id #{mysql_col_idx}, assuming NULL"
57+
"NULL"
58+
end
5659
encodings[mysql_col_idx - 1] = [mysql_col_idx, rb_enc]
5760
end
5861

0 commit comments

Comments
 (0)