Skip Menu |

This queue is for tickets about the DBD-SQLite CPAN distribution.

Report information
The Basics
Id: 77252
Status: open
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: derhoermi [...] gmx.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Misleading sqlite_unicode documentation
Date: Thu, 17 May 2012 01:21:13 +0200
To: bug-DBD-SQLite [...] rt.cpan.org
From: Bjoern Hoehrmann <derhoermi [...] gmx.net>
Hi, Version 1.35 of DBD::SQLite says for `sqlite_unicode` "If set to a true value, DBD::SQLite will turn the UTF-8 flag on for all text strings coming out of the database". Given that SQLite 3 defines the term "text string" as being of the storage class "TEXT", as opposed to "BLOB", this should probably say something like "all ... including the value of BLOB columns". The documentation continues how you might want to request blob behavior explicitly when when doing UPDATEs, but that fails to address handling values coming out of the database (and does not seem to make much sense since the option only affects things "coming out of the database"). That would seem another issue with the documentation. (The behavior I am seeing is that DBD::SQLite turns the UTF-8 flag on when retrieving BLOBs from the database, at least I get UTF-8 warnings when doing so and trying to serialize the DBI responses using YAML::XS and Data::Dumper, followed by Perl crashing. I haven't looked at it in detail, if v1.35 does indeed treat "BLOB" columns different from "TEXT" columns I'm happy to check what else might be going on.) regards, -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de 25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Hi. First of all, could you send us a code to show what you actually did to retrieve/store values? Generally speaking, DBD::SQLite treats everything as a text unless you explicitly treat it as a blob (or something else); that means, you always need to use 3-args bind_param with SQL_BLOB to insert a blob. As the DBD::SQLite doc says, defining a column type as BLOB is not sufficient at all, as the type of the stored data is dynamically defined and may be irrelevant to the declared column type (this is a feature of SQLite). If you get a unicode string (with UTF-8 flag on) when you try to retrieve a blob from a database, you must have stored it as a text (into a column defined as blob, I suppose; see also "Blobs" section in the DBD::SQLite pod). DBD::SQLite does treat a blob differently from a text, but it doesn't usually care how the column is declared; it only checks the actual (internal) type of the data which you can tell by the "typeof(column)" function. On Thu May 17 08:21:23 2012, derhoermi@gmx.net wrote: Show quoted text
> Hi, > > Version 1.35 of DBD::SQLite says for `sqlite_unicode` "If set to a > true value, DBD::SQLite will turn the UTF-8 flag on for all text
strings Show quoted text
> coming out of the database". Given that SQLite 3 defines the term
"text Show quoted text
> string" as being of the storage class "TEXT", as opposed to "BLOB",
this Show quoted text
> should probably say something like "all ... including the value of
BLOB Show quoted text
> columns". > > The documentation continues how you might want to request blob
behavior Show quoted text
> explicitly when when doing UPDATEs, but that fails to address handling > values coming out of the database (and does not seem to make much
sense Show quoted text
> since the option only affects things "coming out of the database").
That Show quoted text
> would seem another issue with the documentation. > > (The behavior I am seeing is that DBD::SQLite turns the UTF-8 flag on > when retrieving BLOBs from the database, at least I get UTF-8 warnings > when doing so and trying to serialize the DBI responses using YAML::XS > and Data::Dumper, followed by Perl crashing. I haven't looked at it in > detail, if v1.35 does indeed treat "BLOB" columns different from
"TEXT" Show quoted text
> columns I'm happy to check what else might be going on.) > > regards,