summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-07-08 15:45:25 +0300
committerunknown <monty@mysql.com>2004-07-08 15:45:25 +0300
commita23fbc060ebd0aca9b34e793ec25533cbdb7d4f9 (patch)
tree15b952a3b20bb1c0c60974e9f451385a4fa45208 /sql
parent5ef15478cdbaa65c7d037ce5662117b8ed425dba (diff)
downloadmariadb-git-a23fbc060ebd0aca9b34e793ec25533cbdb7d4f9.tar.gz
New handler::index_flags() definition to make it easy to check the full used key and a specific key part.
Added key part to optimize_range() to fix problems when using fields in key parts. sql/examples/ha_archive.h: New handler::index_flags() definition sql/examples/ha_example.h: New handler::index_flags() definition sql/field.cc: New optimize_range() definition sql/field.h: New optimize_range() definition sql/ha_berkeley.cc: New handler::index_flags() definition sql/ha_berkeley.h: New handler::index_flags() definition sql/ha_heap.h: New handler::index_flags() definition sql/ha_innodb.h: New handler::index_flags() definition sql/ha_isam.h: New handler::index_flags() definition sql/ha_isammrg.h: New handler::index_flags() definition sql/ha_myisam.h: New handler::index_flags() definition sql/ha_myisammrg.h: New handler::index_flags() definition sql/ha_ndbcluster.cc: New handler::index_flags() definition sql/ha_ndbcluster.h: New handler::index_flags() definition sql/handler.h: New handler::index_flags() definition sql/log.cc: Fixed compiler warnings sql/log_event.cc: Fixed compiler warnings (and renamed short variable name) sql/opt_range.cc: New handler::index_flags() definition sql/opt_sum.cc: New handler::index_flags() definition sql/set_var.cc: Removed compiler warnings sql/sql_db.cc: Removed compiler warnings sql/sql_select.cc: New handler::index_flags() definition sql/sql_show.cc: Removed compiler warnings sql/sql_update.cc: Removed compiler warnings sql/table.cc: New handler::index_flags() definition
Diffstat (limited to 'sql')
-rw-r--r--sql/examples/ha_archive.h2
-rw-r--r--sql/examples/ha_example.h8
-rw-r--r--sql/field.cc4
-rw-r--r--sql/field.h4
-rw-r--r--sql/ha_berkeley.cc17
-rw-r--r--sql/ha_berkeley.h8
-rw-r--r--sql/ha_heap.h2
-rw-r--r--sql/ha_innodb.h2
-rw-r--r--sql/ha_isam.h2
-rw-r--r--sql/ha_isammrg.h3
-rw-r--r--sql/ha_myisam.h6
-rw-r--r--sql/ha_myisammrg.h6
-rw-r--r--sql/ha_ndbcluster.cc3
-rw-r--r--sql/ha_ndbcluster.h2
-rw-r--r--sql/handler.h2
-rw-r--r--sql/log.cc7
-rw-r--r--sql/log_event.cc13
-rw-r--r--sql/opt_range.cc9
-rw-r--r--sql/opt_sum.cc2
-rw-r--r--sql/set_var.cc8
-rw-r--r--sql/sql_db.cc5
-rw-r--r--sql/sql_select.cc10
-rw-r--r--sql/sql_show.cc5
-rw-r--r--sql/sql_update.cc5
-rw-r--r--sql/table.cc4
25 files changed, 83 insertions, 56 deletions
diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h
index 03e296d0eae..2fab80f0598 100644
--- a/sql/examples/ha_archive.h
+++ b/sql/examples/ha_archive.h
@@ -72,7 +72,7 @@ public:
return (HA_REC_NOT_IN_SEQ | HA_NOT_EXACT_COUNT | HA_NO_AUTO_INCREMENT |
HA_FILE_BASED);
}
- ulong index_flags(uint idx, uint part) const
+ ulong index_flags(uint idx, uint part, bool all_parts) const
{
return 0;
}
diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h
index dc8f265c16e..3c6ce4220ee 100644
--- a/sql/examples/ha_example.h
+++ b/sql/examples/ha_example.h
@@ -69,12 +69,16 @@ public:
return 0;
}
/*
- This is a list of flags that says how the storage engine
+ This is a bitmap of flags that says how the storage engine
implements indexes. The current index flags are documented in
handler.h. If you do not implement indexes, just return zero
here.
+
+ part is the key part to check. First key part is 0
+ If all_parts it's set, MySQL want to know the flags for the combined
+ index up to and including 'part'.
*/
- ulong index_flags(uint inx, uint part) const
+ ulong index_flags(uint inx, uint part, bool all_parts) const
{
return 0;
}
diff --git a/sql/field.cc b/sql/field.cc
index 2d3729817b7..26c84575b4d 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -431,9 +431,9 @@ void Field::store_time(TIME *ltime,timestamp_type type)
}
-bool Field::optimize_range(uint idx)
+bool Field::optimize_range(uint idx, uint part)
{
- return test(table->file->index_flags(idx) & HA_READ_RANGE);
+ return test(table->file->index_flags(idx, part, 1) & HA_READ_RANGE);
}
/****************************************************************************
diff --git a/sql/field.h b/sql/field.h
index a2fe77e18a3..24faee9d314 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -178,7 +178,7 @@ public:
inline bool real_maybe_null(void) { return null_ptr != 0; }
virtual void make_field(Send_field *)=0;
virtual void sort_string(char *buff,uint length)=0;
- virtual bool optimize_range(uint idx);
+ virtual bool optimize_range(uint idx, uint part);
virtual bool store_for_compare() { return 0; }
virtual void free() {}
Field *new_field(MEM_ROOT *root, struct st_table *new_table)
@@ -1134,7 +1134,7 @@ public:
uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return FIELD_TYPE_ENUM; }
virtual bool zero_pack() const { return 0; }
- bool optimize_range(uint idx) { return 0; }
+ bool optimize_range(uint idx, uint part) { return 0; }
bool eq_def(Field *field);
bool has_charset(void) const { return TRUE; }
field_cast_enum field_cast_type() { return FIELD_CAST_ENUM; }
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 4bed33af15b..bb07bd9dc4b 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -340,6 +340,23 @@ const char **ha_berkeley::bas_ext() const
{ static const char *ext[]= { ha_berkeley_ext, NullS }; return ext; }
+ulong ha_berkeley::index_flags(uint idx, uint part, bool all_parts) const
+{
+ ulong flags= (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_KEYREAD_ONLY
+ | HA_READ_RANGE);
+ for (uint idx= all_parts ? 0 : part ; idx <= part ; idx++)
+ {
+ if (table->key_info[idx].key_part[part].field->type() == FIELD_TYPE_BLOB)
+ {
+ /* We can't use BLOBS to shortcut sorts */
+ flags&= ~ (HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE);
+ break;
+ }
+ }
+ return flags;
+}
+
+
static int
berkeley_cmp_hidden_key(DB* file, const DBT *new_key, const DBT *saved_key)
{
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index efc85d3928e..5cba3bebf10 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -94,13 +94,7 @@ class ha_berkeley: public handler
changed_rows(0),last_dup_key((uint) -1),version(0),using_ignore(0) {}
~ha_berkeley() {}
const char *table_type() const { return "BerkeleyDB"; }
- ulong index_flags(uint idx, uint part) const
- {
- ulong flags=HA_READ_NEXT | HA_READ_PREV;
- if (table->key_info[idx].key_part[part].field->key_type() != HA_KEYTYPE_TEXT)
- flags|= HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE;
- return flags;
- }
+ ulong index_flags(uint idx, uint part, bool all_parts) const;
const char *index_type(uint key_number) { return "BTREE"; }
const char **bas_ext() const;
ulong table_flags(void) const { return int_table_flags; }
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index f05146acdc4..9ca6b9b76b6 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -44,7 +44,7 @@ class ha_heap: public handler
HA_REC_NOT_IN_SEQ | HA_READ_RND_SAME |
HA_CAN_INSERT_DELAYED);
}
- ulong index_flags(uint inx, uint part) const
+ ulong index_flags(uint inx, uint part, bool all_parts) const
{
return ((table->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ?
HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE :
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 7e05488289e..e09697f7ce6 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -94,7 +94,7 @@ class ha_innobase: public handler
const char *index_type(uint key_number) { return "BTREE"; }
const char** bas_ext() const;
ulong table_flags() const { return int_table_flags; }
- ulong index_flags(uint idx, uint part) const
+ ulong index_flags(uint idx, uint part, bool all_parts) const
{
return (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE |
HA_KEYREAD_ONLY);
diff --git a/sql/ha_isam.h b/sql/ha_isam.h
index 521946a17b5..b3e932696cb 100644
--- a/sql/ha_isam.h
+++ b/sql/ha_isam.h
@@ -36,7 +36,7 @@ class ha_isam: public handler
HA_DUPP_POS | HA_NOT_DELETE_WITH_CACHE | HA_FILE_BASED)
{}
~ha_isam() {}
- ulong index_flags(uint idx, uint part) const
+ ulong index_flags(uint idx, uint part, bool all_parts) const
{ return HA_READ_NEXT; } // but no HA_READ_PREV here!!!
const char *table_type() const { return "ISAM"; }
const char *index_type(uint key_number) { return "BTREE"; }
diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h
index 166a96cf9e4..657e5060272 100644
--- a/sql/ha_isammrg.h
+++ b/sql/ha_isammrg.h
@@ -34,7 +34,8 @@ class ha_isammrg: public handler
const char **bas_ext() const;
ulong table_flags() const { return (HA_READ_RND_SAME |
HA_REC_NOT_IN_SEQ | HA_FILE_BASED); }
- ulong index_flags(uint idx, uint part) const { DBUG_ASSERT(0); return 0; }
+ ulong index_flags(uint idx, uint part, bool all_parts) const
+ { DBUG_ASSERT(0); return 0; }
uint max_supported_keys() const { return 0; }
bool low_byte_first() const { return 0; }
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index ef3f00577dd..6fde84d6f6f 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -55,11 +55,11 @@ class ha_myisam: public handler
const char *index_type(uint key_number);
const char **bas_ext() const;
ulong table_flags() const { return int_table_flags; }
- ulong index_flags(uint inx, uint part) const
+ ulong index_flags(uint inx, uint part, bool all_parts) const
{
return ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
- 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
- HA_READ_ORDER | HA_KEYREAD_ONLY);
+ 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
+ HA_READ_ORDER | HA_KEYREAD_ONLY);
}
uint max_supported_keys() const { return MI_MAX_KEY; }
uint max_supported_key_length() const { return MI_MAX_KEY_LENGTH; }
diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h
index 995cfe9ad4a..264c580220c 100644
--- a/sql/ha_myisammrg.h
+++ b/sql/ha_myisammrg.h
@@ -38,11 +38,11 @@ class ha_myisammrg: public handler
HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED |
HA_CAN_INSERT_DELAYED);
}
- ulong index_flags(uint inx, uint part) const
+ ulong index_flags(uint inx, uint part, bool all_parts) const
{
return ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
- 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
- HA_READ_ORDER | HA_KEYREAD_ONLY);
+ 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
+ HA_READ_ORDER | HA_KEYREAD_ONLY);
}
uint max_supported_keys() const { return MI_MAX_KEY; }
uint max_supported_key_length() const { return MI_MAX_KEY_LENGTH; }
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index d499218a8c3..5b36d6d2b55 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -524,7 +524,8 @@ inline NDB_INDEX_TYPE ha_ndbcluster::get_index_type(uint idx_no) const
flags depending on the type of the index.
*/
-inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part) const
+inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part,
+ bool all_parts) const
{
DBUG_ENTER("index_flags");
DBUG_PRINT("info", ("idx_no: %d", idx_no));
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 39c1779a27a..f094b79ef35 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -93,7 +93,7 @@ class ha_ndbcluster: public handler
const char * table_type() const { return("ndbcluster");}
const char ** bas_ext() const;
ulong table_flags(void) const { return m_table_flags; }
- ulong index_flags(uint idx, uint part) const;
+ ulong index_flags(uint idx, uint part, bool all_parts) const;
uint max_supported_record_length() const { return NDB_MAX_TUPLE_SIZE; };
uint max_supported_keys() const { return MAX_KEY; }
uint max_supported_key_parts() const
diff --git a/sql/handler.h b/sql/handler.h
index a3ed1f35495..28b0b8df6e2 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -449,7 +449,7 @@ public:
virtual const char *table_type() const =0;
virtual const char **bas_ext() const =0;
virtual ulong table_flags(void) const =0;
- virtual ulong index_flags(uint idx, uint part=0) const =0;
+ virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0;
virtual ulong index_ddl_flags(KEY *wanted_index) const
{ return (HA_DDL_SUPPORT); }
virtual int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys)
diff --git a/sql/log.cc b/sql/log.cc
index 124439ae9eb..afba530ce49 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2046,10 +2046,8 @@ bool flush_error_log()
bool MYSQL_LOG::cut_spurious_tail()
{
int error= 0;
- char llbuf1[22], llbuf2[22];
- ulonglong actual_size;
-
DBUG_ENTER("cut_spurious_tail");
+
#ifdef HAVE_INNOBASE_DB
if (have_innodb != SHOW_OPTION_YES)
DBUG_RETURN(0);
@@ -2059,6 +2057,9 @@ bool MYSQL_LOG::cut_spurious_tail()
*/
char *name= ha_innobase::get_mysql_bin_log_name();
ulonglong pos= ha_innobase::get_mysql_bin_log_pos();
+ ulonglong actual_size;
+ char llbuf1[22], llbuf2[22];
+
if (name[0] == 0 || pos == ULONGLONG_MAX)
{
DBUG_PRINT("info", ("InnoDB has not set binlog info"));
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 315b0f670dd..eb86a50b946 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2378,17 +2378,18 @@ void User_var_log_event::print(FILE* file, bool short_form, char* last_db)
> the string constant is still unescaped according to SJIS, not
> according to UCS2.
*/
- char *p, *q;
- if (!(p= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits per byte
+ char *hex_str;
+ CHARSET_INFO *cs;
+
+ if (!(hex_str= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits / byte
break; // no error, as we are 'void'
- str_to_hex(p, val, val_len);
+ str_to_hex(hex_str, val, val_len);
/*
For proper behaviour when mysqlbinlog|mysql, we need to explicitely
specify the variable's collation. It will however cause problems when
people want to mysqlbinlog|mysql into another server not supporting the
character set. But there's not much to do about this and it's unlikely.
*/
- CHARSET_INFO *cs;
if (!(cs= get_charset(charset_number, MYF(0))))
/*
Generate an unusable command (=> syntax error) is probably the best
@@ -2396,8 +2397,8 @@ void User_var_log_event::print(FILE* file, bool short_form, char* last_db)
*/
fprintf(file, ":=???;\n");
else
- fprintf(file, ":=_%s %s COLLATE %s;\n", cs->csname, p, cs->name);
- my_afree(p);
+ fprintf(file, ":=_%s %s COLLATE %s;\n", cs->csname, hex_str, cs->name);
+ my_afree(hex_str);
}
break;
case ROW_RESULT:
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 32a0391a777..40e3ffebe56 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -727,7 +727,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
found_records=check_quick_select(&param, idx, *key);
if (found_records != HA_POS_ERROR && found_records > 2 &&
head->used_keys.is_set(keynr) &&
- (head->file->index_flags(keynr) & HA_KEYREAD_ONLY))
+ (head->file->index_flags(keynr, param.max_key_part, 1) &
+ HA_KEYREAD_ONLY))
{
/*
We can resolve this by only reading through this key.
@@ -1028,7 +1029,8 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
String tmp(buff1,sizeof(buff1),value->collation.collation),*res;
uint length,offset,min_length,max_length;
- if (!field->optimize_range(param->real_keynr[key_part->key]))
+ if (!field->optimize_range(param->real_keynr[key_part->key],
+ key_part->part))
DBUG_RETURN(0); // Can't optimize this
if (!(res= value->val_str(&tmp)))
DBUG_RETURN(&null_element);
@@ -1093,7 +1095,8 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
DBUG_RETURN(new SEL_ARG(field,min_str,max_str));
}
- if (!field->optimize_range(param->real_keynr[key_part->key]) &&
+ if (!field->optimize_range(param->real_keynr[key_part->key],
+ key_part->part) &&
type != Item_func::EQ_FUNC &&
type != Item_func::EQUAL_FUNC)
DBUG_RETURN(0); // Can't optimize this
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 27f3f476fe7..f4c39462d0c 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -645,7 +645,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
part != part_end ;
part++, jdx++, key_part_to_use= (key_part_to_use << 1) | 1)
{
- if (!(table->file->index_flags(idx, jdx) & HA_READ_ORDER))
+ if (!(table->file->index_flags(idx, jdx, 0) & HA_READ_ORDER))
return 0;
if (field->eq(part->field))
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 840a7ae075a..9481e1aaef7 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1744,10 +1744,10 @@ bool sys_var_collation::check(THD *thd, set_var *var)
}
else // INT_RESULT
{
- if (!(tmp=get_charset(var->value->val_int(),MYF(0))))
+ if (!(tmp=get_charset((int) var->value->val_int(),MYF(0))))
{
char buf[20];
- int10_to_str(var->value->val_int(), buf, -10);
+ int10_to_str((int) var->value->val_int(), buf, -10);
my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
return 1;
}
@@ -1783,10 +1783,10 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
}
else // INT_RESULT
{
- if (!(tmp=get_charset(var->value->val_int(),MYF(0))))
+ if (!(tmp=get_charset((int) var->value->val_int(),MYF(0))))
{
char buf[20];
- int10_to_str(var->value->val_int(), buf, -10);
+ int10_to_str((int) var->value->val_int(), buf, -10);
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), buf);
return 1;
}
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 9db2198268a..8cae3b398a0 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -636,8 +636,10 @@ bool mysql_change_db(THD *thd, const char *name)
int length, db_length;
char *dbname=my_strdup((char*) name,MYF(MY_WME));
char path[FN_REFLEN];
- ulong db_access;
HA_CREATE_INFO create;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ ulong db_access;
+#endif
DBUG_ENTER("mysql_change_db");
if (!dbname || !(db_length= strlen(dbname)))
@@ -698,4 +700,3 @@ bool mysql_change_db(THD *thd, const char *name)
thd->variables.collation_database= thd->db_charset;
DBUG_RETURN(0);
}
-
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 90636364459..657853c98ba 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2825,7 +2825,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
Set tmp to (previous record count) * (records / combination)
*/
if ((found_part & 1) &&
- (!(table->file->index_flags(key,0) & HA_ONLY_WHOLE_INDEX) ||
+ (!(table->file->index_flags(key,0,0) & HA_ONLY_WHOLE_INDEX) ||
found_part == PREV_BITS(uint,keyinfo->key_parts)))
{
max_key_part=max_part_bit(found_part);
@@ -7172,7 +7172,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
if (!select->quick->reverse_sorted())
{
// here used_key_parts >0
- if (!(table->file->index_flags(ref_key,used_key_parts-1)
+ if (!(table->file->index_flags(ref_key,used_key_parts-1, 1)
& HA_READ_PREV))
DBUG_RETURN(0); // Use filesort
// ORDER BY range_key DESC
@@ -7195,9 +7195,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
Use a traversal function that starts by reading the last row
with key part (A) and then traverse the index backwards.
*/
- if (!(table->file->index_flags(ref_key,used_key_parts-1)
- & HA_READ_PREV))
- DBUG_RETURN(0); // Use filesort
+ if (!(table->file->index_flags(ref_key,used_key_parts-1, 1)
+ & HA_READ_PREV))
+ DBUG_RETURN(0); // Use filesort
tab->read_first_record= join_read_last_key;
tab->read_record.read_record= join_read_prev_same;
/* fall through */
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 467c774c2e1..e217555e582 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -701,8 +701,9 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
byte *pos;
uint flags=field->flags;
String type(tmp,sizeof(tmp), system_charset_info);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint col_access;
-
+#endif
protocol->prepare_for_resend();
protocol->store(field->field_name, system_charset_info);
field->sql_type(type);
@@ -995,7 +996,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
str=(key_part->field ? key_part->field->field_name :
"?unknown field?");
protocol->store(str, system_charset_info);
- if (table->file->index_flags(i,j) & HA_READ_ORDER)
+ if (table->file->index_flags(i, j, 0) & HA_READ_ORDER)
protocol->store(((key_part->key_part_flag & HA_REVERSE_SORT) ?
"D" : "A"), 1, system_charset_info);
else
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 18394d007ed..db4edff4fa1 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -61,7 +61,10 @@ int mysql_update(THD *thd,
bool safe_update= thd->options & OPTION_SAFE_UPDATES;
bool used_key_is_modified, transactional_table, log_delayed;
int error=0;
- uint used_index, want_privilege;
+ uint used_index;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ uint want_privilege;
+#endif
ulong query_id=thd->query_id, timestamp_query_id;
ha_rows updated, found;
key_map old_used_keys;
diff --git a/sql/table.cc b/sql/table.cc
index 2b92583e777..d3ed6e11756 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -569,13 +569,13 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (field->key_length() == key_part->length &&
!(field->flags & BLOB_FLAG))
{
- if (outparam->file->index_flags(key, i) & HA_KEYREAD_ONLY)
+ if (outparam->file->index_flags(key, i, 1) & HA_KEYREAD_ONLY)
{
outparam->read_only_keys.clear_bit(key);
outparam->keys_for_keyread.set_bit(key);
field->part_of_key.set_bit(key);
}
- if (outparam->file->index_flags(key, i) & HA_READ_ORDER)
+ if (outparam->file->index_flags(key, i, 1) & HA_READ_ORDER)
field->part_of_sortkey.set_bit(key);
}
if (!(key_part->key_part_flag & HA_REVERSE_SORT) &&