[OpenSER-Devel] TEXT vs BLOB data in database modules

Dan Pascu dan at ag-projects.com
Mon Apr 21 11:45:23 CEST 2008


On Monday 21 April 2008, Henning Westerholt wrote:
> On Sunday 20 April 2008, Bogdan-Andrei Iancu wrote:
> > I think option 2 will be better, mainly because we have 2 different
> > data types - BLOB cannot be 100% mapped over string as BLOB was
> > specifically design for:
> >      1) large amount of data (not suitable for STRING)
> >      2) data containing any kind of chars/bytes (not suitable for
> > STRING, like \0)
> >
> > For BLOB processing, most of the database libs provide specific
> > function to escape, un-escape data when comes to BLOB, and such code
> > already exists in openser.
> >
> > Also, this will maintain some consistency at the data level and avoid
> > mixing them (and create confusion).
>
> Hi Bogdan,
>
> according to http://dev.mysql.com/doc/refman/5.0/en/blob.html TEXT
> colums are treated as non-binary strings, so its not allowed to store
> binary data in them. So the usage of the specific escaping functions is
> not really necessary. But the length argument is valid anyway.

The usage of escaping is always necessary to avoid SQL injections.

On a side note, TEXT and BLOB in mysql are limited to 64k. If one plans to 
store presence related xml documents in such a column, be aware that they 
can easily exceed 64k, which means that most likely a LONGTEXT or 
LONGBLOB should be used.

-- 
Dan



More information about the Devel mailing list