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.

> 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.

Igor Tandetnik 



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

Reply via email to