MXS-1249: Prepare for storing version in server structure

The behaviour of the query classifier needs to be different
depending on the actual version of the server. There is already
a human readable string, but for programmatic use it needs to
be in a format that can easily be parsed.
This commit is contained in:
Johan Wikman
2017-06-16 13:22:33 +03:00
parent 4a298b4024
commit 0d784da0ee
2 changed files with 38 additions and 0 deletions

View File

@ -1106,6 +1106,32 @@ void server_set_version_string(SERVER* server, const char* version)
// be shorter than the old.
}
/**
* Set the version of the server.
*
* @param server Server to update
* @param string Human readable version string.
* @param major The major version.
* @param minor The minor version.
* @param patch The patch version.
*
* @return True if the assignment of the version string was successful, false if
* memory allocation failed.
*/
bool server_set_version(SERVER* server, const char* string, uint32_t major, uint32_t minor, uint32_t patch)
{
bool rv = server_set_version_string(server, string);
if (rv)
{
server->version.major = major;
server->version.minor = minor;
server->version.patch = patch;
}
return rv;
}
/**
* Creates a server configuration at the location pointed by @c filename
*