Make tests even better.
This commit is contained in:
parent
8b17aa0854
commit
dc0dd28f12
@ -591,6 +591,7 @@ void FormSettings::mysqlTestConnection() {
|
||||
|
||||
switch (error_code) {
|
||||
case DatabaseFactory::MySQLOk:
|
||||
case DatabaseFactory::MySQLUnknownDatabase:
|
||||
m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::Ok, interpretation, interpretation);
|
||||
break;
|
||||
|
||||
|
@ -110,10 +110,13 @@ DatabaseFactory::MySQLError DatabaseFactory::mysqlTestConnection(const QString &
|
||||
database.close();
|
||||
return MySQLOk;
|
||||
}
|
||||
else {
|
||||
else if (database.lastError().isValid()) {
|
||||
// Connection failed, do cleanup and return specific error code.
|
||||
return static_cast<MySQLError>(database.lastError().number());
|
||||
}
|
||||
else {
|
||||
return MySQLUnknownError;
|
||||
}
|
||||
}
|
||||
|
||||
QString DatabaseFactory::mysqlInterpretErrorCode(MySQLError error_code) const {
|
||||
@ -122,7 +125,7 @@ QString DatabaseFactory::mysqlInterpretErrorCode(MySQLError error_code) const {
|
||||
return tr("MySQL server works as expected.");
|
||||
|
||||
case MySQLUnknownDatabase:
|
||||
return tr("Selected database does not exist (yet).");
|
||||
return tr("Selected database does not exist (yet). It will be created. It's okay.");
|
||||
|
||||
case MySQLCantConnect:
|
||||
case MySQLConnectionError:
|
||||
|
@ -43,6 +43,7 @@ class DatabaseFactory : public QObject {
|
||||
// Describes possible MySQL-specific errors.
|
||||
enum MySQLError {
|
||||
MySQLOk = 0,
|
||||
MySQLUnknownError = 1,
|
||||
MySQLAccessDenied = 1045,
|
||||
MySQLUnknownDatabase = 1049,
|
||||
MySQLConnectionError = 2002,
|
||||
|
Loading…
x
Reference in New Issue
Block a user