comparison Framework/MySQL/MySQLParameters.cpp @ 23:b2ff1cd2907a

handling of implicit transactions in DatabaseManager
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Jul 2018 10:44:17 +0200
parents 1e9bad493475
children 6a574d810b98
comparison
equal deleted inserted replaced
22:1e9bad493475 23:b2ff1cd2907a
102 } 102 }
103 103
104 104
105 void MySQLParameters::SetDatabase(const std::string& database) 105 void MySQLParameters::SetDatabase(const std::string& database)
106 { 106 {
107 if (database.empty())
108 {
109 LOG(ERROR) << "Empty database name";
110 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
111 }
112
113 for (size_t i = 0; i < database.length(); i++)
114 {
115 if (!isalnum(database [i]))
116 {
117 LOG(ERROR) << "Only alphanumeric characters are allowed in a "
118 << "MySQL database name: \"" << database << "\"";
119 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
120 }
121 }
122
107 database_ = database; 123 database_ = database;
108 } 124 }
109 125
110 126
111 void MySQLParameters::SetPort(unsigned int port) 127 void MySQLParameters::SetPort(unsigned int port)