You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Robert Misior <mi...@salem.edu> on 2002/10/22 16:07:47 UTC

Storing HTML in database

Hello,

I'm looking for a good approach of storing HTML in mysql database (field 
type is text).  Currently I'm converting any character other then a 
number or  alpha character to it's ASCII value before the table is 
updated.  So far this  is working fine  except extra overhead and 
storage space.  The main reason why I'm doing it this way is  because I 
had problems with the sql statement being truncated  at the first 
appearance of a  ' in the HTML.
 Would searching for ' and replacing them with \' be a bather solution 
or would using PreparedStatement fix this problem with '?

Thanks for any suggestions,
Robert 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Storing HTML in database

Posted by Dennis Muhlestein <de...@zserve.com>.
Use a PreparedStatement instead of Statement to do the insert if you
can.  It'll do the escaping for you.

-Dennis


On Tue, 2002-10-22 at 08:07, Robert Misior wrote:
> Hello,
> 
> I'm looking for a good approach of storing HTML in mysql database (field 
> type is text).  Currently I'm converting any character other then a 
> number or  alpha character to it's ASCII value before the table is 
> updated.  So far this  is working fine  except extra overhead and 
> storage space.  The main reason why I'm doing it this way is  because I 
> had problems with the sql statement being truncated  at the first 
> appearance of a  ' in the HTML.
>  Would searching for ' and replacing them with \' be a bather solution 
> or would using PreparedStatement fix this problem with '?
> 
> Thanks for any suggestions,
> Robert 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>