1179
1259
Lex->mi.heartbeat_period < 0.0)
1181
1261
char buf[sizeof(SLAVE_MAX_HEARTBEAT_PERIOD*4)];
1182
sprintf(buf, "%d seconds", SLAVE_MAX_HEARTBEAT_PERIOD);
1262
my_sprintf(buf, (buf, "%d seconds", SLAVE_MAX_HEARTBEAT_PERIOD));
1183
1263
my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
1185
1265
" is negative or exceeds the maximum ",
1189
1269
if (Lex->mi.heartbeat_period > slave_net_timeout)
1191
push_warning_printf(YYTHD, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1271
push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
1192
1272
ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
1193
1273
ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE),
1194
1274
" exceeds the value of `slave_net_timeout' sec.",
1554
1656
Lex->create_info.used_fields|= HA_CREATE_USED_KEY_BLOCK_SIZE;
1555
1657
Lex->create_info.key_block_size= $3;
1659
| TRANSACTIONAL_SYM opt_equal choice
1661
Lex->create_info.used_fields|= HA_CREATE_USED_TRANSACTIONAL;
1662
Lex->create_info.transactional= $3;
1667
opt_default charset opt_equal charset_name_or_default
1669
HA_CREATE_INFO *cinfo= &Lex->create_info;
1670
if ((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
1671
cinfo->default_table_charset && $4 &&
1672
!my_charset_same(cinfo->default_table_charset,$4))
1674
my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
1675
"CHARACTER SET ", cinfo->default_table_charset->csname,
1676
"CHARACTER SET ", $4->csname);
1679
Lex->create_info.default_table_charset= $4;
1680
Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
1559
1684
default_collation:
1713
1838
lex->default_value= lex->on_update_value= 0;
1714
1839
lex->comment=null_lex_str;
1715
1840
lex->charset=NULL;
1841
lex->storage_type= HA_SM_DEFAULT;
1716
1842
lex->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
1717
lex->vcol_info= NULL;
1722
1847
if (add_field_to_list(lex->thd, &$1, (enum enum_field_types) $3,
1723
1848
lex->length,lex->dec,lex->type,
1849
lex->storage_type, lex->column_format,
1725
1850
lex->default_value, lex->on_update_value,
1727
lex->change,&lex->interval_list,lex->charset,
1733
type opt_attribute {}
1734
| VIRTUAL_SYM type AS '(' virtual_column_func ')' vcol_opt_attribute
1736
$$=DRIZZLE_TYPE_VIRTUAL;
1737
Lex->vcol_info->set_field_type((enum enum_field_types) $2);
1743
| vcol_opt_attribute_list {}
1746
vcol_opt_attribute_list:
1747
vcol_opt_attribute_list vcol_attribute {}
1755
lex->type|= UNIQUE_FLAG;
1756
lex->alter_info.flags|= ALTER_ADD_INDEX;
1758
| UNIQUE_SYM KEY_SYM
1761
lex->type|= UNIQUE_KEY_FLAG;
1762
lex->alter_info.flags|= ALTER_ADD_INDEX;
1764
| COMMENT_SYM TEXT_STRING_sys { Lex->comment= $2; }
1767
Lex->vcol_info->set_field_stored(true);
1772
PARSE_VCOL_EXPR_SYM '(' virtual_column_func ')'
1775
"PARSE_VCOL_EXPR" can only be used by the SQL server
1776
when reading a '*.frm' file.
1777
Prevent the end user from invoking this command.
1779
if (not Lex->parse_vcol_expr)
1781
my_message(ER_SYNTAX_ERROR, ER(ER_SYNTAX_ERROR), MYF(0));
1787
virtual_column_func:
1788
remember_name expr remember_end
1790
Lex->vcol_info= new virtual_column_info();
1791
if (not Lex->vcol_info)
1793
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(virtual_column_info));
1796
uint expr_len= (uint)($3 - $1) - 1;
1797
Lex->vcol_info->expr_str.str= (char* ) sql_memdup($1 + 1, expr_len);
1798
Lex->vcol_info->expr_str.length= expr_len;
1799
Lex->vcol_info->expr_item= $2;
1852
lex->change,&lex->interval_list,lex->charset))
1807
Lex->length=(char*) 0; /* use default length */
1809
| real_type opt_precision { $$=$1; }
1858
int_type opt_len field_options { $$=$1; }
1859
| real_type opt_precision field_options { $$=$1; }
1860
| FLOAT_SYM float_options field_options { $$=MYSQL_TYPE_FLOAT; }
1863
Lex->length= (char*) "1";
1866
| BIT_SYM '(' NUM ')'
1868
Lex->length= $3.str;
1873
Lex->length=(char*) "1";
1878
Lex->length=(char*) "1";
1810
1881
| char '(' NUM ')' opt_binary
1812
1883
Lex->length=$3.str;
1813
$$=DRIZZLE_TYPE_VARCHAR;
1884
$$=MYSQL_TYPE_STRING;
1815
1886
| char opt_binary
1817
1888
Lex->length=(char*) "1";
1818
$$=DRIZZLE_TYPE_VARCHAR;
1889
$$=MYSQL_TYPE_STRING;
1891
| nchar '(' NUM ')' opt_bin_mod
1894
$$=MYSQL_TYPE_STRING;
1895
Lex->charset=national_charset_info;
1899
Lex->length=(char*) "1";
1900
$$=MYSQL_TYPE_STRING;
1901
Lex->charset=national_charset_info;
1903
| BINARY '(' NUM ')'
1906
Lex->charset=&my_charset_bin;
1907
$$=MYSQL_TYPE_STRING;
1911
Lex->length= (char*) "1";
1912
Lex->charset=&my_charset_bin;
1913
$$=MYSQL_TYPE_STRING;
1820
1915
| varchar '(' NUM ')' opt_binary
1822
1917
Lex->length=$3.str;
1823
$$= DRIZZLE_TYPE_VARCHAR;
1918
$$= MYSQL_TYPE_VARCHAR;
1920
| nvarchar '(' NUM ')' opt_bin_mod
1923
$$= MYSQL_TYPE_VARCHAR;
1924
Lex->charset=national_charset_info;
1825
1926
| VARBINARY '(' NUM ')'
1827
1928
Lex->length=$3.str;
1828
1929
Lex->charset=&my_charset_bin;
1829
$$= DRIZZLE_TYPE_VARCHAR;
1930
$$= MYSQL_TYPE_VARCHAR;
1932
| YEAR_SYM opt_len field_options
1933
{ $$=MYSQL_TYPE_YEAR; }
1832
{ $$=DRIZZLE_TYPE_NEWDATE; }
1935
{ $$=MYSQL_TYPE_DATE; }
1834
{ $$=DRIZZLE_TYPE_TIME; }
1937
{ $$=MYSQL_TYPE_TIME; }
1837
1940
/* Unlike other types TIMESTAMP fields are NOT NULL by default */
1838
1941
Lex->type|= NOT_NULL_FLAG;
1839
$$=DRIZZLE_TYPE_TIMESTAMP;
1942
$$=MYSQL_TYPE_TIMESTAMP;
1842
{ $$=DRIZZLE_TYPE_DATETIME; }
1845
Lex->charset=&my_charset_bin;
1846
$$=DRIZZLE_TYPE_BLOB;
1847
Lex->length=(char*) 0; /* use default length */
1849
| TEXT_SYM opt_binary
1851
$$=DRIZZLE_TYPE_BLOB;
1852
Lex->length=(char*) 0; /* use default length */
1854
| DECIMAL_SYM float_options
1855
{ $$=DRIZZLE_TYPE_NEWDECIMAL;}
1856
| NUMERIC_SYM float_options
1857
{ $$=DRIZZLE_TYPE_NEWDECIMAL;}
1858
| FIXED_SYM float_options
1859
{ $$=DRIZZLE_TYPE_NEWDECIMAL;}
1945
{ $$=MYSQL_TYPE_DATETIME; }
1948
Lex->charset=&my_charset_bin;
1949
$$=MYSQL_TYPE_TINY_BLOB;
1953
Lex->charset=&my_charset_bin;
1958
Lex->charset=&my_charset_bin;
1959
$$=MYSQL_TYPE_MEDIUM_BLOB;
1963
Lex->charset=&my_charset_bin;
1964
$$=MYSQL_TYPE_LONG_BLOB;
1966
| LONG_SYM VARBINARY
1968
Lex->charset=&my_charset_bin;
1969
$$=MYSQL_TYPE_MEDIUM_BLOB;
1971
| LONG_SYM varchar opt_binary
1972
{ $$=MYSQL_TYPE_MEDIUM_BLOB; }
1973
| TINYTEXT opt_binary
1974
{ $$=MYSQL_TYPE_TINY_BLOB; }
1975
| TEXT_SYM opt_len opt_binary
1976
{ $$=MYSQL_TYPE_BLOB; }
1977
| MEDIUMTEXT opt_binary
1978
{ $$=MYSQL_TYPE_MEDIUM_BLOB; }
1979
| LONGTEXT opt_binary
1980
{ $$=MYSQL_TYPE_LONG_BLOB; }
1981
| DECIMAL_SYM float_options field_options
1982
{ $$=MYSQL_TYPE_NEWDECIMAL;}
1983
| NUMERIC_SYM float_options field_options
1984
{ $$=MYSQL_TYPE_NEWDECIMAL;}
1985
| FIXED_SYM float_options field_options
1986
{ $$=MYSQL_TYPE_NEWDECIMAL;}
1861
1988
{Lex->interval_list.empty();}
1862
1989
'(' string_list ')' opt_binary
1863
{ $$=DRIZZLE_TYPE_ENUM; }
1990
{ $$=MYSQL_TYPE_ENUM; }
1992
{ Lex->interval_list.empty();}
1993
'(' string_list ')' opt_binary
1994
{ $$=MYSQL_TYPE_SET; }
1995
| LONG_SYM opt_binary
1996
{ $$=MYSQL_TYPE_MEDIUM_BLOB; }
1866
$$=DRIZZLE_TYPE_LONGLONG;
1867
Lex->type|= (AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG);
1999
$$=MYSQL_TYPE_LONGLONG;
2000
Lex->type|= (AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNSIGNED_FLAG |
2186
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
2188
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
2192
| BINARY { $$= &my_charset_bin; }
2195
charset_name_or_default:
2196
charset_name { $$=$1; }
2197
| DEFAULT { $$=NULL; }
2200
opt_load_data_charset:
2201
/* Empty */ { $$= NULL; }
2202
| charset charset_name_or_default { $$= $2; }
2205
old_or_new_charset_name:
2208
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
2209
!($$=get_old_charset_by_name($1.str)))
2211
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
2215
| BINARY { $$= &my_charset_bin; }
2218
old_or_new_charset_name_or_default:
2219
old_or_new_charset_name { $$=$1; }
2220
| DEFAULT { $$=NULL; }
2002
2223
collation_name:
2005
2226
if (!($$=get_charset_by_name($1.str,MYF(0))))
2007
2228
my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str);
2235
/* empty */ { $$=NULL; }
2236
| COLLATE_SYM collation_name_or_default { $$=$2; }
2013
2239
collation_name_or_default:
2014
2240
collation_name { $$=$1; }
2015
2241
| DEFAULT { $$=NULL; }
2024
2250
/* empty */ { Lex->charset=NULL; }
2251
| ASCII_SYM opt_bin_mod { Lex->charset=&my_charset_latin1; }
2025
2252
| BYTE_SYM { Lex->charset=&my_charset_bin; }
2253
| UNICODE_SYM opt_bin_mod
2255
if (!(Lex->charset=get_charset_by_csname("ucs2",
2256
MY_CS_PRIMARY,MYF(0))))
2258
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
2262
| charset charset_name opt_bin_mod { Lex->charset=$2; }
2263
| BINARY opt_bin_charset { Lex->type|= BINCMP_FLAG; }
2026
2268
| BINARY { Lex->type|= BINCMP_FLAG; }
2272
/* empty */ { Lex->charset= NULL; }
2273
| ASCII_SYM { Lex->charset=&my_charset_latin1; }
2276
if (!(Lex->charset=get_charset_by_csname("ucs2",
2277
MY_CS_PRIMARY,MYF(0))))
2279
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
2283
| charset charset_name { Lex->charset=$2; }
2030
2287
'(' real_ulong_num
2034
2291
my_parse_error(ER(ER_SYNTAX_ERROR));
2400
2665
lex->comment=null_lex_str;
2401
2666
lex->charset= NULL;
2402
2667
lex->alter_info.flags|= ALTER_CHANGE_COLUMN;
2668
lex->storage_type= HA_SM_DEFAULT;
2403
2669
lex->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
2404
lex->vcol_info= NULL;
2409
2674
if (add_field_to_list(lex->thd,&$3,
2410
2675
(enum enum_field_types) $5,
2411
2676
lex->length,lex->dec,lex->type,
2677
lex->storage_type, lex->column_format,
2413
2678
lex->default_value, lex->on_update_value,
2415
$3.str, &lex->interval_list, lex->charset,
2680
$3.str, &lex->interval_list, lex->charset))
2420
| DROP opt_column field_ident
2684
| DROP opt_column field_ident opt_restrict
2423
2687
lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::COLUMN,
2475
2739
if (lex->select_lex.db == NULL &&
2476
2740
lex->copy_db_to(&lex->select_lex.db, &dummy))
2480
2744
if (check_table_name($3->table.str,$3->table.length) || ($3->db.str && check_db_name(&$3->db)))
2482
2746
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
2485
2749
lex->name= $3->table;
2486
2750
lex->alter_info.flags|= ALTER_RENAME;
2488
| CONVERT_SYM TO_SYM collation_name_or_default
2752
| CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate
2492
2756
THD *thd= YYTHD;
2493
$3= thd->variables.collation_database;
2757
$4= thd->variables.collation_database;
2760
if (!my_charset_same($4,$5))
2762
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
2763
$5->name, $4->csname);
2496
2767
lex->create_info.table_charset=
2497
lex->create_info.default_table_charset= $3;
2768
lex->create_info.default_table_charset= $5;
2498
2769
lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET |
2499
2770
HA_CREATE_USED_DEFAULT_CHARSET);
2500
2771
lex->alter_info.flags|= ALTER_CONVERT;
4000
4349
| table_ref RIGHT opt_outer JOIN_SYM table_ref
4003
DRIZZLE_YYABORT_UNLESS($1 && $5);
4352
MYSQL_YYABORT_UNLESS($1 && $5);
4004
4353
/* Change the current name resolution context to a local context. */
4005
4354
if (push_new_name_resolution_context(YYTHD, $1, $5))
4007
4356
Select->parsing_place= IN_ON;
4012
4361
if (!($$= lex->current_select->convert_right_join()))
4014
4363
add_join_on($$, $8);
4015
4364
Lex->pop_context();
4016
4365
Select->parsing_place= NO_MATTER;
4018
4367
| table_ref RIGHT opt_outer JOIN_SYM table_factor
4020
DRIZZLE_YYABORT_UNLESS($1 && $5);
4369
MYSQL_YYABORT_UNLESS($1 && $5);
4022
4371
USING '(' using_list ')'
4025
4374
if (!($$= lex->current_select->convert_right_join()))
4027
4376
add_join_natural($$,$5,$9,Select);
4029
4378
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor
4031
DRIZZLE_YYABORT_UNLESS($1 && $6);
4380
MYSQL_YYABORT_UNLESS($1 && $6);
4032
4381
add_join_natural($6,$1,NULL,Select);
4034
4383
if (!($$= lex->current_select->convert_right_join()))
4491
4840
group_list ',' order_ident order_dir
4492
{ if (add_group_to_list(YYTHD, $3,(bool) $4)) DRIZZLE_YYABORT; }
4841
{ if (add_group_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; }
4493
4842
| order_ident order_dir
4494
{ if (add_group_to_list(YYTHD, $1,(bool) $2)) DRIZZLE_YYABORT; }
4843
{ if (add_group_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; }
4851
'WITH CUBE' is reserved in the MySQL syntax, but not implemented,
4852
and cause LALR(2) conflicts.
4853
This syntax is not standard.
4854
MySQL syntax: GROUP BY col1, col2, col3 WITH CUBE
4855
SQL-2003: GROUP BY ... CUBE(col1, col2, col3)
4858
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
4860
my_error(ER_WRONG_USAGE, MYF(0), "WITH CUBE",
4861
"global union parameters");
4864
lex->current_select->olap= CUBE_TYPE;
4865
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE");
4499
4868
| WITH_ROLLUP_SYM
4674
5047
| HEX_NUM { $$= (ulong) strtol($1.str, (char**) 0, 16); }
4675
5048
| LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
4676
5049
| ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
4677
| dec_num_error { DRIZZLE_YYABORT; }
5050
| dec_num_error { MYSQL_YYABORT; }
4681
NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4682
| ULONGLONG_NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4683
| LONG_NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4684
| DECIMAL_NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4685
| FLOAT_NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
5054
NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
5055
| ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
5056
| LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
5057
| DECIMAL_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
5058
| FLOAT_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
5181
5554
lex->lock_option= TL_READ;
5182
5555
mysql_init_select(lex);
5183
5556
lex->current_select->parsing_place= SELECT_LIST;
5184
memset(&lex->create_info, 0, sizeof(lex->create_info));
5557
bzero((char*) &lex->create_info,sizeof(lex->create_info));
5564
DATABASES wild_and_where
5194
5567
lex->sql_command= SQLCOM_SHOW_DATABASES;
5195
5568
if (prepare_schema_table(YYTHD, lex, 0, SCH_SCHEMATA))
5198
| opt_full TABLES opt_db show_wild
5571
| opt_full TABLES opt_db wild_and_where
5201
5574
lex->sql_command= SQLCOM_SHOW_TABLES;
5202
5575
lex->select_lex.db= $3;
5203
5576
if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES))
5206
| TABLE_SYM STATUS_SYM opt_db show_wild
5579
| TABLE_SYM STATUS_SYM opt_db wild_and_where
5209
5582
lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
5210
5583
lex->select_lex.db= $3;
5211
5584
if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLES))
5214
| OPEN_SYM TABLES opt_db show_wild
5587
| OPEN_SYM TABLES opt_db wild_and_where
5217
5590
lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
5218
5591
lex->select_lex.db= $3;
5219
5592
if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES))
5222
5595
| ENGINE_SYM known_storage_engines STATUS_SYM /* This should either go... well it should go */
5224
5597
Lex->create_info.db_type= $2;
5225
5598
Lex->sql_command= SQLCOM_SHOW_ENGINE_STATUS;
5227
| opt_full COLUMNS from_or_in table_ident opt_db show_wild
5600
| opt_full COLUMNS from_or_in table_ident opt_db wild_and_where
5230
5603
lex->sql_command= SQLCOM_SHOW_FIELDS;
5232
5605
$4->change_db($5);
5233
5606
if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS))
5236
5609
| master_or_binary LOGS_SYM
5238
5611
Lex->sql_command = SQLCOM_SHOW_BINLOGS;
5615
Lex->sql_command = SQLCOM_SHOW_SLAVE_HOSTS;
5617
| BINLOG_SYM EVENTS_SYM binlog_in binlog_from
5620
lex->sql_command= SQLCOM_SHOW_BINLOG_EVENTS;
5621
} opt_limit_clause_init
5240
5622
| keys_or_index from_or_in table_ident opt_db where_clause
5254
5636
{ Lex->sql_command = SQLCOM_SHOW_WARNS;}
5255
5637
| ERRORS opt_limit_clause_init
5256
5638
{ Lex->sql_command = SQLCOM_SHOW_ERRORS;}
5257
| opt_var_type STATUS_SYM show_wild
5639
| opt_var_type STATUS_SYM wild_and_where
5260
5642
lex->sql_command= SQLCOM_SHOW_STATUS;
5261
5643
lex->option_type= $1;
5262
5644
if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS))
5265
5647
| opt_full PROCESSLIST_SYM
5266
5648
{ Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
5267
| opt_var_type VARIABLES show_wild
5649
| opt_var_type VARIABLES wild_and_where
5270
5652
lex->sql_command= SQLCOM_SHOW_VARIABLES;
5271
5653
lex->option_type= $1;
5272
5654
if (prepare_schema_table(YYTHD, lex, 0, SCH_VARIABLES))
5657
| charset wild_and_where
5660
lex->sql_command= SQLCOM_SHOW_CHARSETS;
5661
if (prepare_schema_table(YYTHD, lex, 0, SCH_CHARSETS))
5664
| COLLATION_SYM wild_and_where
5667
lex->sql_command= SQLCOM_SHOW_COLLATIONS;
5668
if (prepare_schema_table(YYTHD, lex, 0, SCH_COLLATIONS))
5275
5671
| CREATE DATABASE opt_if_not_exists ident