Skip to content

Commit

Permalink
Don't ignore MySQL errors on initialization.
Browse files Browse the repository at this point in the history
Otherwise, we fail to notice, for example, when the database server isn't
5.6.4 or higher. Resolves #158.
  • Loading branch information
theory committed Jun 3, 2014
1 parent 12f66d6 commit 363dbef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion Changes
Expand Up @@ -13,9 +13,12 @@ Revision history for Perl extension App::Sqitch
database. Thanks to Timothy Procter for the report (Issue #166).
- Fixed issue with aggregating text values with `COLLECT()` on Oracle.
Thanks to Timothy Procter for the spelunking (Issue #91).
- Fix issue where SQL*Plus could not run rework scripts because of the
- Fixed issue where SQL*Plus could not run rework scripts because of the
`@` in the file name. Thanks to Timothy Procter for the report
(Issue #165).
- Fix issue where, on first deploy, the MySQL engine would fail to notice
that the server was not the right version of MySQL. Thanks to Luke
Young for the report (Issue #158).

0.992 2014-03-05T00:34:49Z
- Fixed target test failures on Windows.
Expand Down
11 changes: 6 additions & 5 deletions lib/App/Sqitch/Engine/mysql.pm
Expand Up @@ -171,12 +171,13 @@ sub initialized {
my $self = shift;

# Try to connect.
my $err = 0;
my $dbh = try { $self->dbh } catch { $err = $DBI::err };
# MySQL error code 1049 (ER_BAD_DB_ERROR): Unknown database '%-.192s'
return 0 if $err && $err == 1049;
my $dbh = try { $self->dbh } catch {
# MySQL error code 1049 (ER_BAD_DB_ERROR): Unknown database '%-.192s'
return if $DBI::err && $DBI::err == 1049;
die $_;
} or return 0;

return $self->dbh->selectcol_arrayref(q{
return $dbh->selectcol_arrayref(q{
SELECT COUNT(*)
FROM information_schema.tables
WHERE table_schema = ?
Expand Down

0 comments on commit 363dbef

Please sign in to comment.