MySQL Plugin: Only alphanumeric characters are allowed in a database name

Hi all,

I am bound to have my MySQL DB names prefixed with something like “prefix_” which I cannot change for other reasons.

Now when trying to use such a database as an Orthanc (v1.4.2) backend and the respective Plugin (v1.1) I am getting the following error:

E1115 16:02:59.116246 PluginsManager.cpp:164] MySQL: Only alphanumeric characters are allowed in a database name: “user_orthanc”

Is “MySQLDatabase::IsAlphanumericString()” a bit too restrictive?

Thank you, Felix

I would say yes per the MySQL reference https://dev.mysql.com/doc/refman/8.0/en/identifiers.html

Indeed: This is fixed by the following patch in the mainline code:
https://bitbucket.org/sjodogne/orthanc-databases/commits/412e303368472426e319baaa5cabb8bf639166b6

Regards,
Sébastien-

i think you missed another check

void MySQLParameters::SetDatabase(const std::string& database)
{
if (database.empty())
{
LOG(ERROR) << “MySQL: Empty database name”;
throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
}

for (size_t i = 0; i < database.length(); i++)
{
if (!isalnum(database [i]))
{
LOG(ERROR) << "MySQL: Only alphanumeric characters are allowed in a "
<< “database name: "” << database << “"”;
throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
}
}

database_ = database;
}

Thanks for the heads-up, this is now fixed in the mainline:
https://bitbucket.org/sjodogne/orthanc-databases/commits/89a114f36c42aa2a9636e5107b0775ca36ec321e