| 1 | # | ||
| 2 | # $ perl -d:NYTProf script/profile.pl | ||
| 3 | # $ ntyprofhtml | ||
| 4 | # | ||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | use lib 'lib'; | ||
| 8 | use t::Util; | ||
| 9 | use File::Spec; | ||
| 10 | use Test::mysqld; | ||
| 11 | |||
| 12 | use DBIx::QueryLog (); | ||
| 13 | |||
| 14 | local $SIG{INT} = sub { exit 1 }; | ||
| 15 | |||
| 16 | my $mysqld = t::Util->setup_mysqld; | ||
| 17 | my $dbh = DBI->connect( | ||
| 18 | $mysqld->dsn(dbname => 'mysql'), '', '', | ||
| 19 | { | ||
| 20 | AutoCommit => 1, | ||
| 21 | RaiseError => 1, | ||
| 22 | }, | ||
| 23 | ) or die $DBI::errstr; | ||
| 24 | |||
| 25 | local *STDERR; | ||
| 26 | open STDERR, '>', File::Spec->devnull or die $!; | ||
| 27 | |||
| 28 | DBIx::QueryLog->begin; | ||
| 29 | |||
| 30 | for (1..1000) { | ||
| 31 | $dbh->do('SELECT * FROM user WHERE User = ?', undef, 'root'); | ||
| 32 | } |