MXS-1575: Fix CREATE TABLE processing
The CREATE TABLE processing failed to identify the explicit database names that were generated by mysqldump.
This commit is contained in:
@ -421,28 +421,33 @@ static bool get_database_name(const char* sql, char* dest)
|
|||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
ptr--;
|
ptr--;
|
||||||
while (*ptr == '`' || isspace(*ptr))
|
while (ptr >= sql && (*ptr == '`' || isspace(*ptr)))
|
||||||
{
|
{
|
||||||
ptr--;
|
ptr--;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*ptr != '`' && *ptr != '.' && !isspace(*ptr))
|
while (ptr >= sql && *ptr != '`' && *ptr != '.' && !isspace(*ptr))
|
||||||
{
|
{
|
||||||
ptr--;
|
ptr--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*ptr == '.')
|
while (ptr >= sql && (*ptr == '`' || isspace(*ptr)))
|
||||||
|
{
|
||||||
|
ptr--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ptr >= sql && *ptr == '.')
|
||||||
{
|
{
|
||||||
// The query defines an explicit database
|
// The query defines an explicit database
|
||||||
|
|
||||||
while (*ptr == '`' || *ptr == '.' || isspace(*ptr))
|
while (ptr >= sql && (*ptr == '`' || *ptr == '.' || isspace(*ptr)))
|
||||||
{
|
{
|
||||||
ptr--;
|
ptr--;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* end = ptr + 1;
|
const char* end = ptr + 1;
|
||||||
|
|
||||||
while (*ptr != '`' && *ptr != '.' && !isspace(*ptr))
|
while (ptr >= sql && *ptr != '`' && *ptr != '.' && !isspace(*ptr))
|
||||||
{
|
{
|
||||||
ptr--;
|
ptr--;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user