aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-11-26 11:41:55 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-11-26 11:41:55 -0200
commita969268694de07a090f130d7d09fa62c624a127c (patch)
tree0154b01ce1b3dbada22056679eb9446b7a479eca
parentb0328eabd1cf2c2e58208b19131e7eff66dea453 (diff)
parent3766015f07c026e1a22d1b7732f52d25d8b8d6c5 (diff)
downloadrails-a969268694de07a090f130d7d09fa62c624a127c.tar.gz
rails-a969268694de07a090f130d7d09fa62c624a127c.tar.bz2
rails-a969268694de07a090f130d7d09fa62c624a127c.zip
Merge pull request #17785 from jipumarino/dbconsole-for-sqlserver
Provide support for SQL Server connections with dbconsole using sqsh
-rw-r--r--railties/lib/rails/commands/dbconsole.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb
index 1a2613a8d0..b01cdce6ea 100644
--- a/railties/lib/rails/commands/dbconsole.rb
+++ b/railties/lib/rails/commands/dbconsole.rb
@@ -74,6 +74,21 @@ module Rails
find_cmd_and_exec('sqlplus', logon)
+ when "sqlserver"
+ args = []
+
+ args += ["-D", "#{config['database']}"] if config['database']
+ args += ["-U", "#{config['username']}"] if config['username']
+ args += ["-P", "#{config['password']}"] if config['password']
+
+ if config['host']
+ host_arg = "#{config['host']}"
+ host_arg << ":#{config['port']}" if config['port']
+ args += ["-S", host_arg]
+ end
+
+ find_cmd_and_exec("sqsh", *args)
+
else
abort "Unknown command-line client for #{config['database']}. Submit a Rails patch to add support!"
end