Errors messages have been modified

This commit is contained in:
Arin Alex 2016-06-24 23:12:33 +03:00
parent d07c44d6bb
commit a8b193de05
2 changed files with 6 additions and 3 deletions

View File

@ -323,13 +323,16 @@ QSharedPointer<QAbstractItemModel>DataSourceManager::previewSQL(const QString &c
query.exec(); query.exec();
model->setQuery(query); model->setQuery(query);
m_lastError = model->lastError().text(); m_lastError = model->lastError().text();
putError(m_lastError);
if (model->query().isActive()) if (model->query().isActive())
return QSharedPointer<QAbstractItemModel>(model); return QSharedPointer<QAbstractItemModel>(model);
else else
return QSharedPointer<QAbstractItemModel>(0); return QSharedPointer<QAbstractItemModel>(0);
} }
if (!db.isOpen()) if (!db.isOpen()){
m_lastError = tr("Connection \"%1\" is not open").arg(connectionName); m_lastError = tr("Connection \"%1\" is not open").arg(connectionName);
putError(m_lastError);
}
return QSharedPointer<QAbstractItemModel>(0); return QSharedPointer<QAbstractItemModel>(0);
} }
@ -657,7 +660,7 @@ void DataSourceManager::putProxyDesc(ProxyDesc *proxyDesc)
bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc)
{ {
bool connected = false; bool connected = false;
clearErrorsList(); clearErrors();
QString lastError =""; QString lastError ="";
foreach(QString datasourceName, dataSourceNames()){ foreach(QString datasourceName, dataSourceNames()){

View File

@ -178,7 +178,7 @@ public:
QString lastError() const { return m_lastError;} QString lastError() const { return m_lastError;}
void putError(QString error){ if (!m_errorsList.contains(error)) m_errorsList.append(error);} void putError(QString error){ if (!m_errorsList.contains(error)) m_errorsList.append(error);}
void clearErrorsList(){ m_errorsList.clear();} void clearErrors(){ m_errorsList.clear(); m_lastError = "";}
QStringList errorsList(){ return m_errorsList;} QStringList errorsList(){ return m_errorsList;}
bool designTime() const; bool designTime() const;
void setDesignTime(bool designTime); void setDesignTime(bool designTime);