From 3766015f07c026e1a22d1b7732f52d25d8b8d6c5 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Pumarino Date: Wed, 26 Nov 2014 10:36:54 -0300 Subject: Provide support for SQL Server connections with dbconsole using sqsh --- railties/lib/rails/commands/dbconsole.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'railties/lib/rails') 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 -- cgit v1.2.3