diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 6cb5678..18e0d49 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -70,7 +70,7 @@ bool QueryHolder::runQuery(IDataSource::DatasourceMode mode) m_mode = mode; QSqlDatabase db = QSqlDatabase::database(m_connectionName); - QSqlQuery* query = new QSqlQuery(db); + QSqlQuery query(db); if (!db.isValid()) { setLastError(QObject::tr("Invalid connection! %1").arg(m_connectionName)); @@ -82,13 +82,12 @@ bool QueryHolder::runQuery(IDataSource::DatasourceMode mode) if (!m_prepared) return false; } - query->prepare(m_preparedSQL); - - fillParams(query); - query->exec(); + query.prepare(m_preparedSQL); + fillParams(&query); + query.exec(); QSqlQueryModel *model = new QSqlQueryModel; - model->setQuery(*query); + model->setQuery(query); while (model->canFetchMore()) model->fetchMore();