summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/examples/ha_example.cc4
-rw-r--r--sql/examples/ha_example.h2
-rw-r--r--sql/examples/ha_tina.cc4
-rw-r--r--sql/examples/ha_tina.h2
-rw-r--r--sql/ha_archive.cc4
-rw-r--r--sql/ha_archive.h2
-rw-r--r--sql/ha_berkeley.cc4
-rw-r--r--sql/ha_berkeley.h2
-rw-r--r--sql/ha_blackhole.cc4
-rw-r--r--sql/ha_blackhole.h2
-rw-r--r--sql/ha_heap.cc3
-rw-r--r--sql/ha_heap.h2
-rw-r--r--sql/ha_innodb.cc6
-rw-r--r--sql/ha_innodb.h2
-rw-r--r--sql/ha_myisam.cc4
-rw-r--r--sql/ha_myisam.h2
-rw-r--r--sql/ha_myisammrg.cc3
-rw-r--r--sql/ha_myisammrg.h2
-rw-r--r--sql/ha_ndbcluster.cc25
-rw-r--r--sql/ha_ndbcluster.h4
-rw-r--r--sql/handler.h2
-rw-r--r--sql/item_sum.cc10
-rw-r--r--sql/opt_sum.cc7
-rw-r--r--sql/sql_delete.cc7
-rw-r--r--sql/sql_select.cc9
-rw-r--r--sql/sql_union.cc7
26 files changed, 83 insertions, 42 deletions
diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc
index 471ece77490..92e5469a832 100644
--- a/sql/examples/ha_example.cc
+++ b/sql/examples/ha_example.cc
@@ -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);
}
diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h
index 37f38fe5210..f18063f6c32 100644
--- a/sql/examples/ha_example.h
+++ b/sql/examples/ha_example.h
@@ -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);
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc
index f727cefc6d0..7fb2de9ca30 100644
--- a/sql/examples/ha_tina.cc
+++ b/sql/examples/ha_tina.cc
@@ -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);
}
/*
diff --git a/sql/examples/ha_tina.h b/sql/examples/ha_tina.h
index 97659f99dd9..3bd6405b3f8 100644
--- a/sql/examples/ha_tina.h
+++ b/sql/examples/ha_tina.h
@@ -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);
diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc
index bc3c819c4ed..189c5facfab 100644
--- a/sql/ha_archive.cc
+++ b/sql/ha_archive.cc
@@ -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);
}
diff --git a/sql/ha_archive.h b/sql/ha_archive.h
index 564b9f03bf5..6c6b587dd2a 100644
--- a/sql/ha_archive.h
+++ b/sql/ha_archive.h
@@ -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);
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 4209bc93d30..ac3625157cf 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -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);
}
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index 16e4db59c10..2ff0a7cf044 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -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);
diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc
index 2505919af39..6aabcb4e7cd 100644
--- a/sql/ha_blackhole.cc
+++ b/sql/ha_blackhole.cc
@@ -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)
diff --git a/sql/ha_blackhole.h b/sql/ha_blackhole.h
index 7238147a06a..05cb1c66b39 100644
--- a/sql/ha_blackhole.h
+++ b/sql/ha_blackhole.h
@@ -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,
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 3aaa0287098..34ef888a029 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -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)
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index e2816abf0b6..a48428e9289 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -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);
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index e99d93784c9..e2d4732531e 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -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);
}
/**************************************************************************
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 5dd6a92c4b0..95d7a9437ad 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -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);
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index fc3bd3d3b08..8e40105780b 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -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;
}
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index 950817d42bd..f5c45333f50 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -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);
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index a4f23cd3cf0..33da88bbdd4 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -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;
}
diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h
index a73f368c51d..e20214fa84f 100644
--- a/sql/ha_myisammrg.h
+++ b/sql/ha_myisammrg.h
@@ -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);
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 5f18d5534e4..e9e2103cba7 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -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);
}
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index cfb12981b98..7d5adcb866b 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -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 *);
diff --git a/sql/handler.h b/sql/handler.h
index 481a98be285..e474eac8cb1 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -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)
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 5ca1dbba94b..d9a28b6c507 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -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;
}
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index d17c42bca38..fc4edabc4a4 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -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;
}
}
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index c95fb5d5973..8ee6274ff11 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -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;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6d17faf8509..abd456447f6 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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;
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index c5af81ae55a..3de2ca62c94 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -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)
{