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

Merge from 4.1.

parents 87fbeb40 e0061c6a
...@@ -6,6 +6,7 @@ FROM=$USER@mysql.com ...@@ -6,6 +6,7 @@ FROM=$USER@mysql.com
INTERNALS=internals@lists.mysql.com INTERNALS=internals@lists.mysql.com
DOCS=docs-commit@mysql.com DOCS=docs-commit@mysql.com
LIMIT=10000 LIMIT=10000
REPOV=5.0
if [ "$REAL_EMAIL" = "" ] if [ "$REAL_EMAIL" = "" ]
then then
...@@ -25,15 +26,15 @@ then ...@@ -25,15 +26,15 @@ then
echo "Commit successful, notifying developers at $TO" echo "Commit successful, notifying developers at $TO"
( (
cat <<EOF cat <<EOF
List-ID: <bk.mysql-4.1> List-ID: <bk.mysql-$REPOV>
From: $FROM From: $FROM
To: $TO To: $TO
Subject: bk commit - 4.1 tree Subject: bk commit - $REPOV tree
EOF EOF
bk changes -v -r+ bk changes -v -r+
bk cset -r+ -d bk cset -r+ -d
) | head -n $LIMIT | /usr/sbin/sendmail -t ) | /usr/sbin/sendmail -t
#++ #++
# internals@ mail # internals@ mail
...@@ -41,13 +42,13 @@ EOF ...@@ -41,13 +42,13 @@ EOF
echo "Notifying internals list at $INTERNALS" echo "Notifying internals list at $INTERNALS"
( (
cat <<EOF cat <<EOF
List-ID: <bk.mysql-4.1> List-ID: <bk.mysql-$REPOV>
From: $FROM From: $FROM
To: $INTERNALS To: $INTERNALS
Subject: bk commit into 4.1 tree Subject: bk commit into $REPOV tree
Below is the list of changes that have just been committed into a local Below is the list of changes that have just been committed into a local
4.1 repository of $USER. When $USER does a push these changes will $REPOV repository of $USER. When $USER does a push these changes will
be propagated to the main repository and, within 24 hours after the be propagated to the main repository and, within 24 hours after the
push, to the public repository. push, to the public repository.
For information on how to access the public repository For information on how to access the public repository
...@@ -68,15 +69,15 @@ EOF ...@@ -68,15 +69,15 @@ EOF
echo "Notifying docs list at $DOCS" echo "Notifying docs list at $DOCS"
( (
cat <<EOF cat <<EOF
List-ID: <bk.mysql-4.1> List-ID: <bk.mysql-$REPOV>
From: $FROM From: $FROM
To: $DOCS To: $DOCS
Subject: bk commit - 4.1 tree (Manual) Subject: bk commit - $REPOV tree (Manual)
EOF EOF
bk changes -v -r+ bk changes -v -r+
bk cset -r+ -d bk cset -r+ -d
) | head -n $LIMIT | /usr/sbin/sendmail -t ) | /usr/sbin/sendmail -t
fi fi
else else
......
...@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. ...@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc) AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 4.1.0-alpha) AM_INIT_AUTOMAKE(mysql, 5.0.0-alpha)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
......
...@@ -688,7 +688,8 @@ query: ...@@ -688,7 +688,8 @@ query:
thd->lex.sql_command = SQLCOM_EMPTY_QUERY; thd->lex.sql_command = SQLCOM_EMPTY_QUERY;
} }
} }
| verb_clause END_OF_INPUT {}; | verb_clause END_OF_INPUT {}
;
verb_clause: verb_clause:
alter alter
...@@ -727,7 +728,8 @@ verb_clause: ...@@ -727,7 +728,8 @@ verb_clause:
| unlock | unlock
| update | update
| use | use
| help; | help
;
/* help */ /* help */
...@@ -737,7 +739,8 @@ help: ...@@ -737,7 +739,8 @@ help:
LEX *lex= Lex; LEX *lex= Lex;
lex->sql_command= SQLCOM_HELP; lex->sql_command= SQLCOM_HELP;
lex->help_arg= $2.str; lex->help_arg= $2.str;
}; }
;
/* change master */ /* change master */
...@@ -747,11 +750,13 @@ change: ...@@ -747,11 +750,13 @@ change:
LEX *lex = Lex; LEX *lex = Lex;
lex->sql_command = SQLCOM_CHANGE_MASTER; lex->sql_command = SQLCOM_CHANGE_MASTER;
bzero((char*) &lex->mi, sizeof(lex->mi)); bzero((char*) &lex->mi, sizeof(lex->mi));
} master_defs; } master_defs
;
master_defs: master_defs:
master_def master_def
| master_defs ',' master_def; | master_defs ',' master_def
;
master_def: master_def:
MASTER_HOST_SYM EQ TEXT_STRING MASTER_HOST_SYM EQ TEXT_STRING
...@@ -800,7 +805,6 @@ master_def: ...@@ -800,7 +805,6 @@ master_def:
} }
; ;
/* create a table */ /* create a table */
create: create:
...@@ -889,26 +893,32 @@ create3: ...@@ -889,26 +893,32 @@ create3:
opt_as: opt_as:
/* empty */ {} /* empty */ {}
| AS {}; | AS {}
;
opt_table_options: opt_table_options:
/* empty */ { $$= 0; } /* empty */ { $$= 0; }
| table_options { $$= $1;}; | table_options { $$= $1;}
;
table_options: table_options:
table_option { $$=$1; } table_option { $$=$1; }
| table_option table_options { $$= $1 | $2; }; | table_option table_options { $$= $1 | $2; }
;
table_option: table_option:
TEMPORARY { $$=HA_LEX_CREATE_TMP_TABLE; }; TEMPORARY { $$=HA_LEX_CREATE_TMP_TABLE; }
;
opt_if_not_exists: opt_if_not_exists:
/* empty */ { $$= 0; } /* empty */ { $$= 0; }
| IF NOT EXISTS { $$=HA_LEX_CREATE_IF_NOT_EXISTS; }; | IF NOT EXISTS { $$=HA_LEX_CREATE_IF_NOT_EXISTS; }
;
opt_create_table_options: opt_create_table_options:
/* empty */ /* empty */
| create_table_options; | create_table_options
;
create_table_options_space_separated: create_table_options_space_separated:
create_table_option create_table_option
...@@ -916,8 +926,9 @@ create_table_options_space_separated: ...@@ -916,8 +926,9 @@ create_table_options_space_separated:
create_table_options: create_table_options:
create_table_option create_table_option
| create_table_option create_table_options; | create_table_option create_table_options
| create_table_option ',' create_table_options; | create_table_option ',' create_table_options
;
create_table_option: create_table_option:
TYPE_SYM opt_equal table_types { Lex->create_info.db_type= $3; } TYPE_SYM opt_equal table_types { Lex->create_info.db_type= $3; }
...@@ -968,41 +979,48 @@ table_types: ...@@ -968,41 +979,48 @@ table_types:
| MERGE_SYM { $$= DB_TYPE_MRG_MYISAM; } | MERGE_SYM { $$= DB_TYPE_MRG_MYISAM; }
| HEAP_SYM { $$= DB_TYPE_HEAP; } | HEAP_SYM { $$= DB_TYPE_HEAP; }
| BERKELEY_DB_SYM { $$= DB_TYPE_BERKELEY_DB; } | BERKELEY_DB_SYM { $$= DB_TYPE_BERKELEY_DB; }
| INNOBASE_SYM { $$= DB_TYPE_INNODB; }; | INNOBASE_SYM { $$= DB_TYPE_INNODB; }
;
row_types: row_types:
DEFAULT { $$= ROW_TYPE_DEFAULT; } DEFAULT { $$= ROW_TYPE_DEFAULT; }
| FIXED_SYM { $$= ROW_TYPE_FIXED; } | FIXED_SYM { $$= ROW_TYPE_FIXED; }
| DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; } | DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; }
| COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; }; | COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; }
;
raid_types: raid_types:
RAID_STRIPED_SYM { $$= RAID_TYPE_0; } RAID_STRIPED_SYM { $$= RAID_TYPE_0; }
| RAID_0_SYM { $$= RAID_TYPE_0; } | RAID_0_SYM { $$= RAID_TYPE_0; }
| ULONG_NUM { $$=$1;}; | ULONG_NUM { $$=$1; }
;
merge_insert_types: merge_insert_types:
NO_SYM { $$= MERGE_INSERT_DISABLED; } NO_SYM { $$= MERGE_INSERT_DISABLED; }
| FIRST_SYM { $$= MERGE_INSERT_TO_FIRST; } | FIRST_SYM { $$= MERGE_INSERT_TO_FIRST; }
| LAST_SYM { $$= MERGE_INSERT_TO_LAST; }; | LAST_SYM { $$= MERGE_INSERT_TO_LAST; }
;
opt_select_from: opt_select_from:
opt_limit_clause {} opt_limit_clause {}
| select_from select_lock_type; | select_from select_lock_type
;
udf_func_type: udf_func_type:
/* empty */ { $$ = UDFTYPE_FUNCTION; } /* empty */ { $$ = UDFTYPE_FUNCTION; }
| AGGREGATE_SYM { $$ = UDFTYPE_AGGREGATE; }; | AGGREGATE_SYM { $$ = UDFTYPE_AGGREGATE; }
;
udf_type: udf_type:
STRING_SYM {$$ = (int) STRING_RESULT; } STRING_SYM {$$ = (int) STRING_RESULT; }
| REAL {$$ = (int) REAL_RESULT; } | REAL {$$ = (int) REAL_RESULT; }
| INT_SYM {$$ = (int) INT_RESULT; }; | INT_SYM {$$ = (int) INT_RESULT; }
;
field_list: field_list:
field_list_item field_list_item
| field_list ',' field_list_item; | field_list ',' field_list_item
;
field_list_item: field_list_item:
field_spec check_constraint field_spec check_constraint
...@@ -1040,7 +1058,8 @@ check_constraint: ...@@ -1040,7 +1058,8 @@ check_constraint:
opt_constraint: opt_constraint:
/* empty */ /* empty */
| CONSTRAINT opt_ident; | CONSTRAINT opt_ident
;
field_spec: field_spec:
field_ident field_ident
...@@ -1059,7 +1078,8 @@ field_spec: ...@@ -1059,7 +1078,8 @@ field_spec:
lex->default_value, lex->comment, lex->default_value, lex->comment,
lex->change,lex->interval,lex->charset)) lex->change,lex->interval,lex->charset))
YYABORT; YYABORT;
}; }
;
type: type:
int_type opt_len field_options { $$=$1; } int_type opt_len field_options { $$=$1; }
...@@ -1141,64 +1161,76 @@ type: ...@@ -1141,64 +1161,76 @@ type:
char: char:
CHAR_SYM {} CHAR_SYM {}
| NCHAR_SYM {} | NCHAR_SYM {}
| NATIONAL_SYM CHAR_SYM {}; | NATIONAL_SYM CHAR_SYM {}
;
varchar: varchar:
char VARYING {} char VARYING {}
| VARCHAR {} | VARCHAR {}
| NATIONAL_SYM VARCHAR {} | NATIONAL_SYM VARCHAR {}
| NCHAR_SYM VARCHAR {}; | NCHAR_SYM VARCHAR {}
;
int_type: int_type:
INT_SYM { $$=FIELD_TYPE_LONG; } INT_SYM { $$=FIELD_TYPE_LONG; }
| TINYINT { $$=FIELD_TYPE_TINY; } | TINYINT { $$=FIELD_TYPE_TINY; }
| SMALLINT { $$=FIELD_TYPE_SHORT; } | SMALLINT { $$=FIELD_TYPE_SHORT; }
| MEDIUMINT { $$=FIELD_TYPE_INT24; } | MEDIUMINT { $$=FIELD_TYPE_INT24; }
| BIGINT { $$=FIELD_TYPE_LONGLONG; }; | BIGINT { $$=FIELD_TYPE_LONGLONG; }
;
real_type: real_type:
REAL { $$= YYTHD->sql_mode & MODE_REAL_AS_FLOAT ? REAL { $$= YYTHD->sql_mode & MODE_REAL_AS_FLOAT ?
FIELD_TYPE_FLOAT : FIELD_TYPE_DOUBLE; } FIELD_TYPE_FLOAT : FIELD_TYPE_DOUBLE; }
| DOUBLE_SYM { $$=FIELD_TYPE_DOUBLE; } | DOUBLE_SYM { $$=FIELD_TYPE_DOUBLE; }
| DOUBLE_SYM PRECISION { $$=FIELD_TYPE_DOUBLE; }; | DOUBLE_SYM PRECISION { $$=FIELD_TYPE_DOUBLE; }
;
float_options: float_options:
/* empty */ {} /* empty */ {}
| '(' NUM ')' { Lex->length=$2.str; } | '(' NUM ')' { Lex->length=$2.str; }
| precision {}; | precision {}
;
precision: precision:
'(' NUM ',' NUM ')' '(' NUM ',' NUM ')'
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->length=$2.str; lex->dec=$4.str; lex->length=$2.str; lex->dec=$4.str;
}; }
;
field_options: field_options:
/* empty */ {} /* empty */ {}
| field_opt_list {}; | field_opt_list {}
;
field_opt_list: field_opt_list:
field_opt_list field_option {} field_opt_list field_option {}
| field_option {}; | field_option {}
;
field_option: field_option:
SIGNED_SYM {} SIGNED_SYM {}
| UNSIGNED { Lex->type|= UNSIGNED_FLAG;} | UNSIGNED { Lex->type|= UNSIGNED_FLAG;}
| ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; }; | ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
;
opt_len: opt_len:
/* empty */ { Lex->length=(char*) 0; } /* use default length */ /* empty */ { Lex->length=(char*) 0; } /* use default length */
| '(' NUM ')' { Lex->length= $2.str; }; | '(' NUM ')' { Lex->length= $2.str; }
;
opt_precision: opt_precision:
/* empty */ {} /* empty */ {}
| precision {}; | precision {}
;
opt_attribute: opt_attribute:
/* empty */ {} /* empty */ {}
| opt_attribute_list {}; | opt_attribute_list {}
;
opt_attribute_list: opt_attribute_list:
opt_attribute_list attribute {} opt_attribute_list attribute {}
...@@ -1214,8 +1246,8 @@ attribute: ...@@ -1214,8 +1246,8 @@ attribute:
| opt_primary KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; } | opt_primary KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; }
| UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; } | UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; }
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; } | UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }
| COMMENT_SYM text_literal { Lex->comment= $2; }; | COMMENT_SYM text_literal { Lex->comment= $2; }
;
charset_name: charset_name:
BINARY BINARY
...@@ -1233,26 +1265,30 @@ charset_name: ...@@ -1233,26 +1265,30 @@ charset_name:
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str); net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str);
YYABORT; YYABORT;
} }
}; }
;
charset_name_or_default: charset_name_or_default:
charset_name { $$=$1; } charset_name { $$=$1; }
| DEFAULT { $$=NULL; } ; | DEFAULT { $$=NULL; }
;
opt_default: opt_default:
/* empty */ {} /* empty */ {}
| DEFAULT {}; | DEFAULT {}
;
opt_db_default_character_set: opt_db_default_character_set:
/* empty */ { $$=default_charset_info; } /* empty */ { $$=default_charset_info; }
| opt_default CHAR_SYM SET charset_name_or_default { $$=$4; } | opt_default CHAR_SYM SET charset_name_or_default { $$=$4; }
| opt_default CHARSET charset_name_or_default { $$=$3; }; | opt_default CHARSET charset_name_or_default { $$=$3; }
;
opt_binary: opt_binary:
/* empty */ { Lex->charset=NULL; } /* empty */ { Lex->charset=NULL; }
| BYTE_SYM { Lex->charset=my_charset_bin; } | BYTE_SYM { Lex->charset=my_charset_bin; }
| BINARY { Lex->charset=my_charset_bin; } | BINARY { Lex->charset=my_charset_bin; }
| CHAR_SYM SET charset_name { Lex->charset=$3; } ; | CHAR_SYM SET charset_name { Lex->charset=$3; }
opt_primary: opt_primary:
...@@ -1270,38 +1306,45 @@ references: ...@@ -1270,38 +1306,45 @@ references:
opt_ref_list opt_ref_list
{ {
$$=$2; $$=$2;
}; }
;
opt_ref_list: opt_ref_list:
/* empty */ opt_on_delete {} /* empty */ opt_on_delete {}
| '(' ref_list ')' opt_on_delete {}; | '(' ref_list ')' opt_on_delete {}
;
ref_list: ref_list:
ref_list ',' ident { Lex->ref_list.push_back(new key_part_spec($3.str)); } ref_list ',' ident { Lex->ref_list.push_back(new key_part_spec($3.str)); }
| ident { Lex->ref_list.push_back(new key_part_spec($1.str)); }; | ident { Lex->ref_list.push_back(new key_part_spec($1.str)); }
;
opt_on_delete: opt_on_delete:
/* empty */ {} /* empty */ {}
| opt_on_delete_list {}; | opt_on_delete_list {}
;
opt_on_delete_list: opt_on_delete_list:
opt_on_delete_list opt_on_delete_item {} opt_on_delete_list opt_on_delete_item {}
| opt_on_delete_item {}; | opt_on_delete_item {}
;
opt_on_delete_item: opt_on_delete_item:
ON DELETE_SYM delete_option { Lex->fk_delete_opt= $3; } ON DELETE_SYM delete_option { Lex->fk_delete_opt= $3; }
| ON UPDATE_SYM delete_option { Lex->fk_update_opt= $3; } | ON UPDATE_SYM delete_option { Lex->fk_update_opt= $3; }
| MATCH FULL { Lex->fk_match_option= foreign_key::FK_MATCH_FULL; } | MATCH FULL { Lex->fk_match_option= foreign_key::FK_MATCH_FULL; }
| MATCH PARTIAL { Lex->fk_match_option= foreign_key::FK_MATCH_PARTIAL; } | MATCH PARTIAL { Lex->fk_match_option= foreign_key::FK_MATCH_PARTIAL; }
| MATCH SIMPLE_SYM { Lex->fk_match_option= foreign_key::FK_MATCH_SIMPLE; }; | MATCH SIMPLE_SYM { Lex->fk_match_option= foreign_key::FK_MATCH_SIMPLE; }
;
delete_option: delete_option:
RESTRICT { $$= (int) foreign_key::FK_OPTION_RESTRICT; } RESTRICT { $$= (int) foreign_key::FK_OPTION_RESTRICT; }
| CASCADE { $$= (int) foreign_key::FK_OPTION_CASCADE; } | CASCADE { $$= (int) foreign_key::FK_OPTION_CASCADE; }
| SET NULL_SYM { $$= (int) foreign_key::FK_OPTION_SET_NULL; } | SET NULL_SYM { $$= (int) foreign_key::FK_OPTION_SET_NULL; }
| NO_SYM ACTION { $$= (int) foreign_key::FK_OPTION_NO_ACTION; } | NO_SYM ACTION { $$= (int) foreign_key::FK_OPTION_NO_ACTION; }
| SET DEFAULT { $$= (int) foreign_key::FK_OPTION_DEFAULT; }; | SET DEFAULT { $$= (int) foreign_key::FK_OPTION_DEFAULT; }
;
key_type: key_type:
opt_constraint PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; } opt_constraint PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; }
...@@ -1311,46 +1354,56 @@ key_type: ...@@ -1311,46 +1354,56 @@ key_type:
| SPATIAL_SYM { $$= Key::SPATIAL; } | SPATIAL_SYM { $$= Key::SPATIAL; }
| SPATIAL_SYM key_or_index { $$= Key::SPATIAL; } | SPATIAL_SYM key_or_index { $$= Key::SPATIAL; }
| opt_constraint UNIQUE_SYM { $$= Key::UNIQUE; } | opt_constraint UNIQUE_SYM { $$= Key::UNIQUE; }
| opt_constraint UNIQUE_SYM key_or_index { $$= Key::UNIQUE; }; | opt_constraint UNIQUE_SYM key_or_index { $$= Key::UNIQUE; }
;
key_or_index: key_or_index:
KEY_SYM {} KEY_SYM {}
| INDEX {}; | INDEX {}
;
keys_or_index: keys_or_index:
KEYS {} KEYS {}
| INDEX {} | INDEX {}
| INDEXES {}; | INDEXES {}
;
opt_unique_or_fulltext: opt_unique_or_fulltext:
/* empty */ { $$= Key::MULTIPLE; } /* empty */ { $$= Key::MULTIPLE; }
| UNIQUE_SYM { $$= Key::UNIQUE; } | UNIQUE_SYM { $$= Key::UNIQUE; }
| SPATIAL_SYM { $$= Key::SPATIAL; }; | SPATIAL_SYM { $$= Key::SPATIAL; }
;
key_alg: key_alg:
/* empty */ { $$= HA_KEY_ALG_UNDEF; } /* empty */ { $$= HA_KEY_ALG_UNDEF; }
| USING opt_btree_or_rtree { $$= $2; }; | USING opt_btree_or_rtree { $$= $2; }
;
opt_btree_or_rtree: opt_btree_or_rtree:
BTREE_SYM { $$= HA_KEY_ALG_BTREE; } BTREE_SYM { $$= HA_KEY_ALG_BTREE; }
| RTREE_SYM { $$= HA_KEY_ALG_RTREE; } | RTREE_SYM { $$= HA_KEY_ALG_RTREE; }
| HASH_SYM { $$= HA_KEY_ALG_HASH; }; | HASH_SYM { $$= HA_KEY_ALG_HASH; }
;
key_list: key_list:
key_list ',' key_part order_dir { Lex->col_list.push_back($3); } key_list ',' key_part order_dir { Lex->col_list.push_back($3); }
| key_part order_dir { Lex->col_list.push_back($1); }; | key_part order_dir { Lex->col_list.push_back($1); }
;
key_part: key_part:
ident { $$=new key_part_spec($1.str); } ident { $$=new key_part_spec($1.str); }
| ident '(' NUM ')' { $$=new key_part_spec($1.str,(uint) atoi($3.str)); }; | ident '(' NUM ')' { $$=new key_part_spec($1.str,(uint) atoi($3.str)); }
;
opt_ident: opt_ident:
/* empty */ { $$=(char*) 0; } /* Defaultlength */ /* empty */ { $$=(char*) 0; } /* Defaultlength */
| field_ident { $$=$1.str; }; | field_ident { $$=$1.str; }
;
string_list: string_list:
text_string { Lex->interval_list.push_back($1); } text_string { Lex->interval_list.push_back($1); }
| string_list ',' text_string { Lex->interval_list.push_back($3); }; | string_list ',' text_string { Lex->interval_list.push_back($3); }
;
/* /*
** Alter table ** Alter table
...@@ -1380,23 +1433,24 @@ alter: ...@@ -1380,23 +1433,24 @@ alter:
lex->alter_keys_onoff=LEAVE_AS_IS; lex->alter_keys_onoff=LEAVE_AS_IS;
lex->simple_alter=1; lex->simple_alter=1;
} }
alter_list; alter_list
| ALTER DATABASE ident opt_db_default_character_set | ALTER DATABASE ident opt_db_default_character_set
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command=SQLCOM_ALTER_DB; lex->sql_command=SQLCOM_ALTER_DB;
lex->name=$3.str; lex->name=$3.str;
lex->create_info.table_charset=$4; lex->create_info.table_charset=$4;
}; }
;
alter_list: alter_list:
| alter_list_item | alter_list_item
| alter_list ',' alter_list_item; | alter_list ',' alter_list_item
;
add_column: add_column:
ADD opt_column { Lex->change=0; }; ADD opt_column { Lex->change=0; }
;
alter_list_item: alter_list_item:
add_column field_list_item opt_place { Lex->simple_alter=0; } add_column field_list_item opt_place { Lex->simple_alter=0; }
...@@ -1465,32 +1519,37 @@ alter_list_item: ...@@ -1465,32 +1519,37 @@ alter_list_item:
lex->name= $3->table.str; lex->name= $3->table.str;
} }
| create_table_options_space_separated { Lex->simple_alter=0; } | create_table_options_space_separated { Lex->simple_alter=0; }
| order_clause { Lex->simple_alter=0; }; | order_clause { Lex->simple_alter=0; }
;
opt_column: opt_column:
/* empty */ {} /* empty */ {}
| COLUMN_SYM {}; | COLUMN_SYM {}
;
opt_ignore: opt_ignore:
/* empty */ { Lex->duplicates=DUP_ERROR; } /* empty */ { Lex->duplicates=DUP_ERROR; }
| IGNORE_SYM { Lex->duplicates=DUP_IGNORE; }; | IGNORE_SYM { Lex->duplicates=DUP_IGNORE; }
;
opt_restrict: opt_restrict:
/* empty */ {} /* empty */ {}
| RESTRICT {} | RESTRICT {}
| CASCADE {}; | CASCADE {}
;
opt_place: opt_place:
/* empty */ {} /* empty */ {}
| AFTER_SYM ident { store_position_for_column($2.str); } | AFTER_SYM ident { store_position_for_column($2.str); }
| FIRST_SYM { store_position_for_column(first_keyword); }; | FIRST_SYM { store_position_for_column(first_keyword); }
;
opt_to: opt_to:
/* empty */ {} /* empty */ {}
| TO_SYM {} | TO_SYM {}
| EQ {} | EQ {}
| AS {}; | AS {}
;
/* /*
The first two deprecate the last two--delete the last two for 4.1 release The first two deprecate the last two--delete the last two for 4.1 release
*/ */
...@@ -1512,7 +1571,8 @@ slave: ...@@ -1512,7 +1571,8 @@ slave:
slave_thread_opts: slave_thread_opts:
slave_thread_opt slave_thread_opt
| slave_thread_opts ',' slave_thread_opt; | slave_thread_opts ',' slave_thread_opt
;
slave_thread_opt: slave_thread_opt:
/*empty*/ {} /*empty*/ {}
...@@ -1528,7 +1588,8 @@ restore: ...@@ -1528,7 +1588,8 @@ restore:
table_list FROM TEXT_STRING table_list FROM TEXT_STRING
{ {
Lex->backup_dir = $6.str; Lex->backup_dir = $6.str;
}; }
;
backup: backup:
BACKUP_SYM table_or_tables BACKUP_SYM table_or_tables
...@@ -1538,7 +1599,8 @@ backup: ...@@ -1538,7 +1599,8 @@ backup:
table_list TO_SYM TEXT_STRING table_list TO_SYM TEXT_STRING
{ {
Lex->backup_dir = $6.str; Lex->backup_dir = $6.str;
}; }
;
repair: repair:
REPAIR table_or_tables REPAIR table_or_tables
...@@ -1547,20 +1609,24 @@ repair: ...@@ -1547,20 +1609,24 @@ repair:
lex->sql_command = SQLCOM_REPAIR; lex->sql_command = SQLCOM_REPAIR;
lex->check_opt.init(); lex->check_opt.init();
} }
table_list opt_mi_repair_type; table_list opt_mi_repair_type
;
opt_mi_repair_type: opt_mi_repair_type:
/* empty */ { Lex->check_opt.flags = T_MEDIUM; } /* empty */ { Lex->check_opt.flags = T_MEDIUM; }
| mi_repair_types {}; | mi_repair_types {}
;
mi_repair_types: mi_repair_types:
mi_repair_type {} mi_repair_type {}
| mi_repair_type mi_repair_types {}; | mi_repair_type mi_repair_types {}
;
mi_repair_type: mi_repair_type:
QUICK { Lex->check_opt.flags|= T_QUICK; } QUICK { Lex->check_opt.flags|= T_QUICK; }
| EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } | EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; }
| USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; }; | USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; }
;
analyze: analyze:
ANALYZE_SYM table_or_tables ANALYZE_SYM table_or_tables
...@@ -1569,7 +1635,8 @@ analyze: ...@@ -1569,7 +1635,8 @@ analyze:
lex->sql_command = SQLCOM_ANALYZE; lex->sql_command = SQLCOM_ANALYZE;
lex->check_opt.init(); lex->check_opt.init();
} }
table_list opt_mi_check_type; table_list opt_mi_check_type
;
check: check:
CHECK_SYM table_or_tables CHECK_SYM table_or_tables
...@@ -1578,22 +1645,26 @@ check: ...@@ -1578,22 +1645,26 @@ check:
lex->sql_command = SQLCOM_CHECK; lex->sql_command = SQLCOM_CHECK;
lex->check_opt.init(); lex->check_opt.init();
} }
table_list opt_mi_check_type; table_list opt_mi_check_type
;
opt_mi_check_type: opt_mi_check_type:
/* empty */ { Lex->check_opt.flags = T_MEDIUM; } /* empty */ { Lex->check_opt.flags = T_MEDIUM; }
| mi_check_types {}; | mi_check_types {}
;
mi_check_types: mi_check_types:
mi_check_type {} mi_check_type {}
| mi_check_type mi_check_types {}; | mi_check_type mi_check_types {}
;
mi_check_type: mi_check_type:
QUICK { Lex->check_opt.flags|= T_QUICK; } QUICK { Lex->check_opt.flags|= T_QUICK; }
| FAST_SYM { Lex->check_opt.flags|= T_FAST; } | FAST_SYM { Lex->check_opt.flags|= T_FAST; }
| MEDIUM_SYM { Lex->check_opt.flags|= T_MEDIUM; } | MEDIUM_SYM { Lex->check_opt.flags|= T_MEDIUM; }
| EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } | EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; }
| CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; }; | CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; }
;
optimize: optimize:
OPTIMIZE table_or_tables OPTIMIZE table_or_tables
...@@ -1602,18 +1673,21 @@ optimize: ...@@ -1602,18 +1673,21 @@ optimize:
lex->sql_command = SQLCOM_OPTIMIZE; lex->sql_command = SQLCOM_OPTIMIZE;
lex->check_opt.init(); lex->check_opt.init();
} }
table_list opt_mi_check_type; table_list opt_mi_check_type
;
rename: rename:
RENAME table_or_tables RENAME table_or_tables
{ {
Lex->sql_command=SQLCOM_RENAME_TABLE; Lex->sql_command=SQLCOM_RENAME_TABLE;
} }
table_to_table_list; table_to_table_list
;
table_to_table_list: table_to_table_list:
table_to_table table_to_table
| table_to_table_list ',' table_to_table; | table_to_table_list ',' table_to_table
;
table_to_table: table_to_table:
table_ident TO_SYM table_ident table_ident TO_SYM table_ident
...@@ -1622,7 +1696,8 @@ table_to_table: ...@@ -1622,7 +1696,8 @@ table_to_table:
if (!sl->add_table_to_list($1,NULL,1,TL_IGNORE) || if (!sl->add_table_to_list($1,NULL,1,TL_IGNORE) ||
!sl->add_table_to_list($3,NULL,1,TL_IGNORE)) !sl->add_table_to_list($3,NULL,1,TL_IGNORE))
YYABORT; YYABORT;
}; }
;
/* /*
Select : retrieve data from table Select : retrieve data from table
...@@ -1630,7 +1705,8 @@ table_to_table: ...@@ -1630,7 +1705,8 @@ table_to_table:
select: select:
select_init { Lex->sql_command=SQLCOM_SELECT; }; select_init { Lex->sql_command=SQLCOM_SELECT; }
;
/* Need select_init2 for subselects. */ /* Need select_init2 for subselects. */
select_init: select_init:
...@@ -1647,7 +1723,6 @@ select_init: ...@@ -1647,7 +1723,6 @@ select_init:
} }
/* select in braces, can't contain global parameters */ /* select in braces, can't contain global parameters */
sel->master_unit()->global_parameters= sel->master_unit()->global_parameters=
sel->master_unit();
} union_opt; } union_opt;
select_init2: select_init2:
...@@ -1670,7 +1745,8 @@ select_part2: ...@@ -1670,7 +1745,8 @@ select_part2:
lex->lock_option= TL_READ; /* Only for global SELECT */ lex->lock_option= TL_READ; /* Only for global SELECT */
mysql_init_select(lex); mysql_init_select(lex);
} }
select_options select_item_list select_into select_lock_type; select_options select_item_list select_into select_lock_type
;
select_into: select_into:
opt_limit_clause {} opt_limit_clause {}
...@@ -1681,18 +1757,22 @@ select_into: ...@@ -1681,18 +1757,22 @@ select_into:
| into | into
| select_from | select_from
| into select_from | into select_from
| select_from into; | select_from into
;
select_from: select_from:
FROM join_table_list where_clause group_clause having_clause opt_order_clause opt_limit_clause procedure_clause; FROM join_table_list where_clause group_clause having_clause opt_order_clause opt_limit_clause procedure_clause
;
select_options: select_options:
/* empty*/ /* empty*/
| select_option_list; | select_option_list
;
select_option_list: select_option_list:
select_option_list select_option select_option_list select_option
| select_option; | select_option
;
select_option: select_option:
STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; } STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; }
...@@ -1746,8 +1826,8 @@ select_item_list: ...@@ -1746,8 +1826,8 @@ select_item_list:
{ {
if (add_item_to_list(new Item_field(NULL,NULL,"*"))) if (add_item_to_list(new Item_field(NULL,NULL,"*")))
YYABORT; YYABORT;
}; }
;
select_item: select_item:
remember_name select_item2 remember_end select_alias remember_name select_item2 remember_end select_alias
...@@ -1758,32 +1838,39 @@ select_item: ...@@ -1758,32 +1838,39 @@ select_item:
$2->set_name($4.str); $2->set_name($4.str);
else if (!$2->name) else if (!$2->name)
$2->set_name($1,(uint) ($3 - $1)); $2->set_name($1,(uint) ($3 - $1));
}; }
;
remember_name: remember_name:
{ $$=(char*) Lex->tok_start; }; { $$=(char*) Lex->tok_start; }
;
remember_end: remember_end:
{ $$=(char*) Lex->tok_end; }; { $$=(char*) Lex->tok_end; }
;
select_item2: select_item2:
table_wild { $$=$1; } /* table.* */ table_wild { $$=$1; } /* table.* */
| expr { $$=$1; }; | expr { $$=$1; }
;
select_alias: select_alias:
{ $$.str=0;} { $$.str=0;}
| AS ident { $$=$2; } | AS ident { $$=$2; }
| AS TEXT_STRING { $$=$2; } | AS TEXT_STRING { $$=$2; }
| ident { $$=$1; } | ident { $$=$1; }
| TEXT_STRING { $$=$1; }; | TEXT_STRING { $$=$1; }
;
optional_braces: optional_braces:
/* empty */ {} /* empty */ {}
| '(' ')' {}; | '(' ')' {}
;
/* all possible expressions */ /* all possible expressions */
expr: expr_expr { $$= $1; } expr: expr_expr { $$= $1; }
| simple_expr { $$= $1; }; | simple_expr { $$= $1; }
;
comp_op: EQ { $$ = &comp_eq_creator; } comp_op: EQ { $$ = &comp_eq_creator; }
| GE { $$ = &comp_ge_creator; } | GE { $$ = &comp_ge_creator; }
...@@ -1851,7 +1938,8 @@ expr_expr: ...@@ -1851,7 +1938,8 @@ expr_expr:
| expr '-' INTERVAL_SYM expr interval | expr '-' INTERVAL_SYM expr interval
{ $$= new Item_date_add_interval($1,$4,$5,1); } { $$= new Item_date_add_interval($1,$4,$5,1); }
| expr COLLATE_SYM charset_name | expr COLLATE_SYM charset_name
{ $$= new Item_func_set_collation($1,$3); }; { $$= new Item_func_set_collation($1,$3); }
;
/* expressions that begin with 'expr' that do NOT follow IN_SYM */ /* expressions that begin with 'expr' that do NOT follow IN_SYM */
no_in_expr: no_in_expr:
...@@ -1896,7 +1984,8 @@ no_in_expr: ...@@ -1896,7 +1984,8 @@ no_in_expr:
{ $$= new Item_date_add_interval($1,$4,$5,0); } { $$= new Item_date_add_interval($1,$4,$5,0); }
| no_in_expr '-' INTERVAL_SYM expr interval | no_in_expr '-' INTERVAL_SYM expr interval
{ $$= new Item_date_add_interval($1,$4,$5,1); } { $$= new Item_date_add_interval($1,$4,$5,1); }
| simple_expr; | simple_expr
;
/* expressions that begin with 'expr' that does NOT follow AND */ /* expressions that begin with 'expr' that does NOT follow AND */
no_and_expr: no_and_expr:
...@@ -1950,7 +2039,8 @@ no_and_expr: ...@@ -1950,7 +2039,8 @@ no_and_expr:
{ $$= new Item_date_add_interval($1,$4,$5,0); } { $$= new Item_date_add_interval($1,$4,$5,0); }
| no_and_expr '-' INTERVAL_SYM expr interval | no_and_expr '-' INTERVAL_SYM expr interval
{ $$= new Item_date_add_interval($1,$4,$5,1); } { $$= new Item_date_add_interval($1,$4,$5,1); }
| simple_expr; | simple_expr
;
simple_expr: simple_expr:
simple_ident simple_ident
...@@ -2290,11 +2380,13 @@ simple_expr: ...@@ -2290,11 +2380,13 @@ simple_expr:
Lex->safe_to_cache_query=0; Lex->safe_to_cache_query=0;
} }
| EXTRACT_SYM '(' interval FROM expr ')' | EXTRACT_SYM '(' interval FROM expr ')'
{ $$=new Item_extract( $3, $5); }; { $$=new Item_extract( $3, $5); }
;
udf_expr_list: udf_expr_list:
/* empty */ { $$= NULL; } /* empty */ { $$= NULL; }
| expr_list { $$= $1;}; | expr_list { $$= $1; }
;
sum_expr: sum_expr:
AVG_SYM '(' in_sum_expr ')' AVG_SYM '(' in_sum_expr ')'
...@@ -2318,7 +2410,8 @@ sum_expr: ...@@ -2318,7 +2410,8 @@ sum_expr:
| STD_SYM '(' in_sum_expr ')' | STD_SYM '(' in_sum_expr ')'
{ $$=new Item_sum_std($3); } { $$=new Item_sum_std($3); }
| SUM_SYM '(' in_sum_expr ')' | SUM_SYM '(' in_sum_expr ')'
{ $$=new Item_sum_sum($3); }; { $$=new Item_sum_sum($3); }
;
in_sum_expr: in_sum_expr:
{ {
...@@ -2333,7 +2426,8 @@ in_sum_expr: ...@@ -2333,7 +2426,8 @@ in_sum_expr:
{ {
Select->select_lex()->in_sum_expr--; Select->select_lex()->in_sum_expr--;
$$=$2; $$=$2;
}; }
;
cast_type: cast_type:
BINARY { $$=ITEM_CAST_BINARY; } BINARY { $$=ITEM_CAST_BINARY; }
...@@ -2350,37 +2444,45 @@ cast_type: ...@@ -2350,37 +2444,45 @@ cast_type:
expr_list: expr_list:
{ Select->expr_list.push_front(new List<Item>); } { Select->expr_list.push_front(new List<Item>); }
expr_list2 expr_list2
{ $$= Select->expr_list.pop(); }; { $$= Select->expr_list.pop(); }
;
expr_list2: expr_list2:
expr { Select->expr_list.head()->push_back($1); } expr { Select->expr_list.head()->push_back($1); }
| expr_list2 ',' expr { Select->expr_list.head()->push_back($3); }; | expr_list2 ',' expr { Select->expr_list.head()->push_back($3); }
;
ident_list_arg: ident_list_arg:
ident_list { $$= $1; } ident_list { $$= $1; }
| '(' ident_list ')' { $$= $2; }; | '(' ident_list ')' { $$= $2; }
;
ident_list: ident_list:
{ Select->expr_list.push_front(new List<Item>); } { Select->expr_list.push_front(new List<Item>); }
ident_list2 ident_list2
{ $$= Select->expr_list.pop(); }; { $$= Select->expr_list.pop(); }
;
ident_list2: ident_list2:
simple_ident { Select->expr_list.head()->push_back($1); } simple_ident { Select->expr_list.head()->push_back($1); }
| ident_list2 ',' simple_ident { Select->expr_list.head()->push_back($3); }; | ident_list2 ',' simple_ident { Select->expr_list.head()->push_back($3); }
;
opt_expr: opt_expr:
/* empty */ { $$= NULL; } /* empty */ { $$= NULL; }
| expr { $$= $1; }; | expr { $$= $1; }
;
opt_else: opt_else:
/* empty */ { $$= NULL; } /* empty */ { $$= NULL; }
| ELSE expr { $$= $2; }; | ELSE expr { $$= $2; }
;
when_list: when_list:
{ Select->when_list.push_front(new List<Item>); } { Select->when_list.push_front(new List<Item>); }
when_list2 when_list2
{ $$= Select->when_list.pop(); }; { $$= Select->when_list.pop(); }
;
when_list2: when_list2:
expr THEN_SYM expr expr THEN_SYM expr
...@@ -2394,11 +2496,13 @@ when_list2: ...@@ -2394,11 +2496,13 @@ when_list2:
SELECT_LEX_NODE *sel=Select; SELECT_LEX_NODE *sel=Select;
sel->when_list.head()->push_back($3); sel->when_list.head()->push_back($3);
sel->when_list.head()->push_back($5); sel->when_list.head()->push_back($5);
}; }
;
opt_pad: opt_pad:
/* empty */ { $$=new Item_string(" ",1,default_charset_info); } /* empty */ { $$=new Item_string(" ",1,default_charset_info); }
| expr { $$=$1; }; | expr { $$=$1; }
;
join_table_list: join_table_list:
'(' join_table_list ')' { $$=$2; } '(' join_table_list ')' { $$=$2; }
...@@ -2441,12 +2545,14 @@ join_table_list: ...@@ -2441,12 +2545,14 @@ join_table_list:
| join_table_list NATURAL RIGHT opt_outer JOIN_SYM join_table_list | join_table_list NATURAL RIGHT opt_outer JOIN_SYM join_table_list
{ add_join_natural($6,$1); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$1; } { add_join_natural($6,$1); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$1; }
| join_table_list NATURAL JOIN_SYM join_table_list | join_table_list NATURAL JOIN_SYM join_table_list
{ add_join_natural($1,$4); $$=$4; }; { add_join_natural($1,$4); $$=$4; }
;
normal_join: normal_join:
',' {} ',' {}
| JOIN_SYM {} | JOIN_SYM {}
| CROSS JOIN_SYM {}; | CROSS JOIN_SYM {}
;
join_table: join_table:
{ {
...@@ -2473,7 +2579,8 @@ join_table: ...@@ -2473,7 +2579,8 @@ join_table:
add_table_to_list(new Table_ident(unit), $5, 0, add_table_to_list(new Table_ident(unit), $5, 0,
lex->lock_option))) lex->lock_option)))
YYABORT; YYABORT;
}; }
;
select_derived: select_derived:
{ {
...@@ -2490,7 +2597,8 @@ select_derived: ...@@ -2490,7 +2597,8 @@ select_derived:
opt_outer: opt_outer:
/* empty */ {} /* empty */ {}
| OUTER {}; | OUTER {}
;
opt_key_definition: opt_key_definition:
/* empty */ {} /* empty */ {}
...@@ -2505,12 +2613,14 @@ opt_key_definition: ...@@ -2505,12 +2613,14 @@ opt_key_definition:
SELECT_LEX *sel= Select->select_lex(); SELECT_LEX *sel= Select->select_lex();
sel->ignore_index= *$2; sel->ignore_index= *$2;
sel->ignore_index_ptr= &sel->ignore_index; sel->ignore_index_ptr= &sel->ignore_index;
}; }
;
key_usage_list: key_usage_list:
key_or_index { Select->select_lex()->interval_list.empty(); } key_or_index { Select->select_lex()->interval_list.empty(); }
'(' key_usage_list2 ')' '(' key_usage_list2 ')'
{ $$= &Select->select_lex()->interval_list; }; { $$= &Select->select_lex()->interval_list; }
;
key_usage_list2: key_usage_list2:
key_usage_list2 ',' ident key_usage_list2 ',' ident
...@@ -2524,7 +2634,8 @@ key_usage_list2: ...@@ -2524,7 +2634,8 @@ key_usage_list2:
| PRIMARY_SYM | PRIMARY_SYM
{ Select->select_lex()-> { Select->select_lex()->
interval_list.push_back(new String("PRIMARY", 7, interval_list.push_back(new String("PRIMARY", 7,
default_charset_info)); }; default_charset_info)); }
;
using_list: using_list:
ident ident
...@@ -2541,7 +2652,8 @@ using_list: ...@@ -2541,7 +2652,8 @@ using_list:
SELECT_LEX *sel= Select->select_lex(); SELECT_LEX *sel= Select->select_lex();
if (!($$= new Item_cond_and(new Item_func_eq(new Item_field(sel->db1,sel->table1,$3.str), new Item_field(sel->db2,sel->table2,$3.str)), $1))) if (!($$= new Item_cond_and(new Item_func_eq(new Item_field(sel->db1,sel->table1,$3.str), new Item_field(sel->db2,sel->table2,$3.str)), $1)))
YYABORT; YYABORT;
}; }
;
interval: interval:
DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; } DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; }
...@@ -2556,18 +2668,20 @@ interval: ...@@ -2556,18 +2668,20 @@ interval:
| MONTH_SYM { $$=INTERVAL_MONTH; } | MONTH_SYM { $$=INTERVAL_MONTH; }
| SECOND_SYM { $$=INTERVAL_SECOND; } | SECOND_SYM { $$=INTERVAL_SECOND; }
| YEAR_MONTH_SYM { $$=INTERVAL_YEAR_MONTH; } | YEAR_MONTH_SYM { $$=INTERVAL_YEAR_MONTH; }
| YEAR_SYM { $$=INTERVAL_YEAR; }; | YEAR_SYM { $$=INTERVAL_YEAR; }
;
table_alias: table_alias:
/* empty */ /* empty */
| AS | AS
| EQ; | EQ
;
opt_table_alias: opt_table_alias:
/* empty */ { $$=0; } /* empty */ { $$=0; }
| table_alias ident | table_alias ident
{ $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); }; { $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); }
;
where_clause: where_clause:
/* empty */ { Select->select_lex()->where= 0; } /* empty */ { Select->select_lex()->where= 0; }
...@@ -2592,7 +2706,8 @@ having_clause: ...@@ -2592,7 +2706,8 @@ having_clause:
opt_escape: opt_escape:
ESCAPE_SYM TEXT_STRING { $$= $2.str; } ESCAPE_SYM TEXT_STRING { $$= $2.str; }
| /* empty */ { $$= (char*) "\\"; }; | /* empty */ { $$= (char*) "\\"; }
;
/* /*
...@@ -2601,13 +2716,15 @@ opt_escape: ...@@ -2601,13 +2716,15 @@ opt_escape:
group_clause: group_clause:
/* empty */ /* empty */
| GROUP BY group_list olap_opt; | GROUP BY group_list olap_opt
;
group_list: group_list:
group_list ',' order_ident order_dir group_list ',' order_ident order_dir
{ if (add_group_to_list($3,(bool) $4)) YYABORT; } { if (add_group_to_list($3,(bool) $4)) YYABORT; }
| order_ident order_dir | order_ident order_dir
{ if (add_group_to_list($1,(bool) $2)) YYABORT; }; { if (add_group_to_list($1,(bool) $2)) YYABORT; }
;
olap_opt: olap_opt:
/* empty */ {} /* empty */ {}
...@@ -2647,7 +2764,8 @@ olap_opt: ...@@ -2647,7 +2764,8 @@ olap_opt:
opt_order_clause: opt_order_clause:
/* empty */ /* empty */
| order_clause; | order_clause
;
order_clause: order_clause:
ORDER_SYM BY ORDER_SYM BY
...@@ -2662,19 +2780,21 @@ order_clause: ...@@ -2662,19 +2780,21 @@ order_clause:
"ORDER BY"); "ORDER BY");
YYABORT; YYABORT;
} }
} order_list; } order_list
;
order_list: order_list:
order_list ',' order_ident order_dir order_list ',' order_ident order_dir
{ if (add_order_to_list($3,(bool) $4)) YYABORT; } { if (add_order_to_list($3,(bool) $4)) YYABORT; }
| order_ident order_dir | order_ident order_dir
{ if (add_order_to_list($1,(bool) $2)) YYABORT; }; { if (add_order_to_list($1,(bool) $2)) YYABORT; }
;
order_dir: order_dir:
/* empty */ { $$ = 1; } /* empty */ { $$ = 1; }
| ASC { $$ =1; } | ASC { $$ =1; }
| DESC { $$ =0; }; | DESC { $$ =0; }
;
opt_limit_clause: opt_limit_clause:
/* empty */ {} /* empty */ {}
...@@ -2714,7 +2834,6 @@ limit_options: ...@@ -2714,7 +2834,6 @@ limit_options:
} }
; ;
delete_limit_clause: delete_limit_clause:
/* empty */ /* empty */
{ {
...@@ -2722,20 +2841,23 @@ delete_limit_clause: ...@@ -2722,20 +2841,23 @@ delete_limit_clause:
lex->current_select->select_limit= HA_POS_ERROR; lex->current_select->select_limit= HA_POS_ERROR;
} }
| LIMIT ulonglong_num | LIMIT ulonglong_num
{ Select->select_limit= (ha_rows) $2; }; { Select->select_limit= (ha_rows) $2; }
;
ULONG_NUM: ULONG_NUM:
NUM { $$= strtoul($1.str,NULL,10); } NUM { $$= strtoul($1.str,NULL,10); }
| ULONGLONG_NUM { $$= (ulong) strtoull($1.str,NULL,10); } | ULONGLONG_NUM { $$= (ulong) strtoull($1.str,NULL,10); }
| REAL_NUM { $$= strtoul($1.str,NULL,10); } | REAL_NUM { $$= strtoul($1.str,NULL,10); }
| FLOAT_NUM { $$= strtoul($1.str,NULL,10); }; | FLOAT_NUM { $$= strtoul($1.str,NULL,10); }
;
ulonglong_num: ulonglong_num:
NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } NUM { $$= (ulonglong) strtoul($1.str,NULL,10); }
| ULONGLONG_NUM { $$= strtoull($1.str,NULL,10); } | ULONGLONG_NUM { $$= strtoull($1.str,NULL,10); }
| LONG_NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } | LONG_NUM { $$= (ulonglong) strtoul($1.str,NULL,10); }
| REAL_NUM { $$= strtoull($1.str,NULL,10); } | REAL_NUM { $$= strtoull($1.str,NULL,10); }
| FLOAT_NUM { $$= strtoull($1.str,NULL,10); }; | FLOAT_NUM { $$= strtoull($1.str,NULL,10); }
;
procedure_clause: procedure_clause:
/* empty */ /* empty */
...@@ -2749,16 +2871,18 @@ procedure_clause: ...@@ -2749,16 +2871,18 @@ procedure_clause:
YYABORT; YYABORT;
Lex->safe_to_cache_query=0; Lex->safe_to_cache_query=0;
} }
'(' procedure_list ')'; '(' procedure_list ')'
;
procedure_list: procedure_list:
/* empty */ {} /* empty */ {}
| procedure_list2 {}; | procedure_list2 {}
;
procedure_list2: procedure_list2:
procedure_list2 ',' procedure_item procedure_list2 ',' procedure_item
| procedure_item; | procedure_item
;
procedure_item: procedure_item:
remember_name expr remember_name expr
...@@ -2834,7 +2958,9 @@ do: DO_SYM ...@@ -2834,7 +2958,9 @@ do: DO_SYM
if (!(lex->insert_list = new List_item)) if (!(lex->insert_list = new List_item))
YYABORT; YYABORT;
} }
values; values
;
/* /*
Drop : delete tables or index Drop : delete tables or index
*/ */
...@@ -2869,16 +2995,19 @@ drop: ...@@ -2869,16 +2995,19 @@ drop:
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command = SQLCOM_DROP_FUNCTION; lex->sql_command = SQLCOM_DROP_FUNCTION;
lex->udf.name=$3.str; lex->udf.name=$3.str;
}; }
;
table_list: table_list:
table_name table_name
| table_list ',' table_name; | table_list ',' table_name
;
table_name: table_name:
table_ident table_ident
{ if (!Select->add_table_to_list($1, NULL, 1)) YYABORT; }; { if (!Select->add_table_to_list($1, NULL, 1)) YYABORT; }
;
if_exists: if_exists:
/* empty */ { $$= 0; } /* empty */ { $$= 0; }
...@@ -2935,7 +3064,8 @@ replace_lock_option: ...@@ -2935,7 +3064,8 @@ replace_lock_option:
insert2: insert2:
INTO insert_table {} INTO insert_table {}
| insert_table {}; | insert_table {}
;
insert_table: insert_table:
table_name table_name
...@@ -2944,7 +3074,8 @@ insert_table: ...@@ -2944,7 +3074,8 @@ insert_table:
lex->field_list.empty(); lex->field_list.empty();
lex->many_values.empty(); lex->many_values.empty();
lex->insert_list=0; lex->insert_list=0;
}; }
;
insert_field_spec: insert_field_spec:
opt_field_spec insert_values {} opt_field_spec insert_values {}
...@@ -2955,16 +3086,19 @@ insert_field_spec: ...@@ -2955,16 +3086,19 @@ insert_field_spec:
lex->many_values.push_back(lex->insert_list)) lex->many_values.push_back(lex->insert_list))
YYABORT; YYABORT;
} }
ident_eq_list; ident_eq_list
;
opt_field_spec: opt_field_spec:
/* empty */ { } /* empty */ { }
| '(' fields ')' { } | '(' fields ')' { }
| '(' ')' { }; | '(' ')' { }
;
fields: fields:
fields ',' insert_ident { Lex->field_list.push_back($3); } fields ',' insert_ident { Lex->field_list.push_back($3); }
| insert_ident { Lex->field_list.push_back($1); }; | insert_ident { Lex->field_list.push_back($1); }
;
insert_values: insert_values:
VALUES values_list {} VALUES values_list {}
...@@ -2983,12 +3117,14 @@ insert_values: ...@@ -2983,12 +3117,14 @@ insert_values:
values_list: values_list:
values_list ',' no_braces values_list ',' no_braces
| no_braces; | no_braces
;
ident_eq_list: ident_eq_list:
ident_eq_list ',' ident_eq_value ident_eq_list ',' ident_eq_value
| |
ident_eq_value; ident_eq_value
;
ident_eq_value: ident_eq_value:
simple_ident equal expr_or_default simple_ident equal expr_or_default
...@@ -2997,7 +3133,8 @@ ident_eq_value: ...@@ -2997,7 +3133,8 @@ ident_eq_value:
if (lex->field_list.push_back($1) || if (lex->field_list.push_back($1) ||
lex->insert_list->push_back($3)) lex->insert_list->push_back($3))
YYABORT; YYABORT;
}; }
;
equal: EQ {} equal: EQ {}
| SET_VAR {} | SET_VAR {}
...@@ -3019,11 +3156,13 @@ no_braces: ...@@ -3019,11 +3156,13 @@ no_braces:
LEX *lex=Lex; LEX *lex=Lex;
if (lex->many_values.push_back(lex->insert_list)) if (lex->many_values.push_back(lex->insert_list))
YYABORT; YYABORT;
}; }
;
opt_values: opt_values:
/* empty */ {} /* empty */ {}
| values; | values
;
values: values:
values ',' expr_or_default values ',' expr_or_default
...@@ -3086,7 +3225,8 @@ update_list: ...@@ -3086,7 +3225,8 @@ update_list:
{ {
if (add_item_to_list($1) || add_value_to_list($3)) if (add_item_to_list($1) || add_value_to_list($3))
YYABORT; YYABORT;
}; }
;
opt_low_priority: opt_low_priority:
/* empty */ { $$= YYTHD->update_lock_default; } /* empty */ { $$= YYTHD->update_lock_default; }
...@@ -3119,11 +3259,13 @@ single_multi: ...@@ -3119,11 +3259,13 @@ single_multi:
FROM join_table_list where_clause FROM join_table_list where_clause
| FROM table_wild_list | FROM table_wild_list
{ mysql_init_multi_delete(Lex); } { mysql_init_multi_delete(Lex); }
USING join_table_list where_clause; USING join_table_list where_clause
;
table_wild_list: table_wild_list:
table_wild_one {} table_wild_one {}
| table_wild_list ',' table_wild_one {}; | table_wild_list ',' table_wild_one {}
;
table_wild_one: table_wild_one:
ident opt_wild ident opt_wild
...@@ -3142,16 +3284,19 @@ table_wild_one: ...@@ -3142,16 +3284,19 @@ table_wild_one:
opt_wild: opt_wild:
/* empty */ {} /* empty */ {}
| '.' '*' {}; | '.' '*' {}
;
opt_delete_options: opt_delete_options:
/* empty */ {} /* empty */ {}
| opt_delete_option opt_delete_options {}; | opt_delete_option opt_delete_options {}
;
opt_delete_option: opt_delete_option:
QUICK { Select->options|= OPTION_QUICK; } QUICK { Select->options|= OPTION_QUICK; }
| LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; }; | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; }
;
truncate: truncate:
TRUNCATE_SYM opt_table_sym table_name TRUNCATE_SYM opt_table_sym table_name
...@@ -3160,12 +3305,14 @@ truncate: ...@@ -3160,12 +3305,14 @@ truncate:
lex->sql_command= SQLCOM_TRUNCATE; lex->sql_command= SQLCOM_TRUNCATE;
lex->select_lex.options= 0; lex->select_lex.options= 0;
lex->select_lex.init_order(); lex->select_lex.init_order();
lex->lock_option= lex->thd->update_lock_default;
} }
; ;
opt_table_sym: opt_table_sym:
/* empty */ /* empty */
| TABLE_SYM; | TABLE_SYM
;
/* Show things */ /* Show things */
...@@ -3175,7 +3322,9 @@ show: SHOW ...@@ -3175,7 +3322,9 @@ show: SHOW
lex->wild=0; lex->wild=0;
bzero((char*) &lex->create_info,sizeof(lex->create_info)); bzero((char*) &lex->create_info,sizeof(lex->create_info));
} }
show_param; show_param
;
show_param: show_param:
DATABASES wild DATABASES wild
...@@ -3307,31 +3456,38 @@ show_param: ...@@ -3307,31 +3456,38 @@ show_param:
| SLAVE STATUS_SYM | SLAVE STATUS_SYM
{ {
Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
}; }
;
opt_db: opt_db:
/* empty */ { $$= 0; } /* empty */ { $$= 0; }
| from_or_in ident { $$= $2.str; }; | from_or_in ident { $$= $2.str; }
;
wild: wild:
/* empty */ /* empty */
| LIKE text_string { Lex->wild= $2; }; | LIKE text_string { Lex->wild= $2; }
;
opt_full: opt_full:
/* empty */ { Lex->verbose=0; } /* empty */ { Lex->verbose=0; }
| FULL { Lex->verbose=1; }; | FULL { Lex->verbose=1; }
;
from_or_in: from_or_in:
FROM FROM
| IN_SYM; | IN_SYM
;
binlog_in: binlog_in:
/* empty */ { Lex->mi.log_file_name = 0; } /* empty */ { Lex->mi.log_file_name = 0; }
| IN_SYM TEXT_STRING { Lex->mi.log_file_name = $2.str; }; | IN_SYM TEXT_STRING { Lex->mi.log_file_name = $2.str; }
;
binlog_from: binlog_from:
/* empty */ { Lex->mi.pos = 4; /* skip magic number */ } /* empty */ { Lex->mi.pos = 4; /* skip magic number */ }
| FROM ulonglong_num { Lex->mi.pos = $2; }; | FROM ulonglong_num { Lex->mi.pos = $2; }
;
/* A Oracle compatible synonym for show */ /* A Oracle compatible synonym for show */
...@@ -3350,18 +3506,21 @@ describe: ...@@ -3350,18 +3506,21 @@ describe:
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->select_lex.options|= SELECT_DESCRIBE; lex->select_lex.options|= SELECT_DESCRIBE;
}; }
;
describe_command: describe_command:
DESC DESC
| DESCRIBE; | DESCRIBE
;
opt_describe_column: opt_describe_column:
/* empty */ {} /* empty */ {}
| text_string { Lex->wild= $1; } | text_string { Lex->wild= $1; }
| ident | ident
{ Lex->wild= new String((const char*) $1.str,$1.length,default_charset_info); }; { Lex->wild= new String((const char*) $1.str,$1.length,default_charset_info); }
;
/* flush things */ /* flush things */
...@@ -3372,11 +3531,13 @@ flush: ...@@ -3372,11 +3531,13 @@ flush:
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command= SQLCOM_FLUSH; lex->type=0; lex->sql_command= SQLCOM_FLUSH; lex->type=0;
} }
flush_options; flush_options
;
flush_options: flush_options:
flush_options ',' flush_option flush_options ',' flush_option
| flush_option; | flush_option
;
flush_option: flush_option:
table_or_tables { Lex->type|= REFRESH_TABLES; } opt_table_list table_or_tables { Lex->type|= REFRESH_TABLES; } opt_table_list
...@@ -3389,26 +3550,32 @@ flush_option: ...@@ -3389,26 +3550,32 @@ flush_option:
| SLAVE { Lex->type|= REFRESH_SLAVE; } | SLAVE { Lex->type|= REFRESH_SLAVE; }
| MASTER_SYM { Lex->type|= REFRESH_MASTER; } | MASTER_SYM { Lex->type|= REFRESH_MASTER; }
| DES_KEY_FILE { Lex->type|= REFRESH_DES_KEY_FILE; } | DES_KEY_FILE { Lex->type|= REFRESH_DES_KEY_FILE; }
| RESOURCES { Lex->type|= REFRESH_USER_RESOURCES; }; | RESOURCES { Lex->type|= REFRESH_USER_RESOURCES; }
;
opt_table_list: opt_table_list:
/* empty */ {;} /* empty */ {}
| table_list {;}; | table_list {}
;
reset: reset:
RESET_SYM RESET_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command= SQLCOM_RESET; lex->type=0; lex->sql_command= SQLCOM_RESET; lex->type=0;
} reset_options; } reset_options
;
reset_options: reset_options:
reset_options ',' reset_option reset_options ',' reset_option
| reset_option; | reset_option
;
reset_option: reset_option:
SLAVE { Lex->type|= REFRESH_SLAVE; } SLAVE { Lex->type|= REFRESH_SLAVE; }
| MASTER_SYM { Lex->type|= REFRESH_MASTER; } | MASTER_SYM { Lex->type|= REFRESH_MASTER; }
| QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;}; | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;}
;
purge: purge:
PURGE PURGE
...@@ -3420,7 +3587,8 @@ purge: ...@@ -3420,7 +3587,8 @@ purge:
MASTER_SYM LOGS_SYM TO_SYM TEXT_STRING MASTER_SYM LOGS_SYM TO_SYM TEXT_STRING
{ {
Lex->to_log = $6.str; Lex->to_log = $6.str;
} ; }
;
/* kill threads */ /* kill threads */
...@@ -3435,7 +3603,8 @@ kill: ...@@ -3435,7 +3603,8 @@ kill:
} }
lex->sql_command=SQLCOM_KILL; lex->sql_command=SQLCOM_KILL;
lex->thread_id= (ulong) $2->val_int(); lex->thread_id= (ulong) $2->val_int();
}; }
;
/* change database */ /* change database */
...@@ -3444,7 +3613,8 @@ use: USE_SYM ident ...@@ -3444,7 +3613,8 @@ use: USE_SYM ident
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command=SQLCOM_CHANGE_DB; lex->sql_command=SQLCOM_CHANGE_DB;
lex->select_lex.db= $2.str; lex->select_lex.db= $2.str;
}; }
;
/* import, export of files */ /* import, export of files */
...@@ -3476,11 +3646,13 @@ load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING ...@@ -3476,11 +3646,13 @@ load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING
LOAD DATA_SYM FROM MASTER_SYM LOAD DATA_SYM FROM MASTER_SYM
{ {
Lex->sql_command = SQLCOM_LOAD_MASTER_DATA; Lex->sql_command = SQLCOM_LOAD_MASTER_DATA;
}; }
;
opt_local: opt_local:
/* empty */ { $$=0;} /* empty */ { $$=0; }
| LOCAL_SYM { $$=1;}; | LOCAL_SYM { $$=1; }
;
load_data_lock: load_data_lock:
/* empty */ { $$= YYTHD->update_lock_default; } /* empty */ { $$= YYTHD->update_lock_default; }
...@@ -3491,15 +3663,18 @@ load_data_lock: ...@@ -3491,15 +3663,18 @@ load_data_lock:
opt_duplicate: opt_duplicate:
/* empty */ { Lex->duplicates=DUP_ERROR; } /* empty */ { Lex->duplicates=DUP_ERROR; }
| REPLACE { Lex->duplicates=DUP_REPLACE; } | REPLACE { Lex->duplicates=DUP_REPLACE; }
| IGNORE_SYM { Lex->duplicates=DUP_IGNORE; }; | IGNORE_SYM { Lex->duplicates=DUP_IGNORE; }
;
opt_field_term: opt_field_term:
/* empty */ /* empty */
| COLUMNS field_term_list; | COLUMNS field_term_list
;
field_term_list: field_term_list:
field_term_list field_term field_term_list field_term
| field_term; | field_term
;
field_term: field_term:
TERMINATED BY text_string { Lex->exchange->field_term= $3;} TERMINATED BY text_string { Lex->exchange->field_term= $3;}
...@@ -3509,25 +3684,30 @@ field_term: ...@@ -3509,25 +3684,30 @@ field_term:
lex->exchange->enclosed= $4; lex->exchange->enclosed= $4;
lex->exchange->opt_enclosed=1; lex->exchange->opt_enclosed=1;
} }
| ENCLOSED BY text_string { Lex->exchange->enclosed= $3;} | ENCLOSED BY text_string { Lex->exchange->enclosed= $3; }
| ESCAPED BY text_string { Lex->exchange->escaped= $3;}; | ESCAPED BY text_string { Lex->exchange->escaped= $3; }
;
opt_line_term: opt_line_term:
/* empty */ /* empty */
| LINES line_term_list; | LINES line_term_list
;
line_term_list: line_term_list:
line_term_list line_term line_term_list line_term
| line_term; | line_term
;
line_term: line_term:
TERMINATED BY text_string { Lex->exchange->line_term= $3;} TERMINATED BY text_string { Lex->exchange->line_term= $3; }
| STARTING BY text_string { Lex->exchange->line_start= $3;}; | STARTING BY text_string { Lex->exchange->line_start= $3; }
;
opt_ignore_lines: opt_ignore_lines:
/* empty */ /* empty */
| IGNORE_SYM NUM LINES | IGNORE_SYM NUM LINES
{ Lex->exchange->skip_lines=atol($2.str); }; { Lex->exchange->skip_lines=atol($2.str); }
;
/* Common definitions */ /* Common definitions */
...@@ -3535,7 +3715,8 @@ text_literal: ...@@ -3535,7 +3715,8 @@ text_literal:
TEXT_STRING { $$ = new Item_string($1.str,$1.length,YYTHD->thd_charset); } TEXT_STRING { $$ = new Item_string($1.str,$1.length,YYTHD->thd_charset); }
| UNDERSCORE_CHARSET TEXT_STRING { $$ = new Item_string($2.str,$2.length,Lex->charset); } | UNDERSCORE_CHARSET TEXT_STRING { $$ = new Item_string($2.str,$2.length,Lex->charset); }
| text_literal TEXT_STRING | text_literal TEXT_STRING
{ ((Item_string*) $1)->append($2.str,$2.length); }; { ((Item_string*) $1)->append($2.str,$2.length); }
;
text_string: text_string:
TEXT_STRING { $$= new String($1.str,$1.length,YYTHD->thd_charset); } TEXT_STRING { $$= new String($1.str,$1.length,YYTHD->thd_charset); }
...@@ -3543,7 +3724,9 @@ text_string: ...@@ -3543,7 +3724,9 @@ text_string:
{ {
Item *tmp = new Item_varbinary($1.str,$1.length); Item *tmp = new Item_varbinary($1.str,$1.length);
$$= tmp ? tmp->val_str((String*) 0) : (String*) 0; $$= tmp ? tmp->val_str((String*) 0) : (String*) 0;
}; }
;
param_marker: param_marker:
'?' '?'
{ {
...@@ -3558,7 +3741,9 @@ param_marker: ...@@ -3558,7 +3741,9 @@ param_marker:
yyerror("You have an error in your SQL syntax"); yyerror("You have an error in your SQL syntax");
YYABORT; YYABORT;
} }
}; }
;
literal: literal:
text_literal { $$ = $1; } text_literal { $$ = $1; }
| NUM { $$ = new Item_int($1.str, (longlong) atol($1.str),$1.length); } | NUM { $$ = new Item_int($1.str, (longlong) atol($1.str),$1.length); }
...@@ -3571,7 +3756,8 @@ literal: ...@@ -3571,7 +3756,8 @@ literal:
| HEX_NUM { $$ = new Item_varbinary($1.str,$1.length);} | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length);}
| DATE_SYM text_literal { $$ = $2; } | DATE_SYM text_literal { $$ = $2; }
| TIME_SYM text_literal { $$ = $2; } | TIME_SYM text_literal { $$ = $2; }
| TIMESTAMP text_literal { $$ = $2; }; | TIMESTAMP text_literal { $$ = $2; }
;
/********************************************************************** /**********************************************************************
** Createing different items. ** Createing different items.
...@@ -3579,16 +3765,19 @@ literal: ...@@ -3579,16 +3765,19 @@ literal:
insert_ident: insert_ident:
simple_ident { $$=$1; } simple_ident { $$=$1; }
| table_wild { $$=$1; }; | table_wild { $$=$1; }
;
table_wild: table_wild:
ident '.' '*' { $$ = new Item_field(NullS,$1.str,"*"); } ident '.' '*' { $$ = new Item_field(NullS,$1.str,"*"); }
| ident '.' ident '.' '*' | ident '.' ident '.' '*'
{ $$ = new Item_field((YYTHD->client_capabilities & { $$ = new Item_field((YYTHD->client_capabilities &
CLIENT_NO_SCHEMA ? NullS : $1.str),$3.str,"*"); }; CLIENT_NO_SCHEMA ? NullS : $1.str),$3.str,"*"); }
;
order_ident: order_ident:
expr { $$=$1; }; expr { $$=$1; }
;
simple_ident: simple_ident:
ident ident
...@@ -3610,19 +3799,20 @@ simple_ident: ...@@ -3610,19 +3799,20 @@ simple_ident:
{ {
SELECT_LEX_NODE *sel=Select; SELECT_LEX_NODE *sel=Select;
$$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field((YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str) : (Item*) new Item_ref((YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str); $$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field((YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str) : (Item*) new Item_ref((YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str);
}; }
;
field_ident: field_ident:
ident { $$=$1;} ident { $$=$1;}
| ident '.' ident { $$=$3;} /* Skipp schema name in create*/ | ident '.' ident { $$=$3;} /* Skipp schema name in create*/
| '.' ident { $$=$2;} /* For Delphi */; | '.' ident { $$=$2;} /* For Delphi */
;
table_ident: table_ident:
ident { $$=new Table_ident($1); } ident { $$=new Table_ident($1); }
| ident '.' ident { $$=new Table_ident($1,$3,0);} | ident '.' ident { $$=new Table_ident($1,$3,0);}
| '.' ident { $$=new Table_ident($2);} | '.' ident { $$=new Table_ident($2);} /* For Delphi */
/* For Delphi */; ;
ident: ident:
IDENT { $$=$1; } IDENT { $$=$1; }
...@@ -3639,7 +3829,8 @@ ident: ...@@ -3639,7 +3829,8 @@ ident:
ident_or_text: ident_or_text:
ident { $$=$1;} ident { $$=$1;}
| TEXT_STRING { $$=$1;} | TEXT_STRING { $$=$1;}
| LEX_HOSTNAME { $$=$1;}; | LEX_HOSTNAME { $$=$1;}
;
user: user:
ident_or_text ident_or_text
...@@ -3653,7 +3844,8 @@ user: ...@@ -3653,7 +3844,8 @@ user:
if (!($$=(LEX_USER*) sql_alloc(sizeof(st_lex_user)))) if (!($$=(LEX_USER*) sql_alloc(sizeof(st_lex_user))))
YYABORT; YYABORT;
$$->user = $1; $$->host=$3; $$->user = $1; $$->host=$3;
}; }
;
/* Keyword that we allow for identifiers */ /* Keyword that we allow for identifiers */
...@@ -3831,15 +4023,18 @@ set: ...@@ -3831,15 +4023,18 @@ set:
lex->option_type=OPT_DEFAULT; lex->option_type=OPT_DEFAULT;
lex->var_list.empty(); lex->var_list.empty();
} }
option_value_list; option_value_list
;
opt_option: opt_option:
/* empty */ {} /* empty */ {}
| OPTION {}; | OPTION {}
;
option_value_list: option_value_list:
option_type option_value option_type option_value
| option_value_list ',' option_type option_value; | option_value_list ',' option_type option_value
;
option_type: option_type:
/* empty */ {} /* empty */ {}
...@@ -3917,6 +4112,7 @@ internal_variable_name: ...@@ -3917,6 +4112,7 @@ internal_variable_name:
} }
; ;
isolation_types: isolation_types:
READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; } READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; }
| READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; } | READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; }
...@@ -3939,7 +4135,6 @@ text_or_password: ...@@ -3939,7 +4135,6 @@ text_or_password:
} }
; ;
set_expr_or_default: set_expr_or_default:
expr { $$=$1; } expr { $$=$1; }
| DEFAULT { $$=0; } | DEFAULT { $$=0; }
...@@ -3955,15 +4150,18 @@ lock: ...@@ -3955,15 +4150,18 @@ lock:
{ {
Lex->sql_command=SQLCOM_LOCK_TABLES; Lex->sql_command=SQLCOM_LOCK_TABLES;
} }
table_lock_list; table_lock_list
;
table_or_tables: table_or_tables:
TABLE_SYM TABLE_SYM
| TABLES; | TABLES
;
table_lock_list: table_lock_list:
table_lock table_lock
| table_lock_list ',' table_lock; | table_lock_list ',' table_lock
;
table_lock: table_lock:
table_ident opt_table_alias lock_option table_ident opt_table_alias lock_option
...@@ -4065,7 +4263,8 @@ revoke: ...@@ -4065,7 +4263,8 @@ revoke:
lex->ssl_cipher= lex->x509_subject= lex->x509_issuer= 0; lex->ssl_cipher= lex->x509_subject= lex->x509_issuer= 0;
bzero((char*) &lex->mqh, sizeof(lex->mqh)); bzero((char*) &lex->mqh, sizeof(lex->mqh));
} }
grant_privileges ON opt_table FROM user_list; grant_privileges ON opt_table FROM user_list
;
grant: grant:
GRANT GRANT
...@@ -4081,7 +4280,8 @@ grant: ...@@ -4081,7 +4280,8 @@ grant:
bzero(&(lex->mqh),sizeof(lex->mqh)); bzero(&(lex->mqh),sizeof(lex->mqh));
} }
grant_privileges ON opt_table TO_SYM user_list grant_privileges ON opt_table TO_SYM user_list
require_clause grant_options; require_clause grant_options
;
grant_privileges: grant_privileges:
grant_privilege_list {} grant_privilege_list {}
...@@ -4091,7 +4291,8 @@ grant_privileges: ...@@ -4091,7 +4291,8 @@ grant_privileges:
grant_privilege_list: grant_privilege_list:
grant_privilege grant_privilege
| grant_privilege_list ',' grant_privilege; | grant_privilege_list ',' grant_privilege
;
grant_privilege: grant_privilege:
SELECT_SYM { Lex->which_columns = SELECT_ACL;} opt_column_list SELECT_SYM { Lex->which_columns = SELECT_ACL;} opt_column_list
...@@ -4118,7 +4319,6 @@ grant_privilege: ...@@ -4118,7 +4319,6 @@ grant_privilege:
| REPLICATION CLIENT_SYM { Lex->grant |= REPL_CLIENT_ACL;} | REPLICATION CLIENT_SYM { Lex->grant |= REPL_CLIENT_ACL;}
; ;
opt_and: opt_and:
/* empty */ {} /* empty */ {}
| AND {} | AND {}
...@@ -4209,7 +4409,6 @@ opt_table: ...@@ -4209,7 +4409,6 @@ opt_table:
} }
; ;
user_list: user_list:
grant_user { if (Lex->users_list.push_back($1)) YYABORT;} grant_user { if (Lex->users_list.push_back($1)) YYABORT;}
| user_list ',' grant_user | user_list ',' grant_user
...@@ -4219,7 +4418,6 @@ user_list: ...@@ -4219,7 +4418,6 @@ user_list:
} }
; ;
grant_user: grant_user:
user IDENTIFIED_SYM BY TEXT_STRING user IDENTIFIED_SYM BY TEXT_STRING
{ {
...@@ -4248,11 +4446,13 @@ opt_column_list: ...@@ -4248,11 +4446,13 @@ opt_column_list:
LEX *lex=Lex; LEX *lex=Lex;
lex->grant |= lex->which_columns; lex->grant |= lex->which_columns;
} }
| '(' column_list ')'; | '(' column_list ')'
;
column_list: column_list:
column_list ',' column_list_id column_list ',' column_list_id
| column_list_id; | column_list_id
;
column_list_id: column_list_id:
ident ident
...@@ -4295,9 +4495,11 @@ require_clause: /* empty */ ...@@ -4295,9 +4495,11 @@ require_clause: /* empty */
} }
; ;
grant_options: grant_options:
/* empty */ {} /* empty */ {}
| WITH grant_option_list; | WITH grant_option_list
;
grant_option_list: grant_option_list:
grant_option_list grant_option {} grant_option_list grant_option {}
...@@ -4324,7 +4526,8 @@ grant_option: ...@@ -4324,7 +4526,8 @@ grant_option:
; ;
begin: begin:
BEGIN_SYM { Lex->sql_command = SQLCOM_BEGIN;} opt_work; BEGIN_SYM { Lex->sql_command = SQLCOM_BEGIN;} opt_work
;
opt_work: opt_work:
/* empty */ {} /* empty */ {}
...@@ -4332,10 +4535,12 @@ opt_work: ...@@ -4332,10 +4535,12 @@ opt_work:
; ;
commit: commit:
COMMIT_SYM { Lex->sql_command = SQLCOM_COMMIT;}; COMMIT_SYM { Lex->sql_command = SQLCOM_COMMIT; }
;
rollback: rollback:
ROLLBACK_SYM { Lex->sql_command = SQLCOM_ROLLBACK;}; ROLLBACK_SYM { Lex->sql_command = SQLCOM_ROLLBACK; }
;
/* /*
...@@ -4400,14 +4605,16 @@ optional_order_or_limit: ...@@ -4400,14 +4605,16 @@ optional_order_or_limit:
union_option: union_option:
/* empty */ {} /* empty */ {}
| ALL {Select->master_unit()->union_option= 1;}; | ALL {Select->master_unit()->union_option= 1;}
;
singleval_subselect: singleval_subselect:
subselect_start singleval_subselect_init subselect_start singleval_subselect_init
subselect_end subselect_end
{ {
$$= $2; $$= $2;
}; }
;
singleval_subselect_init: singleval_subselect_init:
select_init2 select_init2
...@@ -4415,14 +4622,16 @@ singleval_subselect_init: ...@@ -4415,14 +4622,16 @@ singleval_subselect_init:
$$= new Item_singleval_subselect(YYTHD, $$= new Item_singleval_subselect(YYTHD,
Lex->current_select->master_unit()-> Lex->current_select->master_unit()->
first_select()); first_select());
}; }
;
exists_subselect: exists_subselect:
subselect_start exists_subselect_init subselect_start exists_subselect_init
subselect_end subselect_end
{ {
$$= $2; $$= $2;
}; }
;
exists_subselect_init: exists_subselect_init:
select_init2 select_init2
...@@ -4450,11 +4659,13 @@ subselect_start: ...@@ -4450,11 +4659,13 @@ subselect_start:
{ {
if (mysql_new_select(Lex, 1)) if (mysql_new_select(Lex, 1))
YYABORT; YYABORT;
}; }
;
subselect_end: subselect_end:
')' ')'
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->current_select = lex->current_select->outer_select(); lex->current_select = lex->current_select->outer_select();
}; }
;
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