Skip to content

Commit 8331d89

Browse files
authored
Merge pull request #65 from sonots/support_multibytes
Fix RowDescription so that query containing multibyte column names to work
2 parents 5bef262 + 1896786 commit 8331d89

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/vertica/protocol/backend/row_description.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def initialize(data)
2121
:data_format => field_info[6],
2222
}
2323

24-
pos += 19 + field_info[0].size
24+
pos += 19 + field_info[0].bytesize
2525
end
2626
end
2727
end

test/functional/functional_query_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ def test_select_query_with_no_results
7272
assert_empty r
7373
end
7474

75+
def test_select_query_with_multibyte_column_names_results
76+
r = @connection.query("SELECT 1 as \"イチ\", 2 as \"\"")
77+
assert_equal 1, r.size
78+
assert_equal 2, r.row_description.length
79+
80+
assert_equal 'イチ', r.row_description[0].name
81+
assert_equal 'ニ', r.row_description[1].name
82+
end
83+
7584
def test_insert
7685
r = @connection.query("INSERT INTO test_ruby_vertica_table VALUES (2, 'stefanie')")
7786
assert_equal "INSERT", r.tag

0 commit comments

Comments
 (0)