Added detection for USE <db> (= DATABASE()), which is a system function which changes session variable. Therefore it must be treted as SESION write and executed in both master and slave.

This commit is contained in:
VilhoRaatikka 2014-01-29 23:29:32 +02:00
parent a8c630f581
commit 89de86320e

View File

@ -568,7 +568,15 @@ static skygw_query_type_t resolve_query_type(
pthread_self())));
break;
case Item_func::UNKNOWN_FUNC:
func_qtype = QUERY_TYPE_READ;
if (strncmp(item->name, "DATABASE()", 10) == 0)
{
/** 'USE <db' */
func_qtype = QUERY_TYPE_SESSION_WRITE;
}
else
{
func_qtype = QUERY_TYPE_READ;
}
/**
* Many built-in functions are of this
* type, for example, rand(), soundex(),