On 6 February 2011 10:40, Yves Goergen <nospam.l...@unclassified.de> wrote: > Hi, > > I'm storing small files in a BLOB field in the database. I'd like to > determine the size of such a file with an SQL query without fetching the > data. I tried using the LENGTH() function on that field but it stops > counting at the first NUL byte. A 3.2 KiB GIF image is reported to be > only 7 bytes long, that's just the file header length.
This not the case for me: SQLite version 3.6.19 Enter ".help" for instructions sqlite> sqlite> create table tst( id integer primary key, data text ); sqlite> sqlite> insert into tst values( null, 'line 1' ); sqlite> insert into tst values( null, x'6565' ); sqlite> insert into tst values( null, x'656500656565656667686970' ); sqlite> sqlite> select *, typeof( data ), length( data ) from tst; 1|line 1|text|6 2|ee|blob|2 3|ee|blob|12 sqlite> > > Is this a bug or should I use another function on binary data? length() should return the number of bytes for a blob. What does typeof() tell you about the data? > > The SQLite version is 3.6.20 from PHP 5.3.1 on Windows XP. > > -- > Yves Goergen "LonelyPixel" <nospam.l...@unclassified.de> Regards, Simon _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users