Mercurial > hg > orthanc-databases
diff Framework/Common/GenericFormatter.cpp @ 302:3a52e27a2d80
in GenericFormatter, replaced ${} by ${AUTOINCREMENT}
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 09 Jul 2021 16:25:08 +0200 |
parents | 70685295a373 |
children | 495b6f325e35 |
line wrap: on
line diff
--- a/Framework/Common/GenericFormatter.cpp Thu Jul 08 18:28:47 2021 +0200 +++ b/Framework/Common/GenericFormatter.cpp Fri Jul 09 16:25:08 2021 +0200 @@ -33,16 +33,29 @@ { if (source.empty()) { - // This is the default parameter for INSERT + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); + } + else if (source == "AUTOINCREMENT") + { + if (GetParametersCount() != 0) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls, + "The AUTOINCREMENT argument must always be the first"); + } + switch (dialect_) { case Dialect_PostgreSQL: - target = "DEFAULT"; + target = "DEFAULT, "; break; case Dialect_MySQL: case Dialect_SQLite: - target = "NULL"; + target = "NULL, "; + break; + + case Dialect_MSSQL: + target.clear(); // The IDENTITY field must not be filled in MSSQL break; default: @@ -51,14 +64,6 @@ } else { - if (allNames_.find(source) != allNames_.end()) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls, - "Parameter ${" + source + "} registered twice"); - } - - allNames_.insert(source); - switch (dialect_) { case Dialect_PostgreSQL: