Skip to content

Commit

Permalink
Use DBD::MariaDB instead of DBD::mysql
Browse files Browse the repository at this point in the history
It features better Unicode support and older versions of the MySQL
client library, whereas DBD::mysql v5 requires the v8 MySQL library. So
DBD::MariaDB is more compatible these days.

Discussion: https://www.perlmonks.org/?node_id=11163487
  • Loading branch information
theory committed Jan 4, 2025
1 parent f21368b commit 075d9c3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Revision history for Perl extension URI::db.

0.23
- Changed the MySQL (and MariaDB) URI `dbi_dsn()` method to use
DBD::MariaDB instead of DBD::mysql, because it better supports older
MySQL client libraries and improves Unicode support.

0.22 2024-04-05T01:38:17Z
- Changed Oracle database DBI parameter generation as follows:
Expand Down
2 changes: 1 addition & 1 deletion lib/URI/db.pm
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ DBI DSN. Some examples:
| URI | DSN |
|--------------------------------------+--------------------------------------------------|
| db:pg:try | dbi:Pg:dbname=try |
| db:mysql://localhost:33/foo | dbi:mysql:host=localhost;port=33;database=foo |
| db:mysql://localhost:33/foo | dbi:MariaDB:host=localhost;port=33;database=foo |
| db:db2://localhost:33/foo | dbi:DB2:HOSTNAME=localhost;PORT=33;DATABASE=foo |
| db:vertica:dbadmin | dbi:ODBC:DSN=dbadmin |
| db:mssql://foo.com/pubs?Driver=MSSQL | dbi:ODBC:Host=foo.com;Database=pubs;Driver=MSSQL |
Expand Down
2 changes: 1 addition & 1 deletion lib/URI/mysql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use base 'URI::_db';
our $VERSION = '0.23';

sub default_port { 3306 }
sub dbi_driver { 'mysql' }
sub dbi_driver { 'MariaDB' }
sub canonical_engine { 'mysql' }

sub _dbi_param_map {
Expand Down
4 changes: 2 additions & 2 deletions t/dbi.t
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ for my $spec (
},
{
uri => 'db:mysql://localhost:33/foo',
dsn => 'dbi:mysql:host=localhost;port=33;database=foo',
dsn => 'dbi:MariaDB:host=localhost;port=33;database=foo',
dbi => [ [host => 'localhost'], [port => 33], [database => 'foo'] ],
qry => [],
},
{
uri => 'db:mariadb://localhost:33/foo',
dsn => 'dbi:mysql:host=localhost;port=33;database=foo',
dsn => 'dbi:MariaDB:host=localhost;port=33;database=foo',
dbi => [ [host => 'localhost'], [port => 33], [database => 'foo'] ],
qry => [],
},
Expand Down

0 comments on commit 075d9c3

Please sign in to comment.