summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.cornsilk.net>2008-04-02 10:58:37 -0400
committerunknown <cmiller@zippy.cornsilk.net>2008-04-02 10:58:37 -0400
commitcb29e2396b7c705efb74a1a787a5d697a959399c (patch)
tree695c78dab845661b64de1c2c1771787517b241a1 /sql/sql_yacc.yy
parent393c1a01d07fc747dc68df145c920900ee88970d (diff)
parentbabd981e41fe3a385abf4ee398479124e0776687 (diff)
downloadmariadb-git-cb29e2396b7c705efb74a1a787a5d697a959399c.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-build
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build sql/item_create.cc: Auto merged sql/share/errmsg.txt: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy53
1 files changed, 26 insertions, 27 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 44fdf0891b7..ffc84bde9c1 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1174,7 +1174,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
single_multi table_wild_list table_wild_one opt_wild
union_clause union_list
precision subselect_start opt_and charset
- subselect_end select_var_list select_var_list_init help opt_len
+ subselect_end select_var_list select_var_list_init help opt_field_length field_length
opt_extended_describe
prepare prepare_src execute deallocate
statement sp_suid
@@ -3131,45 +3131,38 @@ field_spec:
};
type:
- int_type opt_len field_options { $$=$1; }
+ int_type opt_field_length field_options { $$=$1; }
| real_type opt_precision field_options { $$=$1; }
| FLOAT_SYM float_options field_options { $$=FIELD_TYPE_FLOAT; }
| BIT_SYM { Lex->length= (char*) "1";
$$=FIELD_TYPE_BIT; }
- | BIT_SYM '(' NUM ')' { Lex->length= $3.str;
- $$=FIELD_TYPE_BIT; }
+ | BIT_SYM field_length { $$=FIELD_TYPE_BIT; }
| BOOL_SYM { Lex->length=(char*) "1";
$$=FIELD_TYPE_TINY; }
| BOOLEAN_SYM { Lex->length=(char*) "1";
$$=FIELD_TYPE_TINY; }
- | char '(' NUM ')' opt_binary { Lex->length=$3.str;
- $$=FIELD_TYPE_STRING; }
+ | char field_length opt_binary { $$=FIELD_TYPE_STRING; }
| char opt_binary { Lex->length=(char*) "1";
$$=FIELD_TYPE_STRING; }
- | nchar '(' NUM ')' opt_bin_mod { Lex->length=$3.str;
- $$=FIELD_TYPE_STRING;
+ | nchar field_length opt_bin_mod { $$=FIELD_TYPE_STRING;
Lex->charset=national_charset_info; }
| nchar opt_bin_mod { Lex->length=(char*) "1";
$$=FIELD_TYPE_STRING;
Lex->charset=national_charset_info; }
- | BINARY '(' NUM ')' { Lex->length=$3.str;
- Lex->charset=&my_charset_bin;
+ | BINARY field_length { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_STRING; }
| BINARY { Lex->length= (char*) "1";
Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_STRING; }
- | varchar '(' NUM ')' opt_binary { Lex->length=$3.str;
- $$= MYSQL_TYPE_VARCHAR; }
- | nvarchar '(' NUM ')' opt_bin_mod { Lex->length=$3.str;
- $$= MYSQL_TYPE_VARCHAR;
+ | varchar field_length opt_binary { $$= MYSQL_TYPE_VARCHAR; }
+ | nvarchar field_length opt_bin_mod { $$= MYSQL_TYPE_VARCHAR;
Lex->charset=national_charset_info; }
- | VARBINARY '(' NUM ')' { Lex->length=$3.str;
- Lex->charset=&my_charset_bin;
+ | VARBINARY field_length { Lex->charset=&my_charset_bin;
$$= MYSQL_TYPE_VARCHAR; }
- | YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; }
+ | YEAR_SYM opt_field_length field_options { $$=FIELD_TYPE_YEAR; }
| DATE_SYM { $$=FIELD_TYPE_DATE; }
| TIME_SYM { $$=FIELD_TYPE_TIME; }
- | TIMESTAMP opt_len
+ | TIMESTAMP opt_field_length
{
if (YYTHD->variables.sql_mode & MODE_MAXDB)
$$=FIELD_TYPE_DATETIME;
@@ -3185,7 +3178,7 @@ type:
| DATETIME { $$=FIELD_TYPE_DATETIME; }
| TINYBLOB { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_TINY_BLOB; }
- | BLOB_SYM opt_len { Lex->charset=&my_charset_bin;
+ | BLOB_SYM opt_field_length { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_BLOB; }
| spatial_type
{
@@ -3207,7 +3200,7 @@ type:
$$=FIELD_TYPE_MEDIUM_BLOB; }
| LONG_SYM varchar opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
| TINYTEXT opt_binary { $$=FIELD_TYPE_TINY_BLOB; }
- | TEXT_SYM opt_len opt_binary { $$=FIELD_TYPE_BLOB; }
+ | TEXT_SYM opt_field_length opt_binary { $$=FIELD_TYPE_BLOB; }
| MEDIUMTEXT opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
| LONGTEXT opt_binary { $$=FIELD_TYPE_LONG_BLOB; }
| DECIMAL_SYM float_options field_options
@@ -3280,7 +3273,7 @@ real_type:
float_options:
/* empty */ { Lex->dec=Lex->length= (char*)0; }
- | '(' NUM ')' { Lex->length=$2.str; Lex->dec= (char*)0; }
+ | field_length { Lex->dec= (char*)0; }
| precision {};
precision:
@@ -3303,9 +3296,15 @@ field_option:
| UNSIGNED { Lex->type|= UNSIGNED_FLAG;}
| ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; };
-opt_len:
- /* empty */ { Lex->length=(char*) 0; } /* use default length */
- | '(' NUM ')' { Lex->length= $2.str; };
+opt_field_length:
+ /* empty */ { Lex->length=(char*) NULL; } /* use default length */
+ | field_length {};
+
+field_length:
+ '(' LONG_NUM ')' { Lex->length= $2.str; }
+ | '(' ULONGLONG_NUM ')' { Lex->length= $2.str; }
+ | '(' DECIMAL_NUM ')' { Lex->length= $2.str; }
+ | '(' NUM ')' { Lex->length= $2.str; };
opt_precision:
/* empty */ {}
@@ -5574,9 +5573,9 @@ in_sum_expr:
};
cast_type:
- BINARY opt_len { $$=ITEM_CAST_CHAR; Lex->charset= &my_charset_bin; Lex->dec= 0; }
- | CHAR_SYM opt_len opt_binary { $$=ITEM_CAST_CHAR; Lex->dec= 0; }
- | NCHAR_SYM opt_len { $$=ITEM_CAST_CHAR; Lex->charset= national_charset_info; Lex->dec=0; }
+ BINARY opt_field_length { $$=ITEM_CAST_CHAR; Lex->charset= &my_charset_bin; Lex->dec= 0; }
+ | CHAR_SYM opt_field_length opt_binary { $$=ITEM_CAST_CHAR; Lex->dec= 0; }
+ | NCHAR_SYM opt_field_length { $$=ITEM_CAST_CHAR; Lex->charset= national_charset_info; Lex->dec=0; }
| SIGNED_SYM { $$=ITEM_CAST_SIGNED_INT; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
| SIGNED_SYM INT_SYM { $$=ITEM_CAST_SIGNED_INT; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
| UNSIGNED { $$=ITEM_CAST_UNSIGNED_INT; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }