On Sun, 06 Feb 2011 10:53:05 -0500, Yves Goergen <nospam.l...@unclassified.de> wrote:
> On 06.02.2011 14:36 CE(S)T, Samuel Adam wrote: [snip] >> * Make sure the binding is done as BLOB and not TEXT. PDO probably has >> its own flags defined for this. This is the part that tells SQLite >> whether you are inserting TEXT or BLOB. > > There is a PDO method to execute a prepared statement with an array of > values to be used as parameters. There is no way to specify additional > information about how to interpret these values in this method. But > there is another method to bind each value separately, and it has > another argument to pass some data type. I'd need to change the way I > execute my SQL statements to make use of it. Depending on your PHP version, a (binary) cast may help; if you are writing the GIF image as a string-literal in your source code (probably not), b"" will specify the correct type directly; if you are opening an external file, check your fopen() flags or whatnot. N.b., I cannot predict whether PDO will use this type information or ignore it. > I'd expect that SQLite known on its own what data type a column is and > respect it. Seems like SQLite is sometimes more type-agnostic than PHP, > where I take great care of data types in this special application. SQLite also cares for types: http://www.sqlite.org/datatype3.html PHP has somewhat similar “duck typing”, and its types are much more complicated; thus you should already be familiar with the concept. > For now, I just won't save files to the database with SQLite but instead > on disk. I won't get to rewriting the database class anytime soon but > I'll look into it then. > > I'm wondering why I get all the data back but SQLite can't count its > characters... And the image I get back from SQLite looks error-free so > it probably didn't make a single mistake handling it as text data. What you are wondering has been previously explained in this thread, in precise terms and with reference to docs. 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 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users