On 03 Oct 2012 at 10:50, Clemens Ladisch <clem...@ladisch.de> wrote:

> Tim Streater wrote:

>> What's the right way to get the data into the column?
>
> 1) Use SQLite blob literals, which are hex strings with an "x" prefix:
>
>     ... set imagedata = x'ffd8ffe000104a46...' where ...
>
> 2) Use parameters (which is recommended in any case to avoid both
>   formatting and SQL injection problems):
>
>     $stmt = $dbh->prepare('update imagetable set imagedata = ? where linkid =
> ?');
>     $stmt->bindValue(1, $imgdata, PDO::PARAM_LOB);
>     $stmt->bindValue(2, $linkid, PDO::PARAM_INT);
>     $stmt->execute();
>
>   See also <http://php.net/manual/en/pdo.lobs.php>.

Thanks, and to Simon too. I did (2) above and the references pointed me at the 
right part of the doc to do the inverse. So I've now got a nice couple of 
blobRead and blobWrite functions that are nicely integrated with my error 
handling, too.

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

Reply via email to