diff --git a/Libs/DICOM/Core/ctkDICOMDatabase.cpp b/Libs/DICOM/Core/ctkDICOMDatabase.cpp index eeba77c659..314487c912 100644 --- a/Libs/DICOM/Core/ctkDICOMDatabase.cpp +++ b/Libs/DICOM/Core/ctkDICOMDatabase.cpp @@ -1055,7 +1055,7 @@ bool ctkDICOMDatabasePrivate::applyDisplayedFieldsChanges( QMap boundValues; + QList boundValues; foreach (QString tagName, currentStudy.keys()) { if (!tagName.compare("PatientIndex")) @@ -1072,12 +1072,12 @@ bool ctkDICOMDatabasePrivate::applyDisplayedFieldsChanges( QMapDatabase); - updateDisplayStudyStatement.prepare( QString("UPDATE Studies SET %1 WHERE StudyInstanceUID = ? ;").arg(displayStudiesFieldUpdateString) ); - foreach (QString boundValue, boundValues) - { - updateDisplayStudyStatement.addBindValue(boundValue); - } + QSqlQuery updateDisplayStudyStatement(this->Database); + updateDisplayStudyStatement.prepare( QString("UPDATE Studies SET %1 WHERE StudyInstanceUID = ? ;").arg(displayStudiesFieldUpdateString) ); + foreach (QString boundValue, boundValues) + { + updateDisplayStudyStatement.addBindValue(boundValue); + } updateDisplayStudyStatement.addBindValue(currentStudy["StudyInstanceUID"]); this->loggedExec(updateDisplayStudyStatement); @@ -1109,7 +1109,7 @@ bool ctkDICOMDatabasePrivate::applyDisplayedFieldsChanges( QMap boundValues; + QList boundValues; foreach (QString tagName, currentSeries.keys()) { displaySeriesFieldUpdateString.append( tagName + " = ? , " ); @@ -1120,11 +1120,11 @@ bool ctkDICOMDatabasePrivate::applyDisplayedFieldsChanges( QMapDatabase); updateDisplaySeriesStatement.prepare( QString("UPDATE Series SET %1 WHERE SeriesInstanceUID = ? ;").arg(displaySeriesFieldUpdateString) ); - foreach (QString boundValue, boundValues) - { - updateDisplaySeriesStatement.addBindValue(boundValue); - } - updateDisplaySeriesStatement.addBindValue(currentSeries["SeriesInstanceUID"]); + foreach (QString boundValue, boundValues) + { + updateDisplaySeriesStatement.addBindValue(boundValue); + } + updateDisplaySeriesStatement.addBindValue(currentSeries["SeriesInstanceUID"]); this->loggedExec(updateDisplaySeriesStatement); QSqlQuery updateDisplayedFieldsUpdatedTimestampStatement(this->Database);