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