1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge from 5.3

This commit is contained in:
unknown
2012-08-24 15:29:01 +02:00
45 changed files with 1217 additions and 467 deletions

View File

@ -992,9 +992,13 @@ static const char *require_quotes(const char *name, uint name_length)
packet target string
name the identifier to be appended
name_length length of the appending identifier
RETURN VALUES
true Error
false Ok
*/
void
bool
append_identifier(THD *thd, String *packet, const char *name, uint length)
{
const char *name_end;
@ -1002,10 +1006,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
int q= get_quote_char_for_identifier(thd, name, length);
if (q == EOF)
{
packet->append(name, length, packet->charset());
return;
}
return packet->append(name, length, packet->charset());
/*
The identifier must be quoted as it includes a quote character or
@ -1014,7 +1015,8 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
(void) packet->reserve(length*2 + 2);
quote_char= (char) q;
packet->append(&quote_char, 1, system_charset_info);
if (packet->append(&quote_char, 1, system_charset_info))
return true;
for (name_end= name+length ; name < name_end ; name+= length)
{
@ -1029,11 +1031,13 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
*/
if (!length)
length= 1;
if (length == 1 && chr == (uchar) quote_char)
packet->append(&quote_char, 1, system_charset_info);
packet->append(name, length, system_charset_info);
if (length == 1 && chr == (uchar) quote_char &&
packet->append(&quote_char, 1, system_charset_info))
return true;
if (packet->append(name, length, system_charset_info))
return true;
}
packet->append(&quote_char, 1, system_charset_info);
return packet->append(&quote_char, 1, system_charset_info);
}