perl5-dbi / DBD-MariaDB

Perl MariaDB driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BLOB as parameter in execute

illuusio opened this issue · comments

If one wants to add binary BLOB (large or small) that contains UTF-8 chars then in MariaDB it bigger than original as it's inserted as UTF-8 form.
It could be encoded to correct string (base64) or as in PR #178 decoded back to Perl UTF-8 form. But which is correct way to do it?

It makes no sense (though it is permissible) to encode binary data to UTF-8. You will want to bind any binary parameter manually as described here: https://metacpan.org/dist/DBD-MariaDB/view/lib/DBD/MariaDB.pod#Binary-parameters, and when retrieved from the database it will return the binary data directly.

Unfortunately there is no interface to do so without a separate call to bind_param.

Yes I thought this was RTFM problem. I'll correct my code to follow documentation