summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-12-11 20:47:07 +0200
committermonty@hundin.mysql.fi <>2001-12-11 20:47:07 +0200
commit8bef3771f4bf0880e0bbb2f4f526903f8e72082c (patch)
tree7a48a4172fd7a54a74071294b9d020715838c648 /sql
parent2bb6ecf1b5a2ba77aba187700c7a2f06de1080af (diff)
parent9ca9fc228300926953b91327e705e943a6caf2a2 (diff)
downloadmariadb-git-8bef3771f4bf0880e0bbb2f4f526903f8e72082c.tar.gz
Merge work:/home/bk/mysql-4.0 into hundin.mysql.fi:/my/bk/mysql-4.0
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_cache.cc4
-rw-r--r--sql/sql_select.cc19
-rw-r--r--sql/sql_yacc.yy21
3 files changed, 23 insertions, 21 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 5e07a3529ea..4417af44907 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -2672,6 +2672,7 @@ uint Query_cache::filename_2_table_key (char *key, const char *path)
void Query_cache::wreck(uint line, const char *message)
{
+ THD *thd=current_thd;
DBUG_ENTER("Query_cache::wreck");
query_cache_size = 0;
if (*message)
@@ -2679,7 +2680,8 @@ void Query_cache::wreck(uint line, const char *message)
DBUG_PRINT("warning", ("=================================="));
DBUG_PRINT("warning", ("%5d QUERY CACHE WRECK => DISABLED",line));
DBUG_PRINT("warning", ("=================================="));
- current_thd->killed = 1;
+ if (thd)
+ thd->killed = 1;
bins_dump();
cache_dump();
DBUG_VOID_RETURN;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index cfc40bdfdc3..c168ce775fc 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -480,7 +480,9 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
(thd->select_limit == HA_POS_ERROR ||
(join.select_options & OPTION_FOUND_ROWS) ||
order &&
- !(skip_sort_order=test_if_skip_sort_order(&join.join_tab[join.const_tables], order, thd->select_limit,1))))
+ !(skip_sort_order=
+ test_if_skip_sort_order(&join.join_tab[join.const_tables],
+ order, thd->select_limit,1))))
{
if ((group=create_distinct_group(order,fields)))
{
@@ -5272,13 +5274,6 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys)
}
-/*****************************************************************************
-** If not selecting by given key, create an index how records should be read
-** return: 0 ok
-** -1 some fatal error
-** 1 no records
-*****************************************************************************/
-
/* Return 1 if we don't have to do file sorting */
static bool
@@ -5391,6 +5386,14 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
DBUG_RETURN(0); // Can't use index.
}
+
+/*****************************************************************************
+ If not selecting by given key, create an index how records should be read
+ return: 0 ok
+ -1 some fatal error
+ 1 no records
+*****************************************************************************/
+
static int
create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit)
{
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index c03cd3677c9..1d4c39823ca 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -509,7 +509,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
ulonglong_num
%type <item>
- literal text_literal insert_ident group_ident order_ident
+ literal text_literal insert_ident order_ident
simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr
table_wild opt_pad no_in_expr expr_expr simple_expr no_and_expr
using_list
@@ -1394,7 +1394,7 @@ select_lock_type:
/* empty */
| FOR_SYM UPDATE_SYM
{ Lex->lock_option= TL_WRITE; current_thd->safe_to_cache_query=0; }
- | IN_SYM SHARE_SYM MODE_SYM
+ | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
{ Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; current_thd->safe_to_cache_query=0; }
select_item_list:
@@ -2069,10 +2069,10 @@ group_clause:
| GROUP BY group_list
group_list:
- group_list ',' group_ident
- { if (add_group_to_list($3,(bool) 1)) YYABORT; }
- | group_ident
- { if (add_group_to_list($1,(bool) 1)) YYABORT; }
+ group_list ',' order_ident order_dir
+ { if (add_group_to_list($3,(bool) $4)) YYABORT; }
+ | order_ident order_dir
+ { if (add_group_to_list($1,(bool) $2)) YYABORT; }
/*
** Order by statement in select
@@ -2083,7 +2083,7 @@ opt_order_clause:
| order_clause
order_clause:
- ORDER_SYM BY { Select->sort_default=1; } order_list
+ ORDER_SYM BY order_list
order_list:
order_list ',' order_ident order_dir
@@ -2093,8 +2093,8 @@ order_list:
order_dir:
/* empty */ { $$ = 1; }
- | ASC { $$ = Select->sort_default=1; }
- | DESC { $$ = Select->sort_default=0; }
+ | ASC { $$ =1; }
+ | DESC { $$ =0; }
limit_clause:
@@ -2813,9 +2813,6 @@ table_wild:
| ident '.' ident '.' '*'
{ $$ = new Item_field((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS : $1.str),$3.str,"*"); }
-group_ident:
- order_ident order_dir
-
order_ident:
expr { $$=$1; }