Important: BLOBs stopped working with mysql, RDBO needs to be updated

17 views
Skip to first unread message

Alexander Karelas

unread,
May 23, 2017, 11:39:09 PM5/23/17
to Rose::DB::Object
With a recent version of DBD::mysql (I don't remember which version, but
it must be a couple of months old), data gets utf8_encoded by default,
even when saved to a BLOB field, and doesn't get utf8_decoded when
SELECT-ed from a BLOB field.

This causes a problem also when using RDBO, because, if you save one
string of bytes in a BLOB field, and then retrieve it, you get back a
different value than what you entered.

(when mysql_enable_utf8 is set to true, that is)

The solution is to prepare the SQL statements as follows:

use DBI ':sql_types';

my $sth = $dbh->prepare("INSERT INTO my_table SET name = ?, image = ?");
$sth->bind_param(1, $name);
$sth->bind_param(2, $image, SQL_BLOB);

That will avoid utf8_encoding the $image variable.

Otherwise RDBO will not work with BLOB-type fields in MySQL.

I tried all of the above, and it's true.

I was told on IRC that there's no other solution.

John Siracusa, can you please update RDBO to handle BLOBs?

Thanks,

- Alexander

John Siracusa

unread,
May 23, 2017, 11:45:31 PM5/23/17
to rose-db-object
I doubt I'll have time to look into this for several weeks at least, but if you send a patch that will definitely speed things along.

-John



--
Source: https://github.com/siracusa/rose
CPAN: http://search.cpan.org/dist/Rose-DB-Object
--- You received this message because you are subscribed to the Google Groups "Rose::DB::Object" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rose-db-object+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexander Karelas

unread,
May 26, 2017, 6:53:52 AM5/26/17
to rose-db...@googlegroups.com

I don't have the skills to write a patch, but I can easily wait week, or even months for you to do it.

So I will wait for you.

Thanks,

- Alex

To unsubscribe from this group and stop receiving emails from it, send an email to rose-db-objec...@googlegroups.com.

Alexander Karelas

unread,
Jun 29, 2017, 5:20:10 PM6/29/17
to rose-db...@googlegroups.com

The old behaviour of DBD::mysql seems to have been reinstated. Is this temporary? Permanent? I haven't understood.

Your call.


-------- Forwarded Message --------

Subject: On list "Projects" and 1 other: DBD-mysql 4.043 just released
Date: Thu, 29 Jun 2017 21:13:10 +0000
From: PerlModules.net <no-r...@perlmodules.net>
To: alex.k...@gmail.com


This module appears on the following lists: Projects, KARJALA's favorites

DBD-mysql 4.043

2017-06-29 Patrick Galbraith, Michiel Beijen, DBI/DBD community (4.043) YOUR ATTENTION PLEASE, THIS IS A REVERT TO 4.041 This version is the same as 4.041 with all its bugs and limitations. In version 4.042 there were some changes to Unicode handling that turned out to be causing issues with existing implementations. While it is possible to argue that the old behaviour was wrong and buggy, lots of applications and scripts were depending on this behaviour so it is NOT a good idea to change this. There were lots of commits since 4.041, we'll add those back bit by bit in a future release, excluding the ones which cause problems. 2017-??-?? Patrick Galbraith, Michiel Beijen, DBI/DBD community (4.042_01) * Use Devel::CheckLib 1.09 or newer, fixes https://github.com/perl5-dbi/DBD-mysql/issues/109 * Improve CI testing on AppVeyor: caching, path to cpan, configure deps (pali) * Specify bigint as test dependency.

Reply all
Reply to author
Forward
0 new messages