Rails fast sqlite3 data filling


/ Published in: Rails
Save to your folder(s)



Copy this code and paste it in your HTML
  1. sql = ActiveRecord::Base.connection();
  2. sql.execute("PRAGMA synchronous = OFF")
  3. sql.execute("BEGIN")
  4.  
  5. sqlrequest = "INSERT INTO `products` VALUES(null,'"+title+"','"+cat1+"','"+cat2+"','"+ye+"','"+price+"');"
  6. sql.execute(sqlrequest)
  7.  
  8. sql.execute("COMMIT")
  9. sql.execute("PRAGMA synchronous = NORMAL")

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.