summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authormonty@mishka.local <>2005-07-31 12:56:02 +0300
committermonty@mishka.local <>2005-07-31 12:56:02 +0300
commite73d6c25fdff7368831907f1fbea98e26e333040 (patch)
tree094caf1e8037736fbc61edda0c5c2405ec59ccd6 /sql/sql_select.cc
parentfddd143b3acbca334200b59d0d0aef792677eca5 (diff)
parent8437e9c1be5b925a46640302a391af9c9cf83a30 (diff)
downloadmariadb-git-e73d6c25fdff7368831907f1fbea98e26e333040.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mishka.local:/home/my/mysql-5.0
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc45
1 files changed, 21 insertions, 24 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 8aced3c1da6..000fa0790b7 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1762,7 +1762,7 @@ Cursor::init_from_thd(THD *thd)
for (handlerton **pht= thd->transaction.stmt.ht; *pht; pht++)
{
const handlerton *ht= *pht;
- close_at_commit|= (ht->flags & HTON_CLOSE_CURSORS_AT_COMMIT);
+ close_at_commit|= test(ht->flags & HTON_CLOSE_CURSORS_AT_COMMIT);
if (ht->create_cursor_read_view)
{
info->ht= ht;
@@ -8033,11 +8033,13 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
bool table_cant_handle_bit_fields,
uint convert_blob_length)
{
- Item *org_item= item;
- if (item->real_item()->type() == Item::FIELD_ITEM)
+ if (type != Item::FIELD_ITEM &&
+ item->real_item()->type() == Item::FIELD_ITEM &&
+ (item->type() != Item::REF_ITEM ||
+ !((Item_ref *) item)->depended_from))
{
item= item->real_item();
- type= item->type();
+ type= Item::FIELD_ITEM;
}
switch (type) {
case Item::SUM_FUNC_ITEM:
@@ -8051,23 +8053,18 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case Item::FIELD_ITEM:
case Item::DEFAULT_VALUE_ITEM:
{
- if (org_item->type() != Item::REF_ITEM ||
- !((Item_ref *)org_item)->depended_from)
- {
- Item_field *field= (Item_field*) item;
- if (table_cant_handle_bit_fields &&
- field->field->type() == FIELD_TYPE_BIT)
- return create_tmp_field_from_item(thd, item, table, copy_func,
- modify_item, convert_blob_length);
- return create_tmp_field_from_field(thd, (*from_field= field->field),
- item->name, table,
- modify_item ? (Item_field*) item :
- NULL,
- convert_blob_length);
- }
- else
- item= org_item;
- }
+ Item_field *field= (Item_field*) item;
+ if (table_cant_handle_bit_fields &&
+ field->field->type() == FIELD_TYPE_BIT)
+ return create_tmp_field_from_item(thd, item, table, copy_func,
+ modify_item, convert_blob_length);
+ return create_tmp_field_from_field(thd, (*from_field= field->field),
+ item->name, table,
+ modify_item ? (Item_field*) item :
+ NULL,
+ convert_blob_length);
+ }
+ /* Fall through */
case Item::FUNC_ITEM:
case Item::COND_ITEM:
case Item::FIELD_AVG_ITEM:
@@ -10910,13 +10907,13 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
usable_keys.set_all();
for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next)
{
- if ((*tmp_order->item)->real_item()->type() != Item::FIELD_ITEM)
+ Item *item= (*tmp_order->item)->real_item();
+ if (item->type() != Item::FIELD_ITEM)
{
usable_keys.clear_all();
DBUG_RETURN(0);
}
- usable_keys.intersect(((Item_field*) (*tmp_order->item)->real_item())->
- field->part_of_sortkey);
+ usable_keys.intersect(((Item_field*) item)->field->part_of_sortkey);
if (usable_keys.is_clear_all())
DBUG_RETURN(0); // No usable keys
}