Merge willster.(none):/home/stewart/Documents/MySQL/4.1/bug19914-mk2
into willster.(none):/home/stewart/Documents/MySQL/5.0/bug19914-mk2-merge
This commit is contained in:
commit
c1903d967a
@ -523,10 +523,10 @@ int ha_example::rnd_pos(byte * buf, byte *pos)
|
||||
sql_update.cc
|
||||
|
||||
*/
|
||||
void ha_example::info(uint flag)
|
||||
int ha_example::info(uint flag)
|
||||
{
|
||||
DBUG_ENTER("ha_example::info");
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ public:
|
||||
int rnd_next(byte *buf); //required
|
||||
int rnd_pos(byte * buf, byte *pos); //required
|
||||
void position(const byte *record); //required
|
||||
void info(uint); //required
|
||||
int info(uint); //required
|
||||
|
||||
int extra(enum ha_extra_function operation);
|
||||
int reset(void);
|
||||
|
@ -792,13 +792,13 @@ int ha_tina::rnd_pos(byte * buf, byte *pos)
|
||||
Currently this table handler doesn't implement most of the fields
|
||||
really needed. SHOW also makes use of this data
|
||||
*/
|
||||
void ha_tina::info(uint flag)
|
||||
int ha_tina::info(uint flag)
|
||||
{
|
||||
DBUG_ENTER("ha_tina::info");
|
||||
/* This is a lie, but you don't want the optimizer to see zero or 1 */
|
||||
if (!records_is_known && records < 2)
|
||||
records= 2;
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
int rnd_pos(byte * buf, byte *pos);
|
||||
int rnd_end();
|
||||
void position(const byte *record);
|
||||
void info(uint);
|
||||
int info(uint);
|
||||
int extra(enum ha_extra_function operation);
|
||||
int reset(void);
|
||||
int external_lock(THD *thd, int lock_type);
|
||||
|
@ -1115,7 +1115,7 @@ THR_LOCK_DATA **ha_archive::store_lock(THD *thd,
|
||||
/*
|
||||
Hints for optimizer, see ha_tina for more information
|
||||
*/
|
||||
void ha_archive::info(uint flag)
|
||||
int ha_archive::info(uint flag)
|
||||
{
|
||||
DBUG_ENTER("ha_archive::info");
|
||||
/*
|
||||
@ -1140,7 +1140,7 @@ void ha_archive::info(uint flag)
|
||||
delete_length= 0;
|
||||
index_file_length=0;
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
int read_data_header(gzFile file_to_read);
|
||||
int write_data_header(gzFile file_to_write);
|
||||
void position(const byte *record);
|
||||
void info(uint);
|
||||
int info(uint);
|
||||
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
|
||||
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
|
||||
int repair(THD* thd, HA_CHECK_OPT* check_opt);
|
||||
|
@ -1756,7 +1756,7 @@ void ha_berkeley::position(const byte *record)
|
||||
}
|
||||
|
||||
|
||||
void ha_berkeley::info(uint flag)
|
||||
int ha_berkeley::info(uint flag)
|
||||
{
|
||||
DBUG_ENTER("ha_berkeley::info");
|
||||
if (flag & HA_STATUS_VARIABLE)
|
||||
@ -1776,7 +1776,7 @@ void ha_berkeley::info(uint flag)
|
||||
/* Don't return key if we got an error for the internal primary key */
|
||||
if (flag & HA_STATUS_ERRKEY && last_dup_key < table->s->keys)
|
||||
errkey= last_dup_key;
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -123,7 +123,7 @@ class ha_berkeley: public handler
|
||||
int rnd_next(byte *buf);
|
||||
int rnd_pos(byte * buf, byte *pos);
|
||||
void position(const byte *record);
|
||||
void info(uint);
|
||||
int info(uint);
|
||||
int extra(enum ha_extra_function operation);
|
||||
int reset(void);
|
||||
int external_lock(THD *thd, int lock_type);
|
||||
|
@ -138,7 +138,7 @@ void ha_blackhole::position(const byte *record)
|
||||
}
|
||||
|
||||
|
||||
void ha_blackhole::info(uint flag)
|
||||
int ha_blackhole::info(uint flag)
|
||||
{
|
||||
DBUG_ENTER("ha_blackhole::info");
|
||||
|
||||
@ -152,7 +152,7 @@ void ha_blackhole::info(uint flag)
|
||||
delete_length= 0;
|
||||
if (flag & HA_STATUS_AUTO)
|
||||
auto_increment_value= 1;
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
int ha_blackhole::external_lock(THD *thd, int lock_type)
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
int index_first(byte * buf);
|
||||
int index_last(byte * buf);
|
||||
void position(const byte *record);
|
||||
void info(uint flag);
|
||||
int info(uint flag);
|
||||
int external_lock(THD *thd, int lock_type);
|
||||
uint lock_count(void) const;
|
||||
int create(const char *name, TABLE *table_arg,
|
||||
|
@ -332,7 +332,7 @@ void ha_heap::position(const byte *record)
|
||||
*(HEAP_PTR*) ref= heap_position(file); // Ref is aligned
|
||||
}
|
||||
|
||||
void ha_heap::info(uint flag)
|
||||
int ha_heap::info(uint flag)
|
||||
{
|
||||
HEAPINFO info;
|
||||
(void) heap_info(file,&info,flag);
|
||||
@ -354,6 +354,7 @@ void ha_heap::info(uint flag)
|
||||
*/
|
||||
if (key_stat_version != file->s->key_stat_version)
|
||||
update_key_stats();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ha_heap::extra(enum ha_extra_function operation)
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
int rnd_next(byte *buf);
|
||||
int rnd_pos(byte * buf, byte *pos);
|
||||
void position(const byte *record);
|
||||
void info(uint);
|
||||
int info(uint);
|
||||
int extra(enum ha_extra_function operation);
|
||||
int external_lock(THD *thd, int lock_type);
|
||||
int delete_all_rows(void);
|
||||
|
@ -5258,7 +5258,7 @@ ha_innobase::read_time(
|
||||
Returns statistics information of the table to the MySQL interpreter,
|
||||
in various fields of the handle object. */
|
||||
|
||||
void
|
||||
int
|
||||
ha_innobase::info(
|
||||
/*==============*/
|
||||
uint flag) /* in: what information MySQL requests */
|
||||
@ -5281,7 +5281,7 @@ ha_innobase::info(
|
||||
|
||||
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(HA_ERR_CRASHED);
|
||||
}
|
||||
|
||||
/* We do not know if MySQL can call this function before calling
|
||||
@ -5476,7 +5476,7 @@ ha_innobase::info(
|
||||
|
||||
prebuilt->trx->op_info = (char*)"";
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -140,7 +140,7 @@ class ha_innobase: public handler
|
||||
int rnd_pos(byte * buf, byte *pos);
|
||||
|
||||
void position(const byte *record);
|
||||
void info(uint);
|
||||
int info(uint);
|
||||
int analyze(THD* thd,HA_CHECK_OPT* check_opt);
|
||||
int optimize(THD* thd,HA_CHECK_OPT* check_opt);
|
||||
int discard_or_import_tablespace(my_bool discard);
|
||||
|
@ -1299,7 +1299,7 @@ void ha_myisam::position(const byte* record)
|
||||
my_store_ptr(ref, ref_length, position);
|
||||
}
|
||||
|
||||
void ha_myisam::info(uint flag)
|
||||
int ha_myisam::info(uint flag)
|
||||
{
|
||||
MI_ISAMINFO info;
|
||||
char name_buff[FN_REFLEN];
|
||||
@ -1358,6 +1358,8 @@ void ha_myisam::info(uint flag)
|
||||
update_time = info.update_time;
|
||||
if (flag & HA_STATUS_AUTO)
|
||||
auto_increment_value= info.auto_increment;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,7 +95,7 @@ class ha_myisam: public handler
|
||||
int rnd_pos(byte * buf, byte *pos);
|
||||
int restart_rnd_next(byte *buf, byte *pos);
|
||||
void position(const byte *record);
|
||||
void info(uint);
|
||||
int info(uint);
|
||||
int extra(enum ha_extra_function operation);
|
||||
int extra_opt(enum ha_extra_function operation, ulong cache_size);
|
||||
int external_lock(THD *thd, int lock_type);
|
||||
|
@ -275,7 +275,7 @@ ha_rows ha_myisammrg::records_in_range(uint inx, key_range *min_key,
|
||||
}
|
||||
|
||||
|
||||
void ha_myisammrg::info(uint flag)
|
||||
int ha_myisammrg::info(uint flag)
|
||||
{
|
||||
MYMERGE_INFO info;
|
||||
(void) myrg_status(file,&info,flag);
|
||||
@ -343,6 +343,7 @@ void ha_myisammrg::info(uint flag)
|
||||
min(file->keys, table->s->key_parts));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,7 +72,7 @@ class ha_myisammrg: public handler
|
||||
int rnd_pos(byte * buf, byte *pos);
|
||||
void position(const byte *record);
|
||||
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
|
||||
void info(uint);
|
||||
int info(uint);
|
||||
int extra(enum ha_extra_function operation);
|
||||
int extra_opt(enum ha_extra_function operation, ulong cache_size);
|
||||
int external_lock(THD *thd, int lock_type);
|
||||
|
@ -355,11 +355,13 @@ void ha_ndbcluster::set_rec_per_key()
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
void ha_ndbcluster::records_update()
|
||||
int ha_ndbcluster::records_update()
|
||||
{
|
||||
if (m_ha_not_exact_count)
|
||||
return;
|
||||
return 0;
|
||||
DBUG_ENTER("ha_ndbcluster::records_update");
|
||||
int result= 0;
|
||||
|
||||
struct Ndb_local_table_statistics *info=
|
||||
(struct Ndb_local_table_statistics *)m_table_info;
|
||||
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
|
||||
@ -370,7 +372,7 @@ void ha_ndbcluster::records_update()
|
||||
Ndb *ndb= get_ndb();
|
||||
struct Ndb_statistics stat;
|
||||
ndb->setDatabaseName(m_dbname);
|
||||
if (ndb_get_table_statistics(ndb, m_tabname, &stat) == 0){
|
||||
if ((result= ndb_get_table_statistics(ndb, m_tabname, &stat)) == 0){
|
||||
mean_rec_length= stat.row_size;
|
||||
data_file_length= stat.fragment_memory;
|
||||
info->records= stat.row_count;
|
||||
@ -382,7 +384,7 @@ void ha_ndbcluster::records_update()
|
||||
info->no_uncommitted_rows_count= 0;
|
||||
}
|
||||
records= info->records+ info->no_uncommitted_rows_count;
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
void ha_ndbcluster::no_uncommitted_rows_execute_failure()
|
||||
@ -3086,8 +3088,9 @@ void ha_ndbcluster::position(const byte *record)
|
||||
}
|
||||
|
||||
|
||||
void ha_ndbcluster::info(uint flag)
|
||||
int ha_ndbcluster::info(uint flag)
|
||||
{
|
||||
int result= 0;
|
||||
DBUG_ENTER("info");
|
||||
DBUG_PRINT("enter", ("flag: %d", flag));
|
||||
|
||||
@ -3105,17 +3108,17 @@ void ha_ndbcluster::info(uint flag)
|
||||
if (m_ha_not_exact_count)
|
||||
records= 100;
|
||||
else
|
||||
records_update();
|
||||
result= records_update();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((my_errno= check_ndb_connection()))
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(my_errno);
|
||||
Ndb *ndb= get_ndb();
|
||||
struct Ndb_statistics stat;
|
||||
ndb->setDatabaseName(m_dbname);
|
||||
if (current_thd->variables.ndb_use_exact_count &&
|
||||
ndb_get_table_statistics(ndb, m_tabname, &stat) == 0)
|
||||
(result= ndb_get_table_statistics(ndb, m_tabname, &stat)) == 0)
|
||||
{
|
||||
mean_rec_length= stat.row_size;
|
||||
data_file_length= stat.fragment_memory;
|
||||
@ -3158,7 +3161,11 @@ void ha_ndbcluster::info(uint flag)
|
||||
auto_increment_value= (ulonglong)auto_increment_value64;
|
||||
}
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
if(result == -1)
|
||||
result= HA_ERR_NO_CONNECTION;
|
||||
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -505,7 +505,7 @@ class ha_ndbcluster: public handler
|
||||
int read_multi_range_next(KEY_MULTI_RANGE **found_range_p);
|
||||
|
||||
bool get_error_message(int error, String *buf);
|
||||
void info(uint);
|
||||
int info(uint);
|
||||
int extra(enum ha_extra_function operation);
|
||||
int extra_opt(enum ha_extra_function operation, ulong cache_size);
|
||||
int external_lock(THD *thd, int lock_type);
|
||||
@ -657,7 +657,7 @@ private:
|
||||
int check_ndb_connection(THD* thd= current_thd);
|
||||
|
||||
void set_rec_per_key();
|
||||
void records_update();
|
||||
int records_update();
|
||||
void no_uncommitted_rows_execute_failure();
|
||||
void no_uncommitted_rows_update(int);
|
||||
void no_uncommitted_rows_init(THD *);
|
||||
|
@ -682,7 +682,7 @@ public:
|
||||
key_range *max_key)
|
||||
{ return (ha_rows) 10; }
|
||||
virtual void position(const byte *record)=0;
|
||||
virtual void info(uint)=0; // see my_base.h for full description
|
||||
virtual int info(uint)=0; // see my_base.h for full description
|
||||
virtual int extra(enum ha_extra_function operation)
|
||||
{ return 0; }
|
||||
virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)
|
||||
|
@ -2675,6 +2675,7 @@ bool Item_sum_count_distinct::add()
|
||||
|
||||
longlong Item_sum_count_distinct::val_int()
|
||||
{
|
||||
int error;
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if (!table) // Empty query
|
||||
return LL(0);
|
||||
@ -2688,7 +2689,14 @@ longlong Item_sum_count_distinct::val_int()
|
||||
tree->walk(count_distinct_walk, (void*) &count);
|
||||
return (longlong) count;
|
||||
}
|
||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
|
||||
error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
|
||||
if(error)
|
||||
{
|
||||
table->file->print_error(error, MYF(0));
|
||||
}
|
||||
|
||||
return table->file->records;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,12 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
|
||||
}
|
||||
else
|
||||
{
|
||||
tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
error= tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
if(error)
|
||||
{
|
||||
tl->table->file->print_error(error, MYF(0));
|
||||
return error;
|
||||
}
|
||||
count*= tl->table->file->records;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
table_list->view_db.str, table_list->view_name.str);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
if (error)
|
||||
{
|
||||
table->file->print_error(error, MYF(0));
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
thd->proc_info="init";
|
||||
table->map=1;
|
||||
|
||||
|
@ -666,6 +666,8 @@ JOIN::optimize()
|
||||
{
|
||||
if (res > 1)
|
||||
{
|
||||
thd->fatal_error();
|
||||
error= res;
|
||||
DBUG_PRINT("error",("Error from opt_sum_query"));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
@ -2102,7 +2104,12 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
|
||||
s->needed_reg.init();
|
||||
table_vector[i]=s->table=table=tables->table;
|
||||
table->pos_in_table_list= tables;
|
||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);// record count
|
||||
error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
if(error)
|
||||
{
|
||||
table->file->print_error(error, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
table->quick_keys.clear_all();
|
||||
table->reginfo.join_tab=s;
|
||||
table->reginfo.not_exists_optimize=0;
|
||||
|
@ -496,7 +496,12 @@ bool st_select_lex_unit::exec()
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
/* Needed for the following test and for records_at_start in next loop */
|
||||
table->file->info(HA_STATUS_VARIABLE);
|
||||
int error= table->file->info(HA_STATUS_VARIABLE);
|
||||
if(error)
|
||||
{
|
||||
table->file->print_error(error, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (found_rows_for_union && !sl->braces &&
|
||||
select_limit_cnt != HA_POS_ERROR)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user