aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJuan Ignacio Pumarino <jipumarino@gmail.com>2014-11-26 10:36:54 -0300
committerJuan Ignacio Pumarino <jipumarino@gmail.com>2014-11-26 10:36:54 -0300
commit3766015f07c026e1a22d1b7732f52d25d8b8d6c5 (patch)
tree0154b01ce1b3dbada22056679eb9446b7a479eca /railties
parentb0328eabd1cf2c2e58208b19131e7eff66dea453 (diff)
downloadrails-3766015f07c026e1a22d1b7732f52d25d8b8d6c5.tar.gz
rails-3766015f07c026e1a22d1b7732f52d25d8b8d6c5.tar.bz2
rails-3766015f07c026e1a22d1b7732f52d25d8b8d6c5.zip
Provide support for SQL Server connections with dbconsole using sqsh
Diffstat (limited to 'railties')
-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