Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add select_db as an alias for change_db #101

Merged
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
1 change: 1 addition & 0 deletions contrib/ruby/ext/trilogy-ruby/cext.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ RUBY_FUNC_EXPORTED void Init_cext()

rb_define_private_method(Trilogy, "_initialize", rb_trilogy_initialize, 3);
rb_define_method(Trilogy, "change_db", rb_trilogy_change_db, 1);
rb_define_alias(Trilogy, "select_db", "change_db");
rb_define_method(Trilogy, "query", rb_trilogy_query, 1);
rb_define_method(Trilogy, "ping", rb_trilogy_ping, 0);
rb_define_method(Trilogy, "escape", rb_trilogy_escape, 1);
Expand Down
9 changes: 9 additions & 0 deletions contrib/ruby/test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ def test_trilogy_change_db
ensure_closed client
end

# select_db is just an alias for change_db
# and is tested here to ensure it works.
def test_trilogy_select_db
client = new_tcp_client
assert client.select_db "test"
ensure
ensure_closed client
end

def test_trilogy_change_db_after_close_raises
client = new_tcp_client
assert client.change_db "test"
Expand Down