-
Notifications
You must be signed in to change notification settings - Fork 555
Open
Milestone
Description
Table:
prod.final_product
Re-creating bug:
client = Mysql2::Client.new(
{
:host => "127.0.0.1",
:username => "username",
:password => "password",
:database => ""
}) # => #<Mysql2::Client ... :database => ""}, @read_timeout=nil>
client.query("SELECT * FROM final_product") # => Mysql2::Error: No database selected
client.query_options[:database] = "prod" # => "prod"
client # => #<Mysql2::Client ... @query_options = { ... :database => "prod"}, @read_timeout=nil>
client.query("SELECT * FROM final_product") # => Mysql2::Error: No database selected
Workarounds to manipulating query_options hash
Using #select_db
client = Mysql2::Client.new(
{
:host => "127.0.0.1",
:username => "username",
:password => "password",
:database => ""
}) # => #<Mysql2::Client ... :database => ""}, @read_timeout=nil>
client.select_db("prod") # => "prod"
client.query("SELECT * FROM final_product") # => #<Mysql2::Result ... :database => "prod"}>
Using options hash on client initialization
client = Mysql2::Client.new(
{
:host => "127.0.0.1",
:username => "username",
:password => "password",
:database => "prod"
}) # => #<Mysql2::Client ... :database => ""}, @read_timeout=nil>
client.query("SELECT * FROM final_product") # => #<Mysql2::Result ... :database => "prod"}>
Metadata
Metadata
Assignees
Labels
No labels