Class: RakeDotNet::BcpCmd
Instance Attribute Summary collapse
-
#database ⇒ Object
Returns the value of attribute database.
-
#direction ⇒ Object
Returns the value of attribute direction.
-
#field_terminator ⇒ Object
Returns the value of attribute field_terminator.
-
#file ⇒ Object
Returns the value of attribute file.
-
#keep_identity_values ⇒ Object
Returns the value of attribute keep_identity_values.
-
#keep_null_values ⇒ Object
Returns the value of attribute keep_null_values.
-
#native_type ⇒ Object
Returns the value of attribute native_type.
-
#schema ⇒ Object
Returns the value of attribute schema.
-
#table ⇒ Object
Returns the value of attribute table.
-
#wide_character_type ⇒ Object
Returns the value of attribute wide_character_type.
Attributes inherited from Cli
Instance Method Summary collapse
- #cmd ⇒ Object
- #credentials ⇒ Object
- #db_object ⇒ Object
-
#initialize(params = {}) ⇒ BcpCmd
constructor
A new instance of BcpCmd.
- #path ⇒ Object
- #revert_optionals ⇒ Object
- #run ⇒ Object
- #server ⇒ Object
Methods inherited from Cli
Constructor Details
#initialize(params = {}) ⇒ BcpCmd
Returns a new instance of BcpCmd.
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/rake_dotnet.rb', line 139 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=>'bcp.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 @database = params[:database] unless params[:database].nil? @schema = params[:schema] || 'dbo' @table = params[:table] unless params[:table].nil? @direction = params[:direction] unless params[:direction].nil? @file = params[:file] unless params[:file].nil? end |
Instance Attribute Details
#database ⇒ Object
Returns the value of attribute database.
137 138 139 |
# File 'lib/rake_dotnet.rb', line 137 def database @database end |
#direction ⇒ Object
Returns the value of attribute direction.
137 138 139 |
# File 'lib/rake_dotnet.rb', line 137 def direction @direction end |
#field_terminator ⇒ Object
Returns the value of attribute field_terminator.
136 137 138 |
# File 'lib/rake_dotnet.rb', line 136 def field_terminator @field_terminator end |
#file ⇒ Object
Returns the value of attribute file.
137 138 139 |
# File 'lib/rake_dotnet.rb', line 137 def file @file end |
#keep_identity_values ⇒ Object
Returns the value of attribute keep_identity_values.
136 137 138 |
# File 'lib/rake_dotnet.rb', line 136 def keep_identity_values @keep_identity_values end |
#keep_null_values ⇒ Object
Returns the value of attribute keep_null_values.
136 137 138 |
# File 'lib/rake_dotnet.rb', line 136 def keep_null_values @keep_null_values end |
#native_type ⇒ Object
Returns the value of attribute native_type.
136 137 138 |
# File 'lib/rake_dotnet.rb', line 136 def native_type @native_type end |
#schema ⇒ Object
Returns the value of attribute schema.
137 138 139 |
# File 'lib/rake_dotnet.rb', line 137 def schema @schema end |
#table ⇒ Object
Returns the value of attribute table.
137 138 139 |
# File 'lib/rake_dotnet.rb', line 137 def table @table end |
#wide_character_type ⇒ Object
Returns the value of attribute wide_character_type.
136 137 138 |
# File 'lib/rake_dotnet.rb', line 136 def wide_character_type @wide_character_type end |
Instance Method Details
#cmd ⇒ Object
210 211 212 |
# File 'lib/rake_dotnet.rb', line 210 def cmd return "#{super} #{db_object} #{direction} #{path} #{server} #{credentials} #{keep_identity_values} #{keep_null_values} #{wide_character_type} #{field_terminator} #{native_type}" end |
#credentials ⇒ Object
166 167 168 169 170 171 172 |
# File 'lib/rake_dotnet.rb', line 166 def credentials if @trusted return '-T' else return "-U \"#{@user}\" -P \"#{@password}\"" end end |
#db_object ⇒ Object
182 183 184 |
# File 'lib/rake_dotnet.rb', line 182 def db_object return "[#{@database}].[#{@schema}].[#{@table}]" end |
#path ⇒ Object
186 187 188 |
# File 'lib/rake_dotnet.rb', line 186 def path return '"' + File.(@file).gsub('/', '\\') + '"' end |
#revert_optionals ⇒ Object
214 215 216 217 218 219 220 221 |
# File 'lib/rake_dotnet.rb', line 214 def revert_optionals @keep_identity_values = nil @keep_null_values = nil @wide_character_type = nil @field_terminator = nil @native_type = nil @direction = nil end |
#run ⇒ Object
223 224 225 226 227 |
# File 'lib/rake_dotnet.rb', line 223 def run puts cmd if VERBOSE == true sh cmd revert_optionals end |
#server ⇒ Object
174 175 176 |
# File 'lib/rake_dotnet.rb', line 174 def server return "-S \"#{@server}\"" end |