perl5-dbi/DBD-MariaDB

Options to the driver mysql_enable_utf8mb4 and mysql_enable_utf8 are not recognised

hadjiprocopis opened this issue · 5 comments

I am migrating my code to MariaDB from MySQL. Previously I could pass these options to the driver via connect()'s last argument which is a hashref of options:

connect("DBI:mysql:database=testdb", $user, $pass, {'mysql_enable_utf8mb4' => 1, 'mysql_enable_utf8' => 1, 'RaiseError' => 1, 'PrintError' => 1});

But I get an error that neither mysql_enable_utf8mb4 nor mysql_enable_utf8 are recognised when I switch to the MariaDB driver connect("DBI:MariaDB:...", ...).

Do I still need to use these options when my DB contains unicode strings (greek etc.)?

Thank you

@hadjiprocopis https://metacpan.org/dist/DBD-MariaDB/view/lib/DBD/MariaDB.pod#UNICODE-SUPPORT

Do you mean I should open another issue because this documentation got me more confused? :)

I think that says that by default all communication to/from server is based on utf8mb4. Hence I don't need this option. Is that correct?

@hadjiprocopis

Do you mean I should open another issue because this documentation got me more confused? :)

The point is that DBD::mysql is a bit different that DBD::MariaDB.

I think that says that by default all communication to/from server is based on utf8mb4.
Hence I don't need this option. Is that correct?

As I understand, you need to remove this option.
But I don't know if this is enough. Depends on the code which you have.

Yes, DBD::MariaDB fully supports Unicode by default, these attributes make no sense. Just remove them.

Yes, DBD::MariaDB fully supports Unicode by default, these attributes make no sense. Just remove them.

Yes, It supports Unicode by default.
As I understand, you cannot simply rename the usage of DBD::mysql to DBD::MariaDB in the real database with data.