Commit 26955036 authored by pem@mysql.com's avatar pem@mysql.com

Merge mysql.com:/usr/local/bk/mysql-5.0

into mysql.com:/home/pem/work/mysql-5.0
parents f9e73c77 a8f0a8be
...@@ -144,7 +144,6 @@ insert into t1 values (1); ...@@ -144,7 +144,6 @@ insert into t1 values (1);
show open tables; show open tables;
Database Table In_use Name_locked Database Table In_use Name_locked
test t1 0 0 test t1 0 0
mysql proc 0 0
drop table t1; drop table t1;
create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed; create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
show create table t1; show create table t1;
......
...@@ -14,6 +14,6 @@ update t1 set n = 3; ...@@ -14,6 +14,6 @@ update t1 set n = 3;
unlock tables; unlock tables;
show status like 'Table_lock%'; show status like 'Table_lock%';
Variable_name Value Variable_name Value
Table_locks_immediate 4 Table_locks_immediate 3
Table_locks_waited 1 Table_locks_waited 1
drop table t1; drop table t1;
...@@ -168,38 +168,6 @@ static int find_keyword(LEX *lex, uint len, bool function) ...@@ -168,38 +168,6 @@ static int find_keyword(LEX *lex, uint len, bool function)
lex->yylval->symbol.length=len; lex->yylval->symbol.length=len;
return symbol->tok; return symbol->tok;
} }
LEX_STRING ls;
ls.str = (char *)tok; ls.length= len;
if (function && sp_function_exists(current_thd, &ls)) // QQ temp fix
{
lex->safe_to_cache_query= 0;
lex->yylval->lex_str.str= lex->thd->strmake((char*)lex->tok_start, len);
lex->yylval->lex_str.length= len;
return SP_FUNC;
}
#ifdef HAVE_DLOPEN
udf_func *udf;
if (function && using_udf_functions && (udf=find_udf((char*) tok, len)))
{
lex->safe_to_cache_query=0;
lex->yylval->udf=udf;
switch (udf->returns) {
case STRING_RESULT:
return (udf->type == UDFTYPE_FUNCTION) ? UDF_CHAR_FUNC : UDA_CHAR_SUM;
case REAL_RESULT:
return (udf->type == UDFTYPE_FUNCTION) ? UDF_FLOAT_FUNC : UDA_FLOAT_SUM;
case INT_RESULT:
return (udf->type == UDFTYPE_FUNCTION) ? UDF_INT_FUNC : UDA_INT_SUM;
case ROW_RESULT:
default:
// This case should never be choosen
DBUG_ASSERT(0);
return 0;
}
}
#endif
return 0; return 0;
} }
......
...@@ -568,17 +568,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -568,17 +568,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token SECOND_SYM %token SECOND_SYM
%token SECOND_MICROSECOND_SYM %token SECOND_MICROSECOND_SYM
%token SHARE_SYM %token SHARE_SYM
%token SP_FUNC
%token SUBDATE_SYM %token SUBDATE_SYM
%token SUBSTRING %token SUBSTRING
%token SUBSTRING_INDEX %token SUBSTRING_INDEX
%token TRIM %token TRIM
%token UDA_CHAR_SUM
%token UDA_FLOAT_SUM
%token UDA_INT_SUM
%token UDF_CHAR_FUNC
%token UDF_FLOAT_FUNC
%token UDF_INT_FUNC
%token UNIQUE_USERS %token UNIQUE_USERS
%token UNIX_TIMESTAMP %token UNIX_TIMESTAMP
%token USER %token USER
...@@ -640,7 +633,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -640,7 +633,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text
UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
NCHAR_STRING opt_component key_cache_name NCHAR_STRING opt_component key_cache_name
SP_FUNC ident_or_spfunc sp_opt_label sp_opt_label
%type <lex_str_ptr> %type <lex_str_ptr>
opt_table_alias opt_table_alias
...@@ -683,7 +676,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -683,7 +676,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
simple_ident_nospvar simple_ident_q simple_ident_nospvar simple_ident_q
%type <item_list> %type <item_list>
expr_list sp_expr_list udf_expr_list udf_expr_list2 when_list expr_list udf_expr_list udf_expr_list2 when_list
ident_list ident_list_arg ident_list ident_list_arg
%type <key_type> %type <key_type>
...@@ -701,10 +694,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -701,10 +694,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <table_list> %type <table_list>
join_table_list join_table join_table_list join_table
%type <udf>
UDF_CHAR_FUNC UDF_FLOAT_FUNC UDF_INT_FUNC
UDA_CHAR_SUM UDA_FLOAT_SUM UDA_INT_SUM
%type <date_time_type> date_time_type; %type <date_time_type> date_time_type;
%type <interval> interval %type <interval> interval
...@@ -1030,7 +1019,7 @@ create: ...@@ -1030,7 +1019,7 @@ create:
lex->name=$4.str; lex->name=$4.str;
lex->create_info.options=$3; lex->create_info.options=$3;
} }
| CREATE udf_func_type FUNCTION_SYM ident_or_spfunc | CREATE udf_func_type FUNCTION_SYM IDENT_sys
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->udf.name = $4; lex->udf.name = $4;
...@@ -1098,11 +1087,6 @@ create: ...@@ -1098,11 +1087,6 @@ create:
} }
; ;
ident_or_spfunc:
IDENT_sys { $$= $1; }
| SP_FUNC { $$= $1; }
;
create_function_tail: create_function_tail:
RETURNS_SYM udf_type UDF_SONAME_SYM TEXT_STRING_sys RETURNS_SYM udf_type UDF_SONAME_SYM TEXT_STRING_sys
{ {
...@@ -1219,7 +1203,7 @@ sp_suid: ...@@ -1219,7 +1203,7 @@ sp_suid:
; ;
call: call:
CALL_SYM ident_or_spfunc CALL_SYM IDENT_sys
{ {
LEX *lex = Lex; LEX *lex = Lex;
...@@ -3921,55 +3905,80 @@ simple_expr: ...@@ -3921,55 +3905,80 @@ simple_expr:
{ $$= new Item_func_round($3,$5,1); } { $$= new Item_func_round($3,$5,1); }
| TRUE_SYM | TRUE_SYM
{ $$= new Item_int((char*) "TRUE",1,1); } { $$= new Item_int((char*) "TRUE",1,1); }
| SP_FUNC '(' sp_expr_list ')' | IDENT_sys '(' udf_expr_list ')'
{
if (sp_function_exists(YYTHD, &$1))
{ {
sp_add_fun_to_lex(Lex, $1); LEX *lex= Lex;
sp_add_fun_to_lex(lex, $1);
if ($3) if ($3)
$$= new Item_func_sp($1, *$3); $$= new Item_func_sp($1, *$3);
else else
$$= new Item_func_sp($1); $$= new Item_func_sp($1);
} }
| UDA_CHAR_SUM '(' udf_expr_list ')' else
{
#ifdef HAVE_DLOPEN
udf_func *udf;
if (using_udf_functions && (udf=find_udf($1.str, $1.length)))
{
switch (udf->returns) {
case STRING_RESULT:
if (udf->type == UDFTYPE_FUNCTION)
{ {
if ($3 != NULL) if ($3 != NULL)
$$ = new Item_sum_udf_str($1, *$3); $$ = new Item_func_udf_str(udf, *$3);
else else
$$ = new Item_sum_udf_str($1); $$ = new Item_func_udf_str(udf);
} }
| UDA_FLOAT_SUM '(' udf_expr_list ')' else
{ {
if ($3 != NULL) if ($3 != NULL)
$$ = new Item_sum_udf_float($1, *$3); $$ = new Item_sum_udf_str(udf, *$3);
else else
$$ = new Item_sum_udf_float($1); $$ = new Item_sum_udf_str(udf);
} }
| UDA_INT_SUM '(' udf_expr_list ')' break;
case REAL_RESULT:
if (udf->type == UDFTYPE_FUNCTION)
{ {
if ($3 != NULL) if ($3 != NULL)
$$ = new Item_sum_udf_int($1, *$3); $$ = new Item_func_udf_float(udf, *$3);
else else
$$ = new Item_sum_udf_int($1); $$ = new Item_func_udf_float(udf);
} }
| UDF_CHAR_FUNC '(' udf_expr_list ')' else
{ {
if ($3 != NULL) if ($3 != NULL)
$$ = new Item_func_udf_str($1, *$3); $$ = new Item_sum_udf_float(udf, *$3);
else else
$$ = new Item_func_udf_str($1); $$ = new Item_sum_udf_float(udf);
} }
| UDF_FLOAT_FUNC '(' udf_expr_list ')' break;
case INT_RESULT:
if (udf->type == UDFTYPE_FUNCTION)
{ {
if ($3 != NULL) if ($3 != NULL)
$$ = new Item_func_udf_float($1, *$3); $$ = new Item_func_udf_int(udf, *$3);
else else
$$ = new Item_func_udf_float($1); $$ = new Item_func_udf_int(udf);
} }
| UDF_INT_FUNC '(' udf_expr_list ')' else
{ {
if ($3 != NULL) if ($3 != NULL)
$$ = new Item_func_udf_int($1, *$3); $$ = new Item_sum_udf_int(udf, *$3);
else else
$$ = new Item_func_udf_int($1); $$ = new Item_sum_udf_int(udf);
}
break;
default:
YYABORT;
}
}
#endif /* HAVE_DLOPEN */
}
} }
| UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' expr_list ')' | UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' expr_list ')'
{ {
...@@ -4077,10 +4086,6 @@ fulltext_options: ...@@ -4077,10 +4086,6 @@ fulltext_options:
| IN_SYM BOOLEAN_SYM MODE_SYM { $$= FT_BOOL; } | IN_SYM BOOLEAN_SYM MODE_SYM { $$= FT_BOOL; }
; ;
sp_expr_list:
/* empty */ { $$= NULL; }
| expr_list { $$= $1;};
udf_expr_list: udf_expr_list:
/* empty */ { $$= NULL; } /* empty */ { $$= NULL; }
| udf_expr_list2 { $$= $1;} | udf_expr_list2 { $$= $1;}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment