File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ def handle_data_row(message)
8383 def handle_command_complete ( message )
8484 if buffer_rows?
8585 @result = Vertica ::Result . new ( row_description : @row_description , rows : @buffer , tag : message . tag )
86- @row_description , @buffer = nil , nil
86+ @row_description = nil
87+ @buffer = [ ]
8788 else
8889 @result = message . tag
8990 end
Original file line number Diff line number Diff line change @@ -81,6 +81,20 @@ def test_select_query_with_multibyte_column_names_results
8181 assert_equal 'ニ' , r . row_description [ 1 ] . name
8282 end
8383
84+ # Query with multiple statements is not officailly supported
85+ def test_query_with_multiple_statements
86+ # Results of only the last statement are obtained
87+ r = @connection . query ( "SET SEARCH_PATH TO default; SELECT 1 as one; SELECT 2 as two" )
88+ assert_equal 1 , r . size
89+ assert_equal 1 , r . row_description . length
90+ assert_equal 'two' , r . row_description [ 0 ] . name
91+
92+ # Error of the former statement is raised
93+ assert_raises ( Vertica ::Error ::MissingColumn ) do
94+ @connection . query ( "SELECT missing FROM test_ruby_vertica_table; SELECT 1 FROM missing" )
95+ end
96+ end
97+
8498 def test_insert
8599 r = @connection . query ( "INSERT INTO test_ruby_vertica_table VALUES (2, 'stefanie')" )
86100 assert_equal "INSERT" , r . tag
You can’t perform that action at this time.
0 commit comments