summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2010-09-23 08:10:53 -0700
committerIgor Babaev <igor@askmonty.org>2010-09-23 08:10:53 -0700
commitb969df8bbdc6acbaf1506b52346d24306e84a48c (patch)
treeb0b9eaa82a121c87f17487c57926bd9968d3ef20 /sql/field.cc
parentcfbd9270243e4b429cdc26e8554bcc99690f2422 (diff)
parent709a0a131021135e9fb7a2095fcfcbc223dfb126 (diff)
downloadmariadb-git-b969df8bbdc6acbaf1506b52346d24306e84a48c.tar.gz
Merge of the mwl106 tree into the latest 5.3 tree.
Resolved conflicts. Adjusted some test results
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 03d78706f95..f4e1ab20a87 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -10492,3 +10492,27 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code,
field_name);
}
}
+
+
+/*
+ @brief
+ Return possible keys for a field
+
+ @details
+ Return bit map of keys over this field which can be used by the range
+ optimizer. For a field of a generic table such keys are all keys that starts
+ from this field. For a field of a materialized derived table/view such keys
+ are all keys in which this field takes a part. This is less restrictive as
+ keys for a materialized derived table/view are generated on the fly from
+ present fields, thus the case when a field for the beginning of a key is
+ absent is impossible.
+
+ @return map of possible keys
+*/
+
+key_map Field::get_possible_keys()
+{
+ DBUG_ASSERT(table->pos_in_table_list);
+ return (table->pos_in_table_list->is_materialized_derived() ?
+ part_of_key : key_start);
+}