qc_mysqlembedded: Return the actual name and not as-name
item->name contains the "final" name that due to the use of AS can be different than the actual name. Via item->full_name() we can get hold of the actual name.
This commit is contained in:
@ -1283,7 +1283,7 @@ bool qc_is_drop_table_query(GWBUF* querybuf)
|
|||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void add_str(char** buf, int* buflen, int* bufsize, char* str)
|
inline void add_str(char** buf, int* buflen, int* bufsize, const char* str)
|
||||||
{
|
{
|
||||||
int isize = strlen(str) + 1;
|
int isize = strlen(str) + 1;
|
||||||
|
|
||||||
@ -1338,9 +1338,22 @@ static void collect_affected_fields(Item* item, char** bufp, int* buflenp, int*
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Item::FIELD_ITEM:
|
case Item::FIELD_ITEM:
|
||||||
if (item->name)
|
|
||||||
{
|
{
|
||||||
add_str(bufp, buflenp, bufsizep, item->name);
|
const char* full_name = item->full_name();
|
||||||
|
const char* name = strchr(full_name, '.');
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
// No dot found.
|
||||||
|
name = full_name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Dot found, advance beyond it.
|
||||||
|
++name;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_str(bufp, buflenp, bufsizep, name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user