On May 15, 11:55 pm, Courtenay <[EMAIL PROTECTED]> wrote: > On 5/14/07, Hongli Lai <[EMAIL PROTECTED]> wrote: > I know this is tangential, but is there any good reason for storing > images in the database? > > I can think of a few, but they're not very good; > - security (but that can be handled with http or other auth). > - logging (you want to send your images through rails so you know > the # of downloads) > - ??
- All data is in one place. That may make backupping easier. - Support for transactions. Suppose that you not only store the image, but also some metadata. If I first save the image file on disk, and then save the metadata, but the computer crashes during metadata saving, then I'm left with a stale file that's not used. If I first save the metadata and then saves the image file, and the computer crashes during image file saving, then I have a corrupted image file but intact metadata. > If you ignore the problem of quoting 1mb strings from image uploads, > what other reason is there for prepared statements? Oracle support. Oracle lives by prepared statements, even if those prepared statements aren't reused, as someone has pointed out. One can argue that few Rails developers use Oracle, but I can also argue that that's because Rails performs badly on Oracle. Furthermore: - My code will fallback to using "unprepared statements" if it thinks that using prepared statements is not necessary, so performance is not a problem. - It moves a lot of the statement building code to separate classes. This makes ActiveRecord::Base smaller, and thus easier to read and to maintain. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en -~----------~----~----~----~------~----~------~--~---
