summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorunknown <monty@mishka.local>2005-05-06 11:39:30 +0300
committerunknown <monty@mishka.local>2005-05-06 11:39:30 +0300
commitab54e167052bb03f7f25cb071ee75f4f26caf68f (patch)
tree9bc36292e6c63e524c34d371f01eb8a1ec82d9ee /sql/sql_show.cc
parent21eed96b0261a6c6eff4f8df1493a0e57decf2bb (diff)
downloadmariadb-git-ab54e167052bb03f7f25cb071ee75f4f26caf68f.tar.gz
Fixes while reviewing new code
Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index d6027699257..bbd740249cd 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1600,6 +1600,8 @@ LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
/* INFORMATION_SCHEMA name */
LEX_STRING information_schema_name= {(char*)"information_schema", 18};
+
+/* This is only used internally, but we need it here as a forward reference */
extern ST_SCHEMA_TABLE schema_tables[];
typedef struct st_index_field_values
@@ -1693,8 +1695,8 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
CHARSET_INFO *cs= system_charset_info;
ST_SCHEMA_TABLE *schema_table= table->schema_table;
ST_FIELD_INFO *field_info= schema_table->fields_info;
- const char *field_name1= field_info[schema_table->idx_field1].field_name;
- const char *field_name2= field_info[schema_table->idx_field2].field_name;
+ const char *field_name1= schema_table->idx_field1 >= 0 ? field_info[schema_table->idx_field1].field_name : "";
+ const char *field_name2= schema_table->idx_field2 >= 0 ? field_info[schema_table->idx_field2].field_name : "";
if (table->table != item_field->field->table ||
(cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
(uchar *) item_field->field_name,