Commit 209190d3 authored by monty@mysql.com's avatar monty@mysql.com

Review fixed

parent b9054c5e
......@@ -586,16 +586,13 @@ uint ha_federated::convert_row_to_internal_format(byte *record, MYSQL_ROW row)
DBUG_RETURN(0);
}
bool ha_federated::create_where_from_key(
String *to,
KEY *key_info,
const byte *key,
uint key_length
)
bool ha_federated::create_where_from_key(String *to, KEY *key_info,
const byte *key, uint key_length)
{
uint second_loop= 0;
KEY_PART_INFO *key_part;
bool needs_quotes;
String tmp;
DBUG_ENTER("ha_federated::create_where_from_key");
for (key_part= key_info->key_part ; (int) key_length > 0 ; key_part++)
......@@ -656,7 +653,9 @@ bool ha_federated::create_where_from_key(
uint blob_length= uint2korr(key);
key+= HA_KEY_BLOB_LENGTH;
key_length-= HA_KEY_BLOB_LENGTH;
if (append_escaped(to, (char *)(key), blob_length))
tmp.set_quick((char*) key, blob_length, &my_charset_bin);
if (append_escaped(to, &tmp))
DBUG_RETURN(1);
DBUG_PRINT("ha_federated::create_where_from_key", ("blob type %s", to->c_ptr_quick()));
......@@ -666,7 +665,8 @@ bool ha_federated::create_where_from_key(
{
length= uint2korr(key);
key+= HA_KEY_BLOB_LENGTH;
if (append_escaped(to, (char *)(key), length))
tmp.set_quick((char*) key, length, &my_charset_bin);
if (append_escaped(to, &tmp))
DBUG_RETURN(1);
DBUG_PRINT("ha_federated::create_where_from_key", ("varchar type %s", to->c_ptr_quick()));
......@@ -680,7 +680,7 @@ bool ha_federated::create_where_from_key(
res= field->val_str(&str, (char *)(key));
if (field->result_type() == STRING_RESULT)
{
if (append_escaped(to, (char *) res->ptr(), res->length()))
if (append_escaped(to, res))
DBUG_RETURN(1);
res= field->val_str(&str, (char *)(key));
......@@ -1235,7 +1235,7 @@ int ha_federated::update_row(
update_string.append(new_field_value);
new_field_value.length(0);
if (x+1 < table->s->fields)
if ((uint) x+1 < table->s->fields)
{
update_string.append(", ");
if (! has_a_primary_key)
......@@ -1311,7 +1311,7 @@ int ha_federated::delete_row(const byte * buf)
delete_string.append(data_string);
data_string.length(0);
if (x+1 < table->s->fields)
if ((uint) x+1 < table->s->fields)
delete_string.append(" AND ");
}
......
......@@ -715,7 +715,6 @@ bool mysql_do(THD *thd, List<Item> &values);
/* sql_analyse.h */
bool append_escaped(String *to_str, String *from_str);
bool append_escaped(String *to_str, char *from, uint from_len);
/* sql_show.cc */
bool mysqld_show_open_tables(THD *thd,const char *wild);
......
......@@ -59,8 +59,6 @@ int compare_ulonglong2(void* cmp_arg __attribute__((unused)),
return compare_ulonglong(s,t);
}
bool append_escaped(String *to_str, String *from_str);
bool append_escaped(String *to_str, char *from, uint from_len);
Procedure *
proc_analyse_init(THD *thd, ORDER *param, select_result *result,
......@@ -1087,38 +1085,3 @@ bool append_escaped(String *to_str, String *from_str)
}
return 0;
}
bool append_escaped(String *to_str, char *from, uint from_len)
{
char *end, c;
if (to_str->realloc(to_str->length() + from_len))
return 1;
end= from + from_len;
for (; from < end; from++)
{
c= *from;
switch (c) {
case '\0':
c= '0';
break;
case '\032':
c= 'Z';
break;
case '\\':
case '\'':
break;
default:
goto normal_character;
}
if (to_str->append('\\'))
return 1;
normal_character:
if (to_str->append(c))
return 1;
}
return 0;
}
......@@ -1811,13 +1811,13 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
is the same table (Bug #6034). Do the preparation after the select phase
in select_insert::prepare2().
*/
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
}
restore_record(table,s->default_values); // Get empty record
table->next_number_field=table->found_next_number_field;
thd->cuted_fields=0;
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
thd->no_trans_update= 0;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
......@@ -1847,14 +1847,9 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
int select_insert::prepare2(void)
{
DBUG_ENTER("select_insert::prepare2");
if (thd->lex->current_select->options & OPTION_BUFFER_RESULT)
{
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
}
return 0;
DBUG_RETURN(0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment