Mercurial > hg > orthanc-databases
comparison Framework/MySQL/MySQLParameters.cpp @ 61:89a114f36c42
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Nov 2018 17:26:18 +0100 |
parents | 6a574d810b98 |
children | 714c5d2bee76 |
comparison
equal
deleted
inserted
replaced
60:412e30336847 | 61:89a114f36c42 |
---|---|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | 19 **/ |
20 | 20 |
21 | 21 |
22 #include "MySQLParameters.h" | 22 #include "MySQLParameters.h" |
23 | |
24 #include "MySQLDatabase.h" | |
23 | 25 |
24 #include <Core/Logging.h> | 26 #include <Core/Logging.h> |
25 #include <Core/OrthancException.h> | 27 #include <Core/OrthancException.h> |
26 | 28 |
27 namespace OrthancDatabases | 29 namespace OrthancDatabases |
114 { | 116 { |
115 LOG(ERROR) << "MySQL: Empty database name"; | 117 LOG(ERROR) << "MySQL: Empty database name"; |
116 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 118 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
117 } | 119 } |
118 | 120 |
119 for (size_t i = 0; i < database.length(); i++) | 121 if (!MySQLDatabase::IsValidDatabaseIdentifier(database)) |
120 { | 122 { |
121 if (!isalnum(database [i])) | 123 LOG(ERROR) << "MySQL: Only alphanumeric characters are allowed in a " |
122 { | 124 << "database name: \"" << database << "\""; |
123 LOG(ERROR) << "MySQL: Only alphanumeric characters are allowed in a " | 125 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
124 << "database name: \"" << database << "\""; | |
125 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
126 } | |
127 } | 126 } |
128 | 127 |
129 database_ = database; | 128 database_ = database; |
130 } | 129 } |
131 | 130 |