summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormiguel@hegel.local <>2004-05-05 10:55:39 -0300
committermiguel@hegel.local <>2004-05-05 10:55:39 -0300
commit4d8235b8490155876208fb9c8328d5900b7a42ca (patch)
tree9aba002fed8b72fceaa24f6057fccac7f85ad8ab /sql
parent634a024fa97d9b1c3c0a24be44cf5e7666e0e835 (diff)
parent949c01bfa221fab06856e44866a6061f985f6d1f (diff)
downloadmariadb-git-4d8235b8490155876208fb9c8328d5900b7a42ca.tar.gz
Merge miguel@bk-internal.mysql.com:/home/bk/mysql-4.1
into hegel.local:/home/miguel/bk/mysql-4.1
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc5
-rw-r--r--sql/item_sum.h1
-rw-r--r--sql/sql_acl.cc3
-rw-r--r--sql/sql_base.cc5
-rw-r--r--sql/sql_load.cc6
-rw-r--r--sql/sql_parse.cc1
-rw-r--r--sql/sql_prepare.cc7
-rw-r--r--sql/sql_select.cc20
-rw-r--r--sql/sql_table.cc2
-rw-r--r--sql/sql_update.cc4
10 files changed, 34 insertions, 20 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 44a05c42526..e1cdfcf42c0 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1259,15 +1259,16 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table)
void Item_field::make_field(Send_field *tmp_field)
{
field->make_field(tmp_field);
+ DBUG_ASSERT(tmp_field->table_name);
if (name)
tmp_field->col_name=name; // Use user supplied name
}
+
/*
-** Set a field:s value from a item
+ Set a field:s value from a item
*/
-
void Item_field::save_org_in_field(Field *to)
{
if (field->is_null())
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 9593c8ddbba..d7753303f55 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -351,6 +351,7 @@ class Item_sum_variance : public Item_sum_num
void update_field();
Item *result_item(Field *field)
{ return new Item_variance_field(this); }
+ void no_rows_in_result() {}
const char *func_name() const { return "variance"; }
Item *copy_or_same(THD* thd);
};
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 72a68af54c0..f8dca1133cc 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1560,7 +1560,8 @@ end:
{
acl_cache->clear(1); // Clear privilege cache
if (old_row_exists)
- acl_update_user(combo.user.str, combo.host.str, password, password_len,
+ acl_update_user(combo.user.str, combo.host.str,
+ combo.password.str, password_len,
thd->lex->ssl_type,
thd->lex->ssl_cipher,
thd->lex->x509_issuer,
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index d24b13ff96f..75c7a779180 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1029,14 +1029,15 @@ bool reopen_table(TABLE *table,bool locked)
*table=tmp;
table->file->change_table_ptr(table);
+ DBUG_ASSERT(table->table_name);
for (field=table->field ; *field ; field++)
{
- (*field)->table=table;
+ (*field)->table= (*field)->orig_table= table;
(*field)->table_name=table->table_name;
}
for (key=0 ; key < table->keys ; key++)
for (part=0 ; part < table->key_info[key].usable_key_parts ; part++)
- table->key_info[key].key_part[part].field->table=table;
+ table->key_info[key].key_part[part].field->table= table;
VOID(pthread_cond_broadcast(&COND_refresh));
error=0;
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 3d9299ca05c..f72fab9ea3a 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -529,8 +529,8 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
if (field->type() == FIELD_TYPE_TIMESTAMP)
((Field_timestamp*) field)->set_time();
else if (field != table->next_number_field)
- field->set_warning((uint)MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_WARN_NULL_TO_NOTNULL);
+ field->set_warning((uint) MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WARN_NULL_TO_NOTNULL);
}
continue;
}
@@ -1014,7 +1014,7 @@ bool READ_INFO::find_start_of_fields()
{ // Can't be line_start
PUSH(chr);
while (--ptr != line_start_ptr)
- { // Restart with next char
+ { // Restart with next char
PUSH((uchar) *ptr);
}
goto try_again;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 440e5933f7d..e0bb03a7002 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1424,6 +1424,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
case COM_EXECUTE:
{
+ thd->free_list= NULL;
mysql_stmt_execute(thd, packet, packet_length);
break;
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index d8550768e3a..951f92011ca 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1498,9 +1498,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
thd->stmt_backup.set_statement(thd);
thd->set_statement(stmt);
-
reset_stmt_for_execute(stmt);
-
#ifndef EMBEDDED_LIBRARY
if (stmt->param_count)
{
@@ -1540,6 +1538,11 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
reset_stmt_params(stmt);
close_thread_tables(thd); // to close derived tables
thd->set_statement(&thd->stmt_backup);
+ /*
+ Free Items that were created during this execution of the PS by query
+ optimizer.
+ */
+ free_items(thd->free_list);
DBUG_VOID_RETURN;
set_params_data_err:
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index f850c2ac270..ffc52817322 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3634,6 +3634,12 @@ make_join_readinfo(JOIN *join, uint options)
table->status=STATUS_NO_RECORD;
tab->read_first_record= join_read_const;
tab->read_record.read_record= join_no_more_records;
+ if (table->used_keys.is_set(tab->index) &&
+ !table->no_keyread)
+ {
+ table->key_read=1;
+ table->file->extra(HA_EXTRA_KEYREAD);
+ }
break;
case JT_EQ_REF:
table->status=STATUS_NO_RECORD;
@@ -4120,11 +4126,6 @@ return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables,
DBUG_RETURN(0);
}
- if (procedure)
- {
- if (result->prepare(fields, unit)) // This hasn't been done yet
- DBUG_RETURN(-1);
- }
if (send_row)
{
for (TABLE_LIST *table=tables; table ; table=table->next)
@@ -5962,6 +5963,12 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
}
else
{
+ if (!table->key_read && table->used_keys.is_set(tab->index) &&
+ !table->no_keyread)
+ {
+ table->key_read=1;
+ table->file->extra(HA_EXTRA_KEYREAD);
+ }
if ((error=join_read_const(tab)))
{
tab->info="unique row not found";
@@ -9227,7 +9234,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
join->best_positions[i]. records_read,
21));
my_bool key_read=table->key_read;
- if (tab->type == JT_NEXT && table->used_keys.is_set(tab->index))
+ if ((tab->type == JT_NEXT || tab->type == JT_CONST) &&
+ table->used_keys.is_set(tab->index))
key_read=1;
if (tab->info)
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index c46a9823a52..0d0be1b7e10 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1759,7 +1759,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
char buf[ERRMSGSIZE+20];
uint length=my_snprintf(buf, ERRMSGSIZE,
ER(ER_CHECK_NOT_IMPLEMENTED), operator_name);
- protocol->store("error", 5, system_charset_info);
+ protocol->store("note", 4, system_charset_info);
protocol->store(buf, length, system_charset_info);
}
break;
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index d985d2c2e78..3ae4ecad1e6 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -461,9 +461,7 @@ int mysql_multi_update(THD *thd,
int res;
multi_update *result;
TABLE_LIST *tl;
- TABLE_LIST *update_list=
- (TABLE_LIST*)thd->lex->select_lex.table_list.first;
-
+ TABLE_LIST *update_list= (TABLE_LIST*) thd->lex->select_lex.table_list.first;
table_map item_tables= 0, derived_tables= 0;
DBUG_ENTER("mysql_multi_update");