On 5/14/07, Hongli Lai <[EMAIL PROTECTED]> wrote:
>
> On May 14, 9:07 pm, "Mislav Marohnić" <[EMAIL PROTECTED]>
> wrote:
> > Doesn't that negate the whole idea of having prepared statements in the
> > database in the first place? I don't think Rails core team would accept the
> > patch that slows down ActiveRecord just for the sake of using a database
> > feature (in a wrong way).
>
> Actually, no. One of the problems with quoting string manually is
> excessive memory usage in Rails. For example, if you're uploading a 1
> MB photo to your database, then Rails has to quote a 1 MB string,
> which is very slow and results in more than 1 MB memory usage because
> of string overheads. Using prepared statements will remove this
> problem.

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)
  - ??

I've always advised people that filesystem is preferrable (it's a
file, keep in in the file system) since you can easily back it up, and
you don't have to hit rails to get the image (sloooow, and uses up an
app listener).

If you ignore the problem of quoting 1mb strings from image uploads,
what other reason is there for prepared statements?

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-core@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to