Dear Perl and MySQL enthusiasts,
I’m pleased to announce the release of DBD::mysql 4.019. I’m especially pleased because there are some new enhancements and features that have been provided by contributions from the community:
* Asynchronous support, added by Rob Hoelz. This is a new feature to DBD::mysql that takes advantage of libmysql’s asynchronous functions (see Jan’s article from 2008 http://jan.kneschke.de/2008/9/9/async-mysql-queries-with-c-api/) . From the DBD::mysql documentation:
You can make a single asynchronous query per MySQL connection; this allows
you to submit a long-running query to the server and have an event loop
inform you when it’s ready. An asynchronous query is started by either
setting the ‘async’ attribute to a true value in the DBI do()
method,
or in the DBI prepare()
method. Statements created with async
set to
true in prepare always run their queries asynchronously when DBI execute()
is called. The driver also offers three additional methods:
mysql_async_result, mysql_async_ready()
, and mysql_fd
.
mysql_async_result()
returns what do or execute would have; that is, the
number of rows affected. mysql_async_ready()
returns true if
mysql_async_result()
will not block, and zero otherwise. They both return
undef
if that handle is not currently running an asynchronous query.
mysql_fd
returns the file descriptor number for the MySQL connection; you
can use this in an event loop.
use feature 'say'; $dbh->do('SELECT SLEEP(10)', { async => 1 }); until($dbh->mysql_async_ready) { say 'not ready yet!'; sleep 1; } my $rows = $dbh->mysql_async_result;
* Enable environment variables for installation options from Amiri Barksdale. This is a feature that makes installation easier. For instance, you can set:
export DBD_MYSQL_TESTDB=test export DBD_MYSQL_TESTHOST=localhost export DBD_MYSQL_TESTPASSWORD=s3kr1+
And then when you build and test DBD::mysql, the installation process will automatically pick these values up. There are many more environment variables documented on the DBD::mysql POD
* Other various cleanups, fix from Pedro Melo which fixed code from 4.018 that broke in newer versions of Perl
* Cleanup of some warnings that persnickety compilers complained about
It’s great moving this project along, and I appreciate the patches and suggestions from the community!
The code can be found at:
http://search.cpan.org/~capttofu/DBD-mysql-4.019/lib/DBD/mysql.pm
Or
git clone https://github.com/CaptTofu/DBD-mysql
Related posts: