Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contrib/ruby/ext/trilogy-ruby/cext.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ static void handle_trilogy_error(struct trilogy_ctx *ctx, int rc, const char *ms
rb_raise(Trilogy_TimeoutError, "%" PRIsVALUE, rbmsg);

case TRILOGY_ERR: {
VALUE message = rb_str_new(ctx->conn.error_message, ctx->conn.error_message_len);
VALUE conn_message = rb_str_new(ctx->conn.error_message, ctx->conn.error_message_len);
VALUE message = rb_sprintf("%" PRIsVALUE " (%" PRIsVALUE ")", conn_message, rbmsg);
VALUE exc = rb_funcall(Trilogy_ProtocolError, id_from_code, 2, message, INT2NUM(ctx->conn.error_code));
rb_exc_raise(exc);
}
Expand Down
3 changes: 3 additions & 0 deletions contrib/ruby/test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def test_trilogy_set_server_option_with_invalid_option

assert_instance_of(Trilogy::ProtocolError, e)
assert_match(/1047: Unknown command/, e.message)
assert_match(/trilogy_set_option_recv/, e.message)
end

def test_trilogy_set_server_option_multi_statement
Expand All @@ -283,6 +284,7 @@ def test_trilogy_set_server_option_multi_statement

assert_instance_of(Trilogy::QueryError, e)
assert_match(/1064: You have an error in your SQL syntax/, e.message)
assert_match(/trilogy_query_recv/, e.message)

client.set_server_option(Trilogy::SET_SERVER_MULTI_STATEMENTS_ON)
client.query("INSERT INTO trilogy_test (int_test) VALUES ('4'); INSERT INTO trilogy_test (int_test) VALUES ('1')")
Expand All @@ -301,6 +303,7 @@ def test_trilogy_set_server_option_multi_statement

assert_instance_of(Trilogy::QueryError, e)
assert_match(/1064: You have an error in your SQL syntax/, e.message)
assert_match(/trilogy_query_recv/, e.message)
end

def test_trilogy_query_result_object
Expand Down