Matthew Rudy Jacobs wrote: > On Feb 9, 8:11�am, Hitesh Rawal <[email protected]> > wrote: >> ActiveRecord::Base.connection.update()File.open(fileName.read) > > One of the constraints of using ActiveRecord::Base.connection is that > it can only do one statement at a time > > if you try and pass in "first statement ; second statement" it will > break. > > you may find something like this works better. > > sql = File.open(fileName).read > > statements = sql.split(";") > > count = 0 > statements.each do |sql_statement| > count += ActiveRecord::Base.connection.update(sql_statement) > end
Yes you are correct, I have used same approach to update my db records. Thanks for your response. But I dont want to use use this approach because not sure that, is ruby variable keep huge amount of data? I have tested with 10MB sql file and It works fine but don't know what happen when the file size is more than 10MB. Please let me know, If you have any Idea or Experience? Thanks Hitesh -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

