Mercurial > hg > orthanc-databases
changeset 303:495b6f325e35
GenericFormatter::SetNamedDialect()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 09 Jul 2021 16:46:50 +0200 |
parents | 3a52e27a2d80 |
children | dd4b0edd1661 |
files | Framework/Common/GenericFormatter.cpp Framework/Common/GenericFormatter.h |
diffstat | 2 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Common/GenericFormatter.cpp Fri Jul 09 16:25:08 2021 +0200 +++ b/Framework/Common/GenericFormatter.cpp Fri Jul 09 16:46:50 2021 +0200 @@ -43,7 +43,7 @@ "The AUTOINCREMENT argument must always be the first"); } - switch (dialect_) + switch (autoincrementDialect_) { case Dialect_PostgreSQL: target = "DEFAULT, "; @@ -64,7 +64,7 @@ } else { - switch (dialect_) + switch (namedDialect_) { case Dialect_PostgreSQL: target = "$" + boost::lexical_cast<std::string>(parametersName_.size() + 1);
--- a/Framework/Common/GenericFormatter.h Fri Jul 09 16:25:08 2021 +0200 +++ b/Framework/Common/GenericFormatter.h Fri Jul 09 16:46:50 2021 +0200 @@ -32,14 +32,26 @@ class GenericFormatter : public Query::IParameterFormatter { private: - Dialect dialect_; + Dialect autoincrementDialect_; + Dialect namedDialect_; std::vector<std::string> parametersName_; std::vector<ValueType> parametersType_; public: explicit GenericFormatter(Dialect dialect) : - dialect_(dialect) + autoincrementDialect_(dialect), + namedDialect_(dialect) + { + } + + void SetAutoincrementDialect(Dialect dialect) { + autoincrementDialect_ = dialect; + } + + void SetNamedDialect(Dialect dialect) + { + namedDialect_ = dialect; } virtual void Format(std::string& target,