On Wed, 03 Nov 2010 18:35:52 -0400, Stephen Chrzanowski  
<pontia...@gmail.com> wrote:

> Couldn't you do something like:
>
> select length(FieldName) from TableName where Condition=True
>
> ?
>
> The result would be the size.  Otherwise, the only thing I can think of

Caution:  This will return the size in bytes of a BLOB field, but the size  
in *characters* of a TEXT field.  Except for lobotomized 7-bit-only text,  
the two will almost never be the same in a UTF-8 database.  If the  
database is encoded in UTF-16, there are exactly two bytes for every  
plane-0 character and exactly four bytes for every character in plane 1  
and up.

Casting to a BLOB will result in the text being simply reinterpreted as a  
BLOB, which is probably what the original poster wants.

If applied to a numeric (INTEGER or FLOAT) value, length() will first cast  
input to TEXT, then return the size in characters; since the cast will  
only return values <127, the result will be in bytes for UTF-8 and half  
the byte-size for UTF-16.

Casting to BLOB will not fix this, as the value is still first cast to  
TEXT.

Samuel Adam <a...@certifound.com>
763 Montgomery Road
Hillsborough, NJ  08844-1304
United States
http://certifound.com/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to