MXS-1249: Qc, the server version is passed as a single integer
To be compatible with how the version is managed elsewhere.
This commit is contained in:
parent
997416ab82
commit
dcfe118457
@ -379,21 +379,19 @@ typedef struct query_classifier
|
||||
* is classified. Note that the server version is maintained separately
|
||||
* for each thread.
|
||||
*
|
||||
* @param major The major version.
|
||||
* @param minor The minor version.
|
||||
* @param patch The patch version.
|
||||
* @param version Version encoded as MariaDB encodes the version, i.e.:
|
||||
* version = major * 10000 + minor * 100 + patch
|
||||
*/
|
||||
void (*qc_set_server_version)(uint32_t major, uint32_t minor, uint32_t patch);
|
||||
void (*qc_set_server_version)(uint64_t version);
|
||||
|
||||
/**
|
||||
* Get the thread specific version assumed of the server. If the version has
|
||||
* not been set, all values are 0.
|
||||
*
|
||||
* @param major The major version.
|
||||
* @param minor The minor version.
|
||||
* @param patch The patch version.
|
||||
* @param version The version encoded as MariaDB encodes the version, i.e.:
|
||||
* version = major * 10000 + minor * 100 + patch
|
||||
*/
|
||||
void (*qc_get_server_version)(uint32_t* major, uint32_t* minor, uint32_t* patch);
|
||||
void (*qc_get_server_version)(uint64_t* version);
|
||||
} QUERY_CLASSIFIER;
|
||||
|
||||
/**
|
||||
@ -784,20 +782,18 @@ char* qc_typemask_to_string(uint32_t typemask);
|
||||
* is classified. Note that the server version is maintained separately
|
||||
* for each thread.
|
||||
*
|
||||
* @param major The major version.
|
||||
* @param minor The minor version.
|
||||
* @param patch The patch version.
|
||||
* @param version Version encoded as MariaDB encodes the version, i.e.:
|
||||
* version = major * 10000 + minor * 100 + patch
|
||||
*/
|
||||
void qc_set_server_version(uint32_t major, uint32_t minor, uint32_t patch);
|
||||
void qc_set_server_version(uint64_t version);
|
||||
|
||||
/**
|
||||
* Get the thread specific version assumed of the server. If the version has
|
||||
* not been set, all values are 0.
|
||||
*
|
||||
* @param major The major version.
|
||||
* @param minor The minor version.
|
||||
* @param patch The patch version.
|
||||
* @return The version as MariaDB encodes the version, i.e:
|
||||
* version = major * 10000 + minor * 100 + patch
|
||||
*/
|
||||
void qc_get_server_version(uint32_t* major, uint32_t* minor, uint32_t* patch);
|
||||
uint64_t qc_get_server_version();
|
||||
|
||||
MXS_END_DECLS
|
||||
|
@ -99,9 +99,7 @@ static thread_local struct
|
||||
// The version information is not used; the embedded library parses according
|
||||
// to the version of the embedded library it has been linked with. However, we
|
||||
// need to store the information so that qc_[get|set]_server_version will work.
|
||||
uint32_t version_major;
|
||||
uint32_t version_minor;
|
||||
uint32_t version_patch;
|
||||
uint64_t version;
|
||||
} this_thread;
|
||||
|
||||
#define QTYPE_LESS_RESTRICTIVE_THAN_WRITE(t) (t<QUERY_TYPE_WRITE ? true : false)
|
||||
@ -2600,18 +2598,14 @@ int32_t qc_mysql_get_function_info(GWBUF* buf,
|
||||
return QC_RESULT_OK;
|
||||
}
|
||||
|
||||
void qc_mysql_set_server_version(uint32_t major, uint32_t minor, uint32_t patch)
|
||||
void qc_mysql_set_server_version(uint64_t version)
|
||||
{
|
||||
this_thread.version_major = major;
|
||||
this_thread.version_minor = minor;
|
||||
this_thread.version_patch = patch;
|
||||
this_thread.version = version;
|
||||
}
|
||||
|
||||
void qc_mysql_get_server_version(uint32_t* major, uint32_t* minor, uint32_t* patch)
|
||||
void qc_mysql_get_server_version(uint64_t* version)
|
||||
{
|
||||
*major = this_thread.version_major;
|
||||
*minor = this_thread.version_minor;
|
||||
*patch = this_thread.version_patch;
|
||||
*version = this_thread.version;
|
||||
}
|
||||
|
||||
namespace
|
||||
|
@ -2910,8 +2910,8 @@ static int32_t qc_sqlite_get_canonical(GWBUF* query, char** canonical);
|
||||
static int32_t qc_sqlite_query_has_clause(GWBUF* query, int32_t* has_clause);
|
||||
static int32_t qc_sqlite_get_database_names(GWBUF* query, char*** names, int* sizep);
|
||||
static int32_t qc_sqlite_get_preparable_stmt(GWBUF* stmt, GWBUF** preparable_stmt);
|
||||
static void qc_sqlite_set_server_version(uint32_t major, uint32_t minor, uint32_t patch);
|
||||
static void qc_sqlite_get_server_version(uint32_t* major, uint32_t* minor, uint32_t* patch);
|
||||
static void qc_sqlite_set_server_version(uint64_t version);
|
||||
static void qc_sqlite_get_server_version(uint64_t* version);
|
||||
|
||||
static bool get_key_and_value(char* arg, const char** pkey, const char** pvalue)
|
||||
{
|
||||
@ -3530,22 +3530,24 @@ int32_t qc_sqlite_get_preparable_stmt(GWBUF* stmt, GWBUF** preparable_stmt)
|
||||
return rv;
|
||||
}
|
||||
|
||||
static void qc_sqlite_set_server_version(uint32_t major, uint32_t minor, uint32_t patch)
|
||||
static void qc_sqlite_set_server_version(uint64_t version)
|
||||
{
|
||||
QC_TRACE();
|
||||
|
||||
uint32_t major = version / 10000;
|
||||
uint32_t minor = (version - major * 10000) / 100;
|
||||
uint32_t patch = version - major * 10000 - minor * 100;
|
||||
|
||||
this_thread.version_major = major;
|
||||
this_thread.version_minor = minor;
|
||||
this_thread.version_patch = patch;
|
||||
}
|
||||
|
||||
static void qc_sqlite_get_server_version(uint32_t* major, uint32_t* minor, uint32_t* patch)
|
||||
static void qc_sqlite_get_server_version(uint64_t* version)
|
||||
{
|
||||
QC_TRACE();
|
||||
|
||||
*major = this_thread.version_major;
|
||||
*minor = this_thread.version_minor;
|
||||
*patch = this_thread.version_patch;
|
||||
*version = this_thread.version_major * 10000 + this_thread.version_minor * 100 + this_thread.version_patch;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -902,18 +902,22 @@ uint32_t qc_get_trx_type_mask(GWBUF* stmt)
|
||||
return qc_get_trx_type_mask_using(stmt, qc_trx_parse_using);
|
||||
}
|
||||
|
||||
void qc_set_server_version(uint32_t major, uint32_t minor, uint32_t patch)
|
||||
void qc_set_server_version(uint64_t version)
|
||||
{
|
||||
QC_TRACE();
|
||||
ss_dassert(classifier);
|
||||
|
||||
classifier->qc_set_server_version(major, minor, patch);
|
||||
classifier->qc_set_server_version(version);
|
||||
}
|
||||
|
||||
void qc_get_server_version(uint32_t* major, uint32_t* minor, uint32_t* patch)
|
||||
uint64_t qc_get_server_version()
|
||||
{
|
||||
QC_TRACE();
|
||||
ss_dassert(classifier);
|
||||
|
||||
classifier->qc_get_server_version(major, minor, patch);
|
||||
uint64_t version;
|
||||
|
||||
classifier->qc_get_server_version(&version);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user