C is better than everything else, isn't it???? :-) He needs to add the "type" argument to bindvalue and tell it it's a blob.
http://us2.php.net/manual/en/sqlite3stmt.bindvalue.php Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate ________________________________________ From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Samuel Adam [a...@certifound.com] Sent: Sunday, February 06, 2011 7:49 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] LENGTH on a BLOB field stops at NUL byte On Sun, 06 Feb 2011 08:22:58 -0500, Black, Michael (IS) <michael.bla...@ngc.com> wrote: > http://www.sqlite.org/c3ref/blob_open.html > http://www.sqlite.org/c3ref/blob_bytes.html Mr. Black, is that a tactful hint that the original poster should rewrite his app in C rather than PHP? (Not that I’d disagree—not at all!—just wanted to clarify, since o.p.’s problem originated with SQL core function length() which “returns the length of X in characters if X is a string, or in bytes if X is a blob”[1].) [1] http://www.sqlite.org/lang_corefunc.html (P.S.—For precision, the quoted doc should say “text value” rather than “string”.) Very truly, Samuel Adam ◊ <http://certifound.com/> 763 Montgomery Road ◊ Hillsborough, NJ 08844-1304 ◊ United States Legal advice from a non-lawyer: “If you are sued, don’t do what the Supreme Court of New Jersey, its agents, and its officers did.” http://www.youtube.com/watch?v=iT2hEwBfU1g > > Michael D. Black > Senior Scientist > NG Information Systems > Advanced Analytics Directorate > > > > ________________________________________ > From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] > on behalf of Yves Goergen [nospam.l...@unclassified.de] > Sent: Sunday, February 06, 2011 4:40 AM > To: General Discussion of SQLite Database > Subject: EXT :[sqlite] LENGTH on a BLOB field stops at NUL byte > > 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. > > Is this a bug or should I use another function on binary data? > > The SQLite version is 3.6.20 from PHP 5.3.1 on Windows XP. > > -- > Yves Goergen "LonelyPixel" <nospam.l...@unclassified.de> > Visit my web laboratory at http://beta.unclassified.de > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users