Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to make DBD::mysql stable in async code
According to [^1] we have to care about connections: [1] https://dev.mysql.com/doc/refman/5.7/en/c-api-threaded-clients.html
- Loading branch information
Showing
5 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use DBIish; | ||
use Test; | ||
|
||
plan 100; | ||
|
||
# This is meant to ensure that we load libmysqlclient.{so|dll} early enough. | ||
DBIish.install-driver('mysql', :RaiseError); | ||
|
||
await do for 1..100 { | ||
start { | ||
diag "Connecting to database for test $_ in thread $*THREAD.id()"; | ||
my $mysql = DBIish.connect('mysql', | ||
:database<dbdishtest>, | ||
:user<testuser>, | ||
:password<testpass>, | ||
:RaiseError, | ||
); | ||
my $time = rand * 10; | ||
my $sth = $mysql.prepare("SELECT $time, SLEEP($time)"); | ||
$sth.execute(); | ||
|
||
# sleepsorted output | ||
pass "Slept about $time seconds for test $_ in thread $*THREAD.id()"; | ||
$mysql.dispose(); | ||
} | ||
} |