PDO SQLite support just doesn’t work fully?

Original post provide by Core PHP

After wasting hours and hours on this, I’ve come to the conclusion that the PDO SQLite blob support is totally borked, and just doesn’t appear to work properly. I really don’t know why, or what is going on, but after spending hours trying various code permutations I’m just not getting anywhere. I tried asking on php_general to no avail, so I consider this blog entry my last ditch attempt to get someone to shed some light on this issue before I give-in and ditch PDO for good.

I’m trying to store an image in a SQLite database using PDO. Yes yes, we all know that storing images in database files is a bad thing but none-the-less, it should technically be able to handle it. The source code given on http://uk2.php.net/manual/en/ref.pdo.php under Example 1669 appears to be just plain wrong. For example you can’t beginTransaction() on a statement! So I had to re-write it a little, but no matter what it just doesn’t play ball.

The problem appears to be the PDO LOB type. It will only ever send the first 21 bytes of the image to the database. Here’s the code:

Continue reading “PDO SQLite support just doesn’t work fully?”

Previous Articles:
DC PHP Conference 2008: Call For Papers Open
2008 DC PHP Conference June 2nd - 4thSubmission Deadline: March 15, 2008Notification by: April 2, 2008 Join us at the 3rd Annual DC PHP Conference. The event will take place at George Washington University's Cafritz Conference Center in the heart of Washington DC.
Luke Welling Joins OmniTI
Those who know him are more familiar with his keen sense of humor and undying urge to bait people for his own amusement. He is working with me as part of our growing web application security practice, focusing on three key areas: Security Training Program Help clients avoid security problems.
A Guide To Using PHP 5 Extensions On Windows
It can be frustrating at best, but there are several mistakes people make that cause this error, and there are also a number of 'hidden rules' that need to be obeyed in the php.ini file as well. To aid you, I have put together this guide which covers every default extension that comes with PHP5 and tells you how to get it working on Windows, what dependencies they have and also some vital tips on how you need to arrange your php.ini file and file system to ensure a painless set-up and no messy DLL conflicts.
Anurag Agarwal's Reflections
It reminds me how behind I am on posting articles and hopefully gives me the kick I need to catch up. :-) I'm honored to be considered among experts like Amit Klein, Robert Hansen, Jeremiah Grossman, Ivan Ristic, and others.
Build A Photo Gallery Using CakePHP And Flickr
Is the Flickr interface doing justice to your stunning snaps? It's time to consider customization! Jonathan shows us the ropes in his hands-on tutorial, as he uses CakePHP and the Flickr API to build an attractive, fully customized gallery that displays Flickr photos to their best advantage.
More Articles:
A Guide To Using CVS Dude With NuSphere PhpED
If you use NuSphere's excellent PhpED IDE then you'll know it has built-in CVS support for source control. This is a guide I wrote to using PhpED with the CVSDude.com service, so you can get your projects up and running in no time at all.
Sold On EBay, Shipped By Amazon.com - New York Times
Sold on eBay, Shipped by Amazon.com - New York Times ?We are willing to plant seeds that take time to grow?
PhpED 5.0 First Views
It's the biggest release ever in our 7-year history, with all-new tools for PHP code folding, embedded Mozilla browser, a powerful database form wizard, a completely new look and feel and so much more." Alllrighty, I'll have me some of that!
Ajax Is Not An Acronym
You can update the interface with CSS, so two-way communication isn't necessary. You could argue that the use of