mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MariaDB 5.2 -> MariaDB 5.3 merge
This commit is contained in:
@ -111,12 +111,12 @@ typedef struct st_table_ref
|
||||
/*
|
||||
TRUE <=> disable the "cache" as doing lookup with the same key value may
|
||||
produce different results (because of Index Condition Pushdown)
|
||||
|
||||
*/
|
||||
bool disable_cache;
|
||||
} TABLE_REF;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
The structs which holds the join connections and join states
|
||||
*/
|
||||
@ -1493,7 +1493,25 @@ public:
|
||||
*/
|
||||
bool no_const_tables;
|
||||
|
||||
JOIN *tmp_join; ///< copy of this JOIN to be used with temporary tables
|
||||
/**
|
||||
Copy of this JOIN to be used with temporary tables.
|
||||
|
||||
tmp_join is used when the JOIN needs to be "reusable" (e.g. in a subquery
|
||||
that gets re-executed several times) and we know will use temporary tables
|
||||
for materialization. The materialization to a temporary table overwrites the
|
||||
JOIN structure to point to the temporary table after the materialization is
|
||||
done. This is where tmp_join is used : it's a copy of the JOIN before the
|
||||
materialization and is used in restoring before re-execution by overwriting
|
||||
the current JOIN structure with the saved copy.
|
||||
Because of this we should pay extra care of not freeing up helper structures
|
||||
that are referenced by the original contents of the JOIN. We can check for
|
||||
this by making sure the "current" join is not the temporary copy, e.g.
|
||||
!tmp_join || tmp_join != join
|
||||
|
||||
We should free these sub-structures at JOIN::destroy() if the "current" join
|
||||
has a copy is not that copy.
|
||||
*/
|
||||
JOIN *tmp_join;
|
||||
ROLLUP rollup; ///< Used with rollup
|
||||
|
||||
bool select_distinct; ///< Set if SELECT DISTINCT
|
||||
@ -1870,10 +1888,11 @@ public:
|
||||
we need to check for errors executing it and react accordingly
|
||||
*/
|
||||
if (!res && table->in_use->is_error())
|
||||
res= 2;
|
||||
res= 1; /* STORE_KEY_FATAL */
|
||||
dbug_tmp_restore_column_map(table->write_set, old_map);
|
||||
null_key= to_field->is_null() || item->null_value;
|
||||
return (err != 0 || res > 2 ? STORE_KEY_FATAL : (store_key_result) res);
|
||||
return ((err != 0 || res < 0 || res > 2) ? STORE_KEY_FATAL :
|
||||
(store_key_result) res);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1902,17 +1921,17 @@ protected:
|
||||
if ((res= item->save_in_field(to_field, 1)))
|
||||
{
|
||||
if (!err)
|
||||
err= res;
|
||||
err= res < 0 ? 1 : res; /* 1=STORE_KEY_FATAL */
|
||||
}
|
||||
/*
|
||||
Item::save_in_field() may call Item::val_xxx(). And if this is a subquery
|
||||
we need to check for errors executing it and react accordingly
|
||||
*/
|
||||
if (!err && to_field->table->in_use->is_error())
|
||||
err= 2;
|
||||
err= 1; /* STORE_KEY_FATAL */
|
||||
}
|
||||
null_key= to_field->is_null() || item->null_value;
|
||||
return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err);
|
||||
return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err);
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user