Hi!
Other questions inline:

> To: sqlite-users@sqlite.org
> From: itandet...@mvps.org
> Date: Wed, 13 May 2009 11:48:11 -0400
> Subject: Re: [sqlite] Blob length in characters vs size in bytes
> 
> Salvatore Di Guida <diguid...@hotmail.com>
> wrote:
> > Since I am a newcomer in SQLite, as a preliminary question, what is
> > the difference between
> > sqlite> select length(X'01');
> > and
> > sqlite> select length('01');
> > It seems that the former gives the size in bytes, the latter the
> > length of the string.
> 
> Correct.
If so, why do this query return very different answers:
sqlite> select length(X'01');
1
sqlite> select length(X'0');
SQL error: unrecognized token: "X'0'" ?
> 
> > However, I tried this example:
> >
> > sqlite> create table x ( a TEXT, b BLOB );
> > sqlite> insert into x values ( 'a', 'a' );
> > sqlite> insert into x values ( 'abcd', 'abcd' );
> > sqlite> select length(a), length(b) from x;
> > 1|1
> > 4|4
> 
> length() looks at the actual type of the data stored, not the type the 
> column is declared with. Just because you declared the column as BLOB 
> doesn't mean you can't store strings in it. For more details, see 
> http://sqlite.org/datatype3.html
> 
> > The length function, then, measures the length in characters of the
> > blob.
> 
> You don't have any blobs in your table, only strings.
How can I add a blob type in the b column?
> 
> Igor Tandetnik 
> 
> 
Thanks again!

Salvatore
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_________________________________________________________________
PiĆ¹ di 100 Emoticon gratis per il tuo Messenger!
http://intrattenimento.it.msn.com/emoticon
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to