summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <stewart@willster.(none)>2006-10-18 18:51:39 +1000
committerunknown <stewart@willster.(none)>2006-10-18 18:51:39 +1000
commit9910031cbea0c9ac5361009a00bb07dc37d5dc7d (patch)
tree158cd8baa75df0668f66387c30ec45326aad4cf2 /sql
parent7968c44c0edb8c0d098f9ba81455ee29b855e3cc (diff)
parent46152464aa27954659a028d625f82acc601b7bbe (diff)
downloadmariadb-git-9910031cbea0c9ac5361009a00bb07dc37d5dc7d.tar.gz
Merge willster.(none):/home/stewart/Documents/MySQL/5.0/bug19914-mk2-merge
into willster.(none):/home/stewart/Documents/MySQL/5.1/bug19914-mk2-merge BitKeeper/deleted/.del-ha_berkeley.cc: Auto merged BitKeeper/deleted/.del-ha_berkeley.h: Auto merged mysql-test/r/ctype_utf8.result: Auto merged mysql-test/t/ctype_utf8.test: Auto merged sql/item_sum.cc: Auto merged sql/opt_sum.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_union.cc: Auto merged sql/sql_view.cc: Auto merged sql/table.cc: Auto merged storage/archive/ha_archive.cc: Auto merged storage/blackhole/ha_blackhole.cc: Auto merged storage/blackhole/ha_blackhole.h: Auto merged storage/csv/ha_tina.cc: Auto merged storage/csv/ha_tina.h: Auto merged storage/example/ha_example.cc: Auto merged storage/example/ha_example.h: Auto merged storage/federated/ha_federated.cc: Auto merged storage/federated/ha_federated.h: Auto merged storage/heap/ha_heap.cc: Auto merged storage/heap/ha_heap.h: Auto merged storage/myisam/ha_myisam.h: Auto merged storage/myisammrg/ha_myisammrg.cc: Auto merged storage/ndb/include/kernel/GlobalSignalNumbers.h: Auto merged storage/ndb/include/mgmapi/mgmapi.h: Auto merged storage/ndb/include/ndb_version.h.in: Auto merged storage/ndb/include/ndbapi/NdbTransaction.hpp: Auto merged storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Auto merged storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: Auto merged storage/ndb/src/kernel/vm/Configuration.cpp: Auto merged storage/ndb/src/mgmapi/mgmapi.cpp: Auto merged storage/ndb/src/mgmclient/main.cpp: Auto merged storage/ndb/src/ndbapi/NdbScanOperation.cpp: Auto merged storage/ndb/src/ndbapi/NdbTransaction.cpp: Auto merged storage/ndb/tools/ndb_condig.cpp: Auto merged storage/ndb/tools/restore/restore_main.cpp: Auto merged sql/ha_ndbcluster.cc: merge sql/ha_ndbcluster.h: merge sql/handler.h: merge sql/sql_delete.cc: merge storage/archive/ha_archive.h: merge storage/innobase/handler/ha_innodb.cc: merge storage/innobase/handler/ha_innodb.h: merge storage/myisam/ha_myisam.cc: merge storage/myisammrg/ha_myisammrg.h: merge
Diffstat (limited to 'sql')
-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_select.cc9
-rw-r--r--sql/sql_union.cc7
7 files changed, 48 insertions, 16 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 636486a8b3f..630bc184c84 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -469,11 +469,13 @@ ha_rows ha_ndbcluster::records()
DBUG_RETURN(retval + info->no_uncommitted_rows_count);
}
-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= m_table_info;
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
((const NDBTAB *)m_table)->getTableId(),
@@ -483,7 +485,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_table, &stat) == 0)
+ if ((result= ndb_get_table_statistics(ndb, m_table, &stat)) == 0)
{
stats.mean_rec_length= stat.row_size;
stats.data_file_length= stat.fragment_memory;
@@ -496,7 +498,7 @@ void ha_ndbcluster::records_update()
info->no_uncommitted_rows_count= 0;
}
stats.records= info->records+ info->no_uncommitted_rows_count;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(result);
}
void ha_ndbcluster::no_uncommitted_rows_execute_failure()
@@ -3635,8 +3637,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));
@@ -3654,18 +3657,18 @@ void ha_ndbcluster::info(uint flag)
if (m_ha_not_exact_count)
stats.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();
ndb->setDatabaseName(m_dbname);
struct Ndb_statistics stat;
ndb->setDatabaseName(m_dbname);
if (current_thd->variables.ndb_use_exact_count &&
- ndb_get_table_statistics(ndb, m_table, &stat) == 0)
+ (result= ndb_get_table_statistics(ndb, m_table, &stat)) == 0)
{
stats.mean_rec_length= stat.row_size;
stats.data_file_length= stat.fragment_memory;
@@ -3709,7 +3712,11 @@ void ha_ndbcluster::info(uint flag)
stats.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 19ff513f9b1..cffc7dcdd47 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -673,7 +673,7 @@ class ha_ndbcluster: public handler
bool get_error_message(int error, String *buf);
ha_rows records();
- void info(uint);
+ int info(uint);
void get_dynamic_partition_info(PARTITION_INFO *stat_info, uint part_id);
int extra(enum ha_extra_function operation);
int extra_opt(enum ha_extra_function operation, ulong cache_size);
@@ -878,7 +878,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_reset(THD *);
diff --git a/sql/handler.h b/sql/handler.h
index 5e26d9c7b63..0cfd6da23d7 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1243,7 +1243,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 void get_dynamic_partition_info(PARTITION_INFO *stat_info,
uint part_id);
virtual int extra(enum ha_extra_function operation)
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 73e2c5e6935..c656faa7c49 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -2693,6 +2693,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);
@@ -2706,7 +2707,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->stats.records;
}
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 7d6305594fd..cb8b53ac6a7 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -167,7 +167,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->stats.records;
}
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ed91719fd46..cb83002a0fe 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -676,6 +676,8 @@ JOIN::optimize()
{
if (res > 1)
{
+ thd->fatal_error();
+ error= res;
DBUG_PRINT("error",("Error from opt_sum_query"));
DBUG_RETURN(1);
}
@@ -2119,7 +2121,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 3e6a3944093..cfaf21fa957 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)
{