diff --git a/common.pri b/common.pri index 9e60dba..193c8b8 100644 --- a/common.pri +++ b/common.pri @@ -70,7 +70,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 43 +LIMEREPORT_VERSION_RELEASE = 47 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 3cdb434..ceb9f5c 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -118,9 +118,9 @@ void QueryHolder::setConnectionName(QString connectionName) m_connectionName=connectionName; } -void QueryHolder::invalidate(IDataSource::DatasourceMode mode){ +void QueryHolder::invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed){ QSqlDatabase db = QSqlDatabase::database(m_connectionName); - if (!db.isValid()){ + if (!db.isValid() || dbWillBeClosed){ setLastError(QObject::tr("Invalid connection! %1").arg(m_connectionName)); delete m_query; m_dataSource.clear(); @@ -562,9 +562,10 @@ IDataSource *ProxyHolder::dataSource(IDataSource::DatasourceMode mode) return m_datasource.data(); } -void ProxyHolder::invalidate(IDataSource::DatasourceMode mode) +void ProxyHolder::invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed) { Q_UNUSED(mode) + Q_UNUSED(dbWillBeClosed); if (m_model && m_model->isInvalid()){ m_invalid = true; m_lastError = tr("Datasource has been invalidated"); diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index 3a91a30..b935873 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -75,7 +75,7 @@ public: virtual bool isOwned() const = 0; virtual bool isEditable() const = 0; virtual bool isRemovable() const = 0; - virtual void invalidate(IDataSource::DatasourceMode mode) = 0; + virtual void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false) = 0; virtual void update() = 0; virtual void clearErrors() = 0; virtual ~IDataSourceHolder(){} @@ -92,7 +92,7 @@ public: QString lastError() const { return m_dataSource->lastError(); } bool isEditable() const { return false; } bool isRemovable() const { return false; } - void invalidate(IDataSource::DatasourceMode mode){Q_UNUSED(mode)} + void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false){Q_UNUSED(mode) Q_UNUSED(dbWillBeClosed)} void update(){} void clearErrors(){} signals: @@ -201,7 +201,7 @@ public: bool isPrepared() const {return m_prepared;} QString lastError() const { return m_lastError; } void setLastError(QString value){m_lastError=value; if (m_query) {delete m_query; m_query=0;}} - void invalidate(IDataSource::DatasourceMode mode); + void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false); void update(); void clearErrors(){setLastError("");} DataSourceManager* dataManager() const {return m_dataManager;} @@ -331,7 +331,7 @@ public: bool isEditable() const { return true; } bool isRemovable() const { return true; } QString lastError() const { return m_lastError; } - void invalidate(IDataSource::DatasourceMode mode); + void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false); void update(){} void clearErrors(){m_lastError = "";} DataSourceManager* dataManager() const {return m_dataManger;} @@ -424,7 +424,7 @@ public: bool isOwned() const {return m_owned;} bool isEditable() const {return false;} bool isRemovable() const {return false;} - void invalidate(IDataSource::DatasourceMode mode){Q_UNUSED(mode)} + void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false){Q_UNUSED(mode) Q_UNUSED(dbWillBeClosed)} ~CallbackDatasourceHolder(){delete m_datasource;} void update(){} void clearErrors(){} diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 0e03986..621812b 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -932,7 +932,7 @@ void DataSourceManager::disconnectConnection(const QString& connectionName) if (isQuery(datasourceName) || isSubQuery(datasourceName)){ QueryHolder* qh = dynamic_cast(dataSourceHolder(datasourceName)); if (qh && qh->connectionName().compare(connectionName,Qt::CaseInsensitive)==0){ - qh->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE); + qh->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE, true); qh->setLastError(tr("invalid connection")); } }