summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2003-12-11 06:24:32 +0200
committerunknown <monty@mysql.com>2003-12-11 06:24:32 +0200
commit28b1f63aa7f6ed40d68c932cfe33420c12c7347d (patch)
tree35f5e63ae1da09573a4496dfd0ced99b9d70ae97 /sql
parent7cfbc5e9336099d4b850e6a7e8282ade3e7aef19 (diff)
parent287661e66cc1fea6730b357bb56d48c6d065ef43 (diff)
downloadmariadb-git-28b1f63aa7f6ed40d68c932cfe33420c12c7347d.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/my/mysql-4.0 mysys/my_thr_init.c: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_base.cc7
-rw-r--r--sql/sql_delete.cc12
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/sql_show.cc12
-rw-r--r--sql/sql_yacc.yy1
5 files changed, 30 insertions, 4 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index e4694adb9a2..dd80062d6e7 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1868,8 +1868,13 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
while ((item=it++))
{
+ /*
+ Expand * to all fields if this is not the temporary table for an
+ a UNION result
+ */
if (item->type() == Item::FIELD_ITEM &&
- ((Item_field*) item)->field_name[0] == '*')
+ ((Item_field*) item)->field_name[0] == '*' &&
+ !((Item_field*) item)->field)
{
uint elem=fields.elements;
if (insert_fields(thd,tables,((Item_field*) item)->db_name,
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 34a79ecd78d..ee2b720907d 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -78,7 +78,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
DBUG_RETURN(-1);
if ((select && select->check_quick(thd,
test(thd->options & OPTION_SAFE_UPDATES),
- limit)) ||
+ limit)) ||
!limit)
{
delete select;
@@ -117,13 +117,19 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
if (setup_order(thd, &tables, fields, all_fields, order) ||
!(sortorder=make_unireg_sortorder(order, &length)) ||
(table->found_records = filesort(table, sortorder, length,
- (SQL_SELECT *) 0, 0L, HA_POS_ERROR,
+ select, 0L, HA_POS_ERROR,
&examined_rows))
== HA_POS_ERROR)
{
delete select;
- DBUG_RETURN(-1); // This will force out message
+ DBUG_RETURN(-1); // This will force out message
}
+ /*
+ Filesort has already found and selected the rows we want to delete,
+ so we don't need the where clause
+ */
+ delete select;
+ select= 0;
}
init_read_record(&info,thd,table,select,1,1);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index df4b0226ff6..892ad02bb5b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3273,6 +3273,8 @@ return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables,
}
result->send_eof(); // Should be safe
}
+ /* Update results for FOUND_ROWS */
+ join->thd->limit_found_rows= join->thd->examined_row_count= 0;
DBUG_RETURN(0);
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index a7de04d0bfa..cb6cd18b7c8 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -197,7 +197,19 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
#ifdef USE_SYMDIR
char *ext;
if (my_use_symdir && !strcmp(ext=fn_ext(file->name), ".sym"))
+ {
+ /* Only show the sym file if it points to a directory */
+ char buff[FN_REFLEN], *end;
+ MY_STAT status;
*ext=0; /* Remove extension */
+ unpack_dirname(buff, file->name);
+ end= strend(buff);
+ if (end != buff && end[-1] == FN_LIBCHAR)
+ end[-1]= 0; // Remove end FN_LIBCHAR
+ if (!my_stat(buff, &status, MYF(0)) ||
+ !MY_S_ISDIR(status.st_mode))
+ continue;
+ }
else
#endif
{
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 03837300904..b5b9a4cdfb7 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -4014,5 +4014,6 @@ optional_order_or_limit:
union_option:
/* empty */ {}
+ | DISTINCT {}
| ALL { Lex->union_option=1; }
;