Class: RakeDotNet::SqlCmd
Instance Attribute Summary collapse
-
#database ⇒ Object
Returns the value of attribute database.
-
#input_file ⇒ Object
Returns the value of attribute input_file.
-
#query ⇒ Object
Returns the value of attribute query.
Attributes inherited from Cli
Instance Method Summary collapse
- #cmd ⇒ Object
- #credentials ⇒ Object
-
#initialize(params = {}) ⇒ SqlCmd
constructor
A new instance of SqlCmd.
- #revert_optionals ⇒ Object
- #run ⇒ Object
- #server ⇒ Object
Methods inherited from Cli
Constructor Details
#initialize(params = {}) ⇒ SqlCmd
Returns a new instance of SqlCmd.
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/rake_dotnet.rb', line 234 def initialize(params={}) sps = params[:search_paths] || [] sps << File.join(TOOLS_DIR, 'sql') sps << File.join(ENV['PROGRAMFILES'], 'Microsoft SQL Server', '100', 'tools', 'binn') sps << File.join(ENV['PROGRAMFILES'], 'Microsoft SQL Server', '90', 'tools', 'binn') sps << File.join(ENV['PROGRAMFILES'], 'Microsoft SQL Server', '80', 'tools', 'binn') super(params.merge({:exe_name=>'sqlcmd.exe', :search_paths=>sps})) unless params[:trusted].nil? @trusted = params[:trusted] else @trusted = true end unless @trusted @user = params[:user] || DB_USER @password = params[:password] || DB_PASSWORD end @server = params[:server] || DB_SERVER #optionals and runtime settable @input_file = params[:input_file] @query = params[:query] end |
Instance Attribute Details
#database ⇒ Object
Returns the value of attribute database.
232 233 234 |
# File 'lib/rake_dotnet.rb', line 232 def database @database end |
#input_file ⇒ Object
Returns the value of attribute input_file.
232 233 234 |
# File 'lib/rake_dotnet.rb', line 232 def input_file @input_file end |
#query ⇒ Object
Returns the value of attribute query.
232 233 234 |
# File 'lib/rake_dotnet.rb', line 232 def query @query end |
Instance Method Details
#cmd ⇒ Object
286 287 288 |
# File 'lib/rake_dotnet.rb', line 286 def cmd return "#{super} #{server} #{credentials} #{database} #{input_file} #{query}" end |
#credentials ⇒ Object
258 259 260 261 262 263 264 |
# File 'lib/rake_dotnet.rb', line 258 def credentials if @trusted return '-E' else return "-U \"#{@user}\" -P \"#{@password}\"" end end |
#revert_optionals ⇒ Object
296 297 298 299 |
# File 'lib/rake_dotnet.rb', line 296 def revert_optionals @query = nil @input_file = nil end |
#run ⇒ Object
290 291 292 293 294 |
# File 'lib/rake_dotnet.rb', line 290 def run puts cmd if VERBOSE == true sh cmd revert_optionals end |
#server ⇒ Object
266 267 268 |
# File 'lib/rake_dotnet.rb', line 266 def server return "-S \"#{@server}\"" end |