3976
3976
select_derived:
3980
if ($1->init_nested_join(lex->session))
3979
if ($1->init_nested_join(Lex->session))
3981
3980
DRIZZLE_YYABORT;
3983
3982
derived_table_list
3986
3984
/* for normal joins, $3 != NULL and end_nested_join() != NULL,
3987
3985
for derived tables, both must equal NULL */
3989
if (!($$= $1->end_nested_join(lex->session)) && $3)
3987
if (!($$= $1->end_nested_join(Lex->session)) && $3)
3990
3988
DRIZZLE_YYABORT;
4000
3998
select_derived2:
4003
lex->derived_tables|= DERIVED_SUBQUERY;
4004
if (!lex->expr_allows_subselect)
4000
Lex->derived_tables|= DERIVED_SUBQUERY;
4001
if (not Lex->expr_allows_subselect)
4006
4003
struct my_parse_error_st pass= { ER(ER_SYNTAX_ERROR), YYSession };
4007
4004
my_parse_error(&pass);
4008
4005
DRIZZLE_YYABORT;
4010
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
4007
if (Lex->current_select->linkage == GLOBAL_OPTIONS_TYPE || new_select(Lex, 1))
4012
4008
DRIZZLE_YYABORT;
4014
lex->current_select->linkage= DERIVED_TABLE_TYPE;
4015
lex->current_select->parsing_place= SELECT_LIST;
4010
Lex->current_select->linkage= DERIVED_TABLE_TYPE;
4011
Lex->current_select->parsing_place= SELECT_LIST;
4017
4013
select_options select_item_list
4028
4024
select_derived_init:
4033
Select_Lex *sel= lex->current_select;
4027
Select_Lex *sel= Lex->current_select;
4034
4028
TableList *embedding;
4035
if (!sel->embedding || sel->end_nested_join(lex->session))
4029
if (!sel->embedding || sel->end_nested_join(Lex->session))
4037
4031
/* we are not in parentheses */
4038
4032
struct my_parse_error_st pass= { ER(ER_SYNTAX_ERROR), YYSession };
4264
4258
MySQL syntax: GROUP BY col1, col2, col3 WITH ROLLUP
4265
4259
SQL-2003: GROUP BY ... ROLLUP(col1, col2, col3)
4268
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
4261
if (Lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
4270
4263
my_error(ER_WRONG_USAGE, MYF(0), "WITH ROLLUP",
4271
4264
"global union parameters");
4272
4265
DRIZZLE_YYABORT;
4274
lex->current_select->olap= ROLLUP_TYPE;
4267
Lex->current_select->olap= ROLLUP_TYPE;
4313
Select_Lex *sel= lex->current_select;
4305
Select_Lex *sel= Lex->current_select;
4314
4306
Select_Lex_Unit *unit= sel-> master_unit();
4315
4307
if (sel->linkage != GLOBAL_OPTIONS_TYPE &&
4316
4308
sel->olap != UNSPECIFIED_OLAP_TYPE &&
4320
4312
"CUBE/ROLLUP", "ORDER BY");
4321
4313
DRIZZLE_YYABORT;
4323
if (lex->sql_command != SQLCOM_ALTER_TABLE && !unit->fake_select_lex)
4315
if (Lex->sql_command != SQLCOM_ALTER_TABLE && !unit->fake_select_lex)
4326
4318
A query of the of the form (SELECT ...) ORDER BY order_list is
4453
4442
select_var_ident:
4454
4443
'@' ident_or_text
4458
((select_dumpvar *)lex->result)->var_list.push_back( new var($2,0,0,(enum_field_types)0));
4446
((select_dumpvar *)Lex->result)->var_list.push_back( new var($2,0,0,(enum_field_types)0));
4461
4449
The parser won't create select_result instance only
4462
4450
if it's an EXPLAIN.
4464
assert(lex->describe);
4452
assert(Lex->describe);
4474
4462
into_destination:
4475
4463
OUTFILE TEXT_STRING_filesystem
4478
lex->setCacheable(false);
4479
if (!(lex->exchange= new file_exchange($2.str, 0)) ||
4480
!(lex->result= new select_export(lex->exchange)))
4465
Lex->setCacheable(false);
4466
if (!(Lex->exchange= new file_exchange($2.str, 0)) ||
4467
!(Lex->result= new select_export(Lex->exchange)))
4481
4468
DRIZZLE_YYABORT;
4483
4470
opt_field_term opt_line_term
4484
4471
| DUMPFILE TEXT_STRING_filesystem
4473
if (not Lex->describe)
4489
lex->setCacheable(false);
4490
if (!(lex->exchange= new file_exchange($2.str,1)))
4475
Lex->setCacheable(false);
4476
if (not (Lex->exchange= new file_exchange($2.str,1)))
4491
4477
DRIZZLE_YYABORT;
4492
if (!(lex->result= new select_dump(lex->exchange)))
4478
if (not (Lex->result= new select_dump(Lex->exchange)))
4493
4479
DRIZZLE_YYABORT;
4505
4491
DROP opt_temporary table_or_tables if_exists table_list
4508
lex->sql_command = SQLCOM_DROP_TABLE;
4493
Lex->sql_command = SQLCOM_DROP_TABLE;
4509
4494
statement::DropTable *statement= new(std::nothrow) statement::DropTable(YYSession);
4510
lex->statement= statement;
4511
if (lex->statement == NULL)
4495
Lex->statement= statement;
4496
if (Lex->statement == NULL)
4512
4497
DRIZZLE_YYABORT;
4513
4498
statement->drop_temporary= $2;
4514
4499
statement->drop_if_exists= $4;
4516
4501
| DROP build_method INDEX_SYM ident ON table_ident {}
4519
lex->sql_command= SQLCOM_DROP_INDEX;
4503
Lex->sql_command= SQLCOM_DROP_INDEX;
4520
4504
statement::DropIndex *statement= new(std::nothrow) statement::DropIndex(YYSession);
4521
lex->statement= statement;
4522
if (lex->statement == NULL)
4505
Lex->statement= statement;
4506
if (Lex->statement == NULL)
4523
4507
DRIZZLE_YYABORT;
4524
4508
statement->alter_info.flags.set(ALTER_DROP_INDEX);
4525
4509
statement->alter_info.build_method= $2;
4526
4510
statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY, $4.str));
4527
if (!lex->current_select->add_table_to_list(lex->session, $6, NULL,
4528
TL_OPTION_UPDATING))
4511
if (not Lex->current_select->add_table_to_list(Lex->session, $6, NULL,
4512
TL_OPTION_UPDATING))
4529
4513
DRIZZLE_YYABORT;
4531
4515
| DROP DATABASE if_exists ident
4534
lex->sql_command= SQLCOM_DROP_DB;
4517
Lex->sql_command= SQLCOM_DROP_DB;
4535
4518
statement::DropSchema *statement= new(std::nothrow) statement::DropSchema(YYSession);
4536
lex->statement= statement;
4537
if (lex->statement == NULL)
4519
Lex->statement= statement;
4520
if (Lex->statement == NULL)
4538
4521
DRIZZLE_YYABORT;
4539
4522
statement->drop_if_exists=$3;
4570
4553
EXECUTE_SYM execute_var_or_string opt_status opt_concurrent opt_wait
4573
4555
statement::Execute *statement= new(std::nothrow) statement::Execute(YYSession, $2, $3, $4, $5);
4574
lex->statement= statement;
4575
if (lex->statement == NULL)
4556
Lex->statement= statement;
4557
if (Lex->statement == NULL)
4576
4558
DRIZZLE_YYABORT;
4613
lex->sql_command= SQLCOM_INSERT;
4614
lex->statement= new(std::nothrow) statement::Insert(YYSession);
4615
if (lex->statement == NULL)
4594
Lex->sql_command= SQLCOM_INSERT;
4595
Lex->statement= new(std::nothrow) statement::Insert(YYSession);
4596
if (Lex->statement == NULL)
4616
4597
DRIZZLE_YYABORT;
4617
lex->duplicates= DUP_ERROR;
4598
Lex->duplicates= DUP_ERROR;
4619
4600
/* for subselects */
4620
lex->lock_option= TL_READ;
4601
Lex->lock_option= TL_READ;
4622
4603
opt_ignore insert2
4635
lex->sql_command= SQLCOM_REPLACE;
4636
lex->statement= new(std::nothrow) statement::Replace(YYSession);
4637
if (lex->statement == NULL)
4615
Lex->sql_command= SQLCOM_REPLACE;
4616
Lex->statement= new(std::nothrow) statement::Replace(YYSession);
4617
if (Lex->statement == NULL)
4638
4618
DRIZZLE_YYABORT;
4639
lex->duplicates= DUP_REPLACE;
4619
Lex->duplicates= DUP_REPLACE;
4668
4647
| '(' fields ')' insert_values {}
4672
if (!(lex->insert_list = new List_item) ||
4673
lex->many_values.push_back(lex->insert_list))
4650
if (not (Lex->insert_list = new List_item) ||
4651
Lex->many_values.push_back(Lex->insert_list))
4674
4652
DRIZZLE_YYABORT;
4709
4687
ident_eq_value:
4710
4688
simple_ident_nospvar equal expr_or_default
4713
if (lex->field_list.push_back($1) ||
4714
lex->insert_list->push_back($3))
4690
if (Lex->field_list.push_back($1) ||
4691
Lex->insert_list->push_back($3))
4715
4692
DRIZZLE_YYABORT;
4775
4751
UPDATE_SYM opt_ignore table_ident
4779
lex->sql_command= SQLCOM_UPDATE;
4780
lex->statement= new(std::nothrow) statement::Update(YYSession);
4781
if (lex->statement == NULL)
4754
Lex->sql_command= SQLCOM_UPDATE;
4755
Lex->statement= new(std::nothrow) statement::Update(YYSession);
4756
if (Lex->statement == NULL)
4782
4757
DRIZZLE_YYABORT;
4783
lex->lock_option= TL_UNLOCK; /* Will be set later */
4784
lex->duplicates= DUP_ERROR;
4785
if (!lex->select_lex.add_table_to_list(YYSession, $3, NULL,0))
4758
Lex->lock_option= TL_UNLOCK; /* Will be set later */
4759
Lex->duplicates= DUP_ERROR;
4760
if (not Lex->select_lex.add_table_to_list(YYSession, $3, NULL,0))
4786
4761
DRIZZLE_YYABORT;
4788
4763
SET update_list
4791
if (lex->select_lex.get_table_list()->derived)
4765
if (Lex->select_lex.get_table_list()->derived)
4793
4767
/* it is single table update and it is update of derived table */
4794
4768
my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
4795
lex->select_lex.get_table_list()->alias, "UPDATE");
4769
Lex->select_lex.get_table_list()->alias, "UPDATE");
4796
4770
DRIZZLE_YYABORT;
4826
4800
insert_update_elem:
4827
4801
simple_ident_nospvar equal expr_or_default
4830
if (lex->update_list.push_back($1) ||
4831
lex->value_list.push_back($3))
4803
if (Lex->update_list.push_back($1) ||
4804
Lex->value_list.push_back($3))
4832
4805
DRIZZLE_YYABORT;
4842
lex->sql_command= SQLCOM_DELETE;
4843
lex->statement= new(std::nothrow) statement::Delete(YYSession);
4844
if (lex->statement == NULL)
4814
Lex->sql_command= SQLCOM_DELETE;
4815
Lex->statement= new(std::nothrow) statement::Delete(YYSession);
4816
if (Lex->statement == NULL)
4845
4817
DRIZZLE_YYABORT;
4847
lex->lock_option= TL_WRITE_DEFAULT;
4849
lex->select_lex.init_order();
4819
Lex->lock_option= TL_WRITE_DEFAULT;
4821
Lex->select_lex.init_order();
4851
4823
opt_delete_options single_multi
4875
4847
TRUNCATE_SYM opt_table_sym table_name
4878
lex->sql_command= SQLCOM_TRUNCATE;
4879
lex->statement= new(std::nothrow) statement::Truncate(YYSession);
4880
if (lex->statement == NULL)
4849
Lex->sql_command= SQLCOM_TRUNCATE;
4850
Lex->statement= new(std::nothrow) statement::Truncate(YYSession);
4851
if (Lex->statement == NULL)
4881
4852
DRIZZLE_YYABORT;
4882
lex->select_lex.options= 0;
4883
lex->select_lex.init_order();
4853
Lex->select_lex.options= 0;
4854
Lex->select_lex.init_order();
4909
4879
DATABASES show_wild
4913
lex->sql_command= SQLCOM_SELECT;
4881
Lex->sql_command= SQLCOM_SELECT;
4915
4883
new(std::nothrow) statement::Show(YYSession);
4916
if (lex->statement == NULL)
4884
if (Lex->statement == NULL)
4917
4885
DRIZZLE_YYABORT;
4919
4887
std::string column_name= "Database";
4927
4895
if (Lex->current_select->where)
4929
if (prepare_new_schema_table(YYSession, lex, "SCHEMAS"))
4897
if (prepare_new_schema_table(YYSession, Lex, "SCHEMAS"))
4930
4898
DRIZZLE_YYABORT;
4934
if (prepare_new_schema_table(YYSession, lex, "SHOW_SCHEMAS"))
4902
if (prepare_new_schema_table(YYSession, Lex, "SHOW_SCHEMAS"))
4935
4903
DRIZZLE_YYABORT;
4948
4916
/* SHOW TABLES */
4949
4917
| TABLES opt_db show_wild
4953
lex->sql_command= SQLCOM_SELECT;
4919
Lex->sql_command= SQLCOM_SELECT;
4955
4921
statement::Show *select=
4956
4922
new(std::nothrow) statement::Show(YYSession);
4958
lex->statement= select;
4924
Lex->statement= select;
4960
if (lex->statement == NULL)
4926
if (Lex->statement == NULL)
4961
4927
DRIZZLE_YYABORT;
4994
4960
column_name.append(")");
4997
if (prepare_new_schema_table(YYSession, lex, "SHOW_TABLES"))
4963
if (prepare_new_schema_table(YYSession, Lex, "SHOW_TABLES"))
4998
4964
DRIZZLE_YYABORT;
5000
4966
Item_field *my_field= new Item_field(&YYSession->lex->current_select->context, NULL, NULL, "TABLE_NAME");
5010
4976
/* SHOW TEMPORARY TABLES */
5011
4977
| TEMPORARY_SYM TABLES show_wild
5015
lex->sql_command= SQLCOM_SELECT;
4979
Lex->sql_command= SQLCOM_SELECT;
5017
4981
statement::Show *select=
5018
4982
new(std::nothrow) statement::Show(YYSession);
5020
lex->statement= select;
4984
Lex->statement= select;
5022
if (lex->statement == NULL)
4986
if (Lex->statement == NULL)
5023
4987
DRIZZLE_YYABORT;
5026
if (prepare_new_schema_table(YYSession, lex, "SHOW_TEMPORARY_TABLES"))
4990
if (prepare_new_schema_table(YYSession, Lex, "SHOW_TEMPORARY_TABLES"))
5027
4991
DRIZZLE_YYABORT;
5029
4993
if (YYSession->add_item_to_list( new Item_field(&YYSession->lex->current_select->
5036
5000
/* SHOW TABLE STATUS */
5037
5001
| TABLE_SYM STATUS_SYM opt_db show_wild
5040
lex->sql_command= SQLCOM_SELECT;
5003
Lex->sql_command= SQLCOM_SELECT;
5041
5004
statement::Show *select=
5042
5005
new(std::nothrow) statement::Show(YYSession);
5044
lex->statement= select;
5007
Lex->statement= select;
5046
if (lex->statement == NULL)
5009
if (Lex->statement == NULL)
5047
5010
DRIZZLE_YYABORT;
5049
5012
std::string column_name= "Tables_in_";
5071
5034
DRIZZLE_YYABORT;
5074
if (prepare_new_schema_table(YYSession, lex, "SHOW_TABLE_STATUS"))
5037
if (prepare_new_schema_table(YYSession, Lex, "SHOW_TABLE_STATUS"))
5075
5038
DRIZZLE_YYABORT;
5077
5040
if (YYSession->add_item_to_list( new Item_field(&YYSession->lex->current_select->
5083
5046
/* SHOW COLUMNS FROM table_name */
5084
5047
| COLUMNS from_or_in table_ident opt_db show_wild
5087
5049
statement::Show *select;
5089
lex->sql_command= SQLCOM_SELECT;
5051
Lex->sql_command= SQLCOM_SELECT;
5091
5053
select= new(std::nothrow) statement::Show(YYSession);
5093
lex->statement= select;
5055
Lex->statement= select;
5095
if (lex->statement == NULL)
5057
if (Lex->statement == NULL)
5096
5058
DRIZZLE_YYABORT;
5098
5060
util::string::const_shared_ptr schema(YYSession->schema());
5127
if (prepare_new_schema_table(YYSession, lex, "SHOW_COLUMNS"))
5089
if (prepare_new_schema_table(YYSession, Lex, "SHOW_COLUMNS"))
5128
5090
DRIZZLE_YYABORT;
5130
5092
if (YYSession->add_item_to_list( new Item_field(&YYSession->lex->current_select->
5137
5099
/* SHOW INDEXES from table */
5138
5100
| keys_or_index from_or_in table_ident opt_db where_clause
5141
5102
statement::Show *select;
5143
lex->sql_command= SQLCOM_SELECT;
5104
Lex->sql_command= SQLCOM_SELECT;
5145
5106
select= new(std::nothrow) statement::Show(YYSession);
5147
lex->statement= select;
5108
Lex->statement= select;
5149
if (lex->statement == NULL)
5110
if (Lex->statement == NULL)
5150
5111
DRIZZLE_YYABORT;
5152
5113
util::string::const_shared_ptr schema(YYSession->schema());
5181
if (prepare_new_schema_table(YYSession, lex, "SHOW_INDEXES"))
5142
if (prepare_new_schema_table(YYSession, Lex, "SHOW_INDEXES"))
5182
5143
DRIZZLE_YYABORT;
5184
5145
if (YYSession->add_item_to_list( new Item_field(&YYSession->lex->current_select->
5190
5151
| COUNT_SYM '(' '*' ')' WARNINGS
5192
5153
(void) create_select_for_variable("warning_count");
5194
lex->statement= new(std::nothrow) statement::Show(YYSession);
5195
if (lex->statement == NULL)
5154
Lex->statement= new(std::nothrow) statement::Show(YYSession);
5155
if (Lex->statement == NULL)
5196
5156
DRIZZLE_YYABORT;
5198
5158
| COUNT_SYM '(' '*' ')' ERRORS
5200
5160
(void) create_select_for_variable("error_count");
5202
lex->statement= new(std::nothrow) statement::Show(YYSession);
5203
if (lex->statement == NULL)
5161
Lex->statement= new(std::nothrow) statement::Show(YYSession);
5162
if (Lex->statement == NULL)
5204
5163
DRIZZLE_YYABORT;
5206
5165
| WARNINGS opt_limit_clause_init
5220
5179
| opt_var_type STATUS_SYM show_wild
5223
lex->sql_command= SQLCOM_SELECT;
5225
new(std::nothrow) statement::Show(YYSession);
5226
if (lex->statement == NULL)
5181
Lex->sql_command= SQLCOM_SELECT;
5182
Lex->statement= new(std::nothrow) statement::Show(YYSession);
5183
if (Lex->statement == NULL)
5227
5184
DRIZZLE_YYABORT;
5229
5186
if ($1 == OPT_GLOBAL)
5231
if (prepare_new_schema_table(YYSession, lex, "GLOBAL_STATUS"))
5188
if (prepare_new_schema_table(YYSession, Lex, "GLOBAL_STATUS"))
5232
5189
DRIZZLE_YYABORT;
5236
if (prepare_new_schema_table(YYSession, lex, "SESSION_STATUS"))
5193
if (prepare_new_schema_table(YYSession, Lex, "SESSION_STATUS"))
5237
5194
DRIZZLE_YYABORT;
5257
5214
| CREATE TABLE_SYM table_ident
5260
lex->sql_command= SQLCOM_SELECT;
5216
Lex->sql_command= SQLCOM_SELECT;
5261
5217
statement::Show *select=
5262
5218
new(std::nothrow) statement::Show(YYSession);
5264
lex->statement= select;
5220
Lex->statement= select;
5266
if (lex->statement == NULL)
5222
if (Lex->statement == NULL)
5267
5223
DRIZZLE_YYABORT;
5269
if (prepare_new_schema_table(YYSession, lex, "TABLE_SQL_DEFINITION"))
5225
if (prepare_new_schema_table(YYSession, Lex, "TABLE_SQL_DEFINITION"))
5270
5226
DRIZZLE_YYABORT;
5272
5228
util::string::const_shared_ptr schema(YYSession->schema());
5304
5260
| PROCESSLIST_SYM
5308
lex->sql_command= SQLCOM_SELECT;
5263
Lex->sql_command= SQLCOM_SELECT;
5310
5265
new(std::nothrow) statement::Show(YYSession);
5311
if (lex->statement == NULL)
5266
if (Lex->statement == NULL)
5312
5267
DRIZZLE_YYABORT;
5314
if (prepare_new_schema_table(YYSession, lex, "PROCESSLIST"))
5269
if (prepare_new_schema_table(YYSession, Lex, "PROCESSLIST"))
5315
5270
DRIZZLE_YYABORT;
5317
5272
if (YYSession->add_item_to_list( new Item_field(&YYSession->lex->current_select->
5324
5279
| opt_var_type VARIABLES show_wild
5327
lex->sql_command= SQLCOM_SELECT;
5281
Lex->sql_command= SQLCOM_SELECT;
5329
5283
new(std::nothrow) statement::Show(YYSession);
5330
if (lex->statement == NULL)
5284
if (Lex->statement == NULL)
5331
5285
DRIZZLE_YYABORT;
5333
5287
if ($1 == OPT_GLOBAL)
5335
if (prepare_new_schema_table(YYSession, lex, "GLOBAL_VARIABLES"))
5289
if (prepare_new_schema_table(YYSession, Lex, "GLOBAL_VARIABLES"))
5336
5290
DRIZZLE_YYABORT;
5340
if (prepare_new_schema_table(YYSession, lex, "SESSION_VARIABLES"))
5294
if (prepare_new_schema_table(YYSession, Lex, "SESSION_VARIABLES"))
5341
5295
DRIZZLE_YYABORT;
5361
5315
| CREATE DATABASE opt_if_not_exists ident
5364
lex->sql_command= SQLCOM_SELECT;
5317
Lex->sql_command= SQLCOM_SELECT;
5365
5318
statement::Show *select=
5366
5319
new(std::nothrow) statement::Show(YYSession);
5368
lex->statement= select;
5321
Lex->statement= select;
5370
if (lex->statement == NULL)
5323
if (Lex->statement == NULL)
5371
5324
DRIZZLE_YYABORT;
5373
if (prepare_new_schema_table(YYSession, lex, "SCHEMA_SQL_DEFINITION"))
5326
if (prepare_new_schema_table(YYSession, Lex, "SCHEMA_SQL_DEFINITION"))
5374
5327
DRIZZLE_YYABORT;
5376
5329
util::string::const_shared_ptr schema(YYSession->schema());
5438
5391
describe_command table_ident
5440
5393
statement::Show *select;
5442
lex->lock_option= TL_READ;
5444
lex->current_select->parsing_place= SELECT_LIST;
5445
lex->sql_command= SQLCOM_SELECT;
5394
Lex->lock_option= TL_READ;
5396
Lex->current_select->parsing_place= SELECT_LIST;
5397
Lex->sql_command= SQLCOM_SELECT;
5446
5398
select= new(std::nothrow) statement::Show(YYSession);
5447
lex->statement= select;
5448
if (lex->statement == NULL)
5399
Lex->statement= select;
5400
if (Lex->statement == NULL)
5449
5401
DRIZZLE_YYABORT;
5450
lex->select_lex.db= 0;
5402
Lex->select_lex.db= 0;
5452
5404
util::string::const_shared_ptr schema(YYSession->schema());
5453
5405
if ($2->db.str)
5477
if (prepare_new_schema_table(YYSession, lex, "SHOW_COLUMNS"))
5429
if (prepare_new_schema_table(YYSession, Lex, "SHOW_COLUMNS"))
5478
5430
DRIZZLE_YYABORT;
5480
5432
if (YYSession->add_item_to_list( new Item_field(&YYSession->lex->current_select->
5527
lex->sql_command= SQLCOM_FLUSH;
5528
lex->statement= new(std::nothrow) statement::Flush(YYSession);
5529
if (lex->statement == NULL)
5477
Lex->sql_command= SQLCOM_FLUSH;
5478
Lex->statement= new(std::nothrow) statement::Flush(YYSession);
5479
if (Lex->statement == NULL)
5530
5480
DRIZZLE_YYABORT;
5592
lex->value_list.empty();
5593
lex->value_list.push_front($3);
5594
lex->sql_command= SQLCOM_KILL;
5595
lex->statement= new(std::nothrow) statement::Kill(YYSession);
5596
if (lex->statement == NULL)
5540
Lex->value_list.empty();
5541
Lex->value_list.push_front($3);
5542
Lex->sql_command= SQLCOM_KILL;
5543
Lex->statement= new(std::nothrow) statement::Kill(YYSession);
5544
if (Lex->statement == NULL)
5597
5545
DRIZZLE_YYABORT;
5613
lex->sql_command=SQLCOM_CHANGE_DB;
5614
lex->statement= new(std::nothrow) statement::ChangeSchema(YYSession);
5615
if (lex->statement == NULL)
5560
Lex->sql_command=SQLCOM_CHANGE_DB;
5561
Lex->statement= new(std::nothrow) statement::ChangeSchema(YYSession);
5562
if (Lex->statement == NULL)
5616
5563
DRIZZLE_YYABORT;
5617
lex->select_lex.db= $2.str;
5564
Lex->select_lex.db= $2.str;
5626
LEX *lex= YYSession->lex;
5628
lex->sql_command= SQLCOM_LOAD;
5573
Lex->sql_command= SQLCOM_LOAD;
5629
5574
statement::Load *statement= new(std::nothrow) statement::Load(YYSession);
5630
lex->statement= statement;
5631
if (lex->statement == NULL)
5575
Lex->statement= statement;
5576
if (Lex->statement == NULL)
5632
5577
DRIZZLE_YYABORT;
5634
5579
Lex_input_stream *lip= YYSession->m_lip;
5637
5582
load_data_lock INFILE TEXT_STRING_filesystem
5640
lex->lock_option= $4;
5641
lex->duplicates= DUP_ERROR;
5643
if (!(lex->exchange= new file_exchange($6.str, 0, $2)))
5584
Lex->lock_option= $4;
5585
Lex->duplicates= DUP_ERROR;
5587
if (not (Lex->exchange= new file_exchange($6.str, 0, $2)))
5644
5588
DRIZZLE_YYABORT;
5646
5590
opt_duplicate INTO
5651
5595
TABLE_SYM table_ident
5654
5597
if (!Lex->current_select->add_table_to_list(YYSession,
5655
5598
$12, NULL, TL_OPTION_UPDATING,
5657
5600
DRIZZLE_YYABORT;
5658
lex->field_list.empty();
5659
lex->update_list.empty();
5660
lex->value_list.empty();
5601
Lex->field_list.empty();
5602
Lex->update_list.empty();
5603
Lex->value_list.empty();
5662
5605
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
5663
5606
opt_load_data_set_spec
5709
5652
| OPTIONALLY ENCLOSED BY text_string
5712
assert(lex->exchange != 0);
5713
lex->exchange->enclosed= $4;
5714
lex->exchange->opt_enclosed= 1;
5654
assert(Lex->exchange != 0);
5655
Lex->exchange->enclosed= $4;
5656
Lex->exchange->opt_enclosed= 1;
5716
5658
| ENCLOSED BY text_string
5947
5889
simple_ident_q:
5948
5890
ident '.' ident
5950
LEX *lex= YYSession->lex;
5953
Select_Lex *sel= lex->current_select;
5893
Select_Lex *sel= Lex->current_select;
5954
5894
if (sel->no_table_names_allowed)
5956
5896
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
5967
5907
| '.' ident '.' ident
5969
LEX *lex= YYSession->lex;
5970
Select_Lex *sel= lex->current_select;
5909
Select_Lex *sel= Lex->current_select;
5971
5910
if (sel->no_table_names_allowed)
5973
5912
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
5982
5921
| ident '.' ident '.' ident
5984
LEX *lex= YYSession->lex;
5985
Select_Lex *sel= lex->current_select;
5923
Select_Lex *sel= Lex->current_select;
5986
5924
if (sel->no_table_names_allowed)
5988
5926
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
6275
lex->sql_command= SQLCOM_SET_OPTION;
6212
Lex->sql_command= SQLCOM_SET_OPTION;
6276
6213
statement::SetOption *statement= new(std::nothrow) statement::SetOption(YYSession);
6277
lex->statement= statement;
6278
if (lex->statement == NULL)
6214
Lex->statement= statement;
6215
if (Lex->statement == NULL)
6279
6216
DRIZZLE_YYABORT;
6281
lex->option_type=OPT_SESSION;
6282
lex->var_list.empty();
6218
Lex->option_type=OPT_SESSION;
6219
Lex->var_list.empty();
6284
6221
option_value_list
6337
6274
sys_option_value:
6338
6275
option_type internal_variable_name equal set_expr_or_default
6343
6278
{ /* System variable */
6345
lex->option_type= $1;
6346
lex->var_list.push_back(new set_var(lex->option_type, $2.var,
6280
Lex->option_type= $1;
6281
Lex->var_list.push_back(new set_var(Lex->option_type, $2.var,
6347
6282
&$2.base_name, $4));
6350
6285
| option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
6353
lex->option_type= $1;
6354
lex->var_list.push_back(new set_var(lex->option_type,
6287
Lex->option_type= $1;
6288
Lex->var_list.push_back(new set_var(Lex->option_type,
6355
6289
find_sys_var("tx_isolation"),
6357
6291
new Item_int((int32_t) $5)));
6366
6300
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
6369
lex->var_list.push_back(new set_var($3, $4.var, &$4.base_name, $6));
6302
Lex->var_list.push_back(new set_var($3, $4.var, &$4.base_name, $6));
6412
lex->sql_command= SQLCOM_UNLOCK_TABLES;
6413
lex->statement= new(std::nothrow) statement::UnlockTables(YYSession);
6414
if (lex->statement == NULL)
6344
Lex->sql_command= SQLCOM_UNLOCK_TABLES;
6345
Lex->statement= new(std::nothrow) statement::UnlockTables(YYSession);
6346
if (Lex->statement == NULL)
6415
6347
DRIZZLE_YYABORT;
6417
6349
table_or_tables
6425
lex->sql_command = SQLCOM_BEGIN;
6426
lex->statement= new(std::nothrow) statement::StartTransaction(YYSession);
6427
if (lex->statement == NULL)
6356
Lex->sql_command = SQLCOM_BEGIN;
6357
Lex->statement= new(std::nothrow) statement::StartTransaction(YYSession);
6358
if (Lex->statement == NULL)
6428
6359
DRIZZLE_YYABORT;
6458
6389
COMMIT_SYM opt_work opt_chain opt_release
6461
lex->sql_command= SQLCOM_COMMIT;
6391
Lex->sql_command= SQLCOM_COMMIT;
6462
6392
statement::Commit *statement= new(std::nothrow) statement::Commit(YYSession);
6463
lex->statement= statement;
6464
if (lex->statement == NULL)
6393
Lex->statement= statement;
6394
if (Lex->statement == NULL)
6465
6395
DRIZZLE_YYABORT;
6466
6396
statement->tx_chain= $3;
6467
6397
statement->tx_release= $4;
6472
6402
ROLLBACK_SYM opt_work opt_chain opt_release
6475
lex->sql_command= SQLCOM_ROLLBACK;
6404
Lex->sql_command= SQLCOM_ROLLBACK;
6476
6405
statement::Rollback *statement= new(std::nothrow) statement::Rollback(YYSession);
6477
lex->statement= statement;
6478
if (lex->statement == NULL)
6406
Lex->statement= statement;
6407
if (Lex->statement == NULL)
6479
6408
DRIZZLE_YYABORT;
6480
6409
statement->tx_chain= $3;
6481
6410
statement->tx_release= $4;
6483
6412
| ROLLBACK_SYM opt_work
6484
6413
TO_SYM opt_savepoint ident
6487
lex->sql_command= SQLCOM_ROLLBACK_TO_SAVEPOINT;
6488
lex->statement= new(std::nothrow) statement::RollbackToSavepoint(YYSession);
6489
if (lex->statement == NULL)
6415
Lex->sql_command= SQLCOM_ROLLBACK_TO_SAVEPOINT;
6416
Lex->statement= new(std::nothrow) statement::RollbackToSavepoint(YYSession);
6417
if (Lex->statement == NULL)
6490
6418
DRIZZLE_YYABORT;
6496
6424
SAVEPOINT_SYM ident
6499
lex->sql_command= SQLCOM_SAVEPOINT;
6500
lex->statement= new(std::nothrow) statement::Savepoint(YYSession);
6501
if (lex->statement == NULL)
6426
Lex->sql_command= SQLCOM_SAVEPOINT;
6427
Lex->statement= new(std::nothrow) statement::Savepoint(YYSession);
6428
if (Lex->statement == NULL)
6502
6429
DRIZZLE_YYABORT;
6508
6435
RELEASE_SYM SAVEPOINT_SYM ident
6511
lex->sql_command= SQLCOM_RELEASE_SAVEPOINT;
6512
lex->statement= new(std::nothrow) statement::ReleaseSavepoint(YYSession);
6513
if (lex->statement == NULL)
6437
Lex->sql_command= SQLCOM_RELEASE_SAVEPOINT;
6438
Lex->statement= new(std::nothrow) statement::ReleaseSavepoint(YYSession);
6439
if (Lex->statement == NULL)
6514
6440
DRIZZLE_YYABORT;
6551
6477
union_order_or_limit:
6553
LEX *lex= YYSession->lex;
6554
assert(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE);
6555
Select_Lex *sel= lex->current_select;
6479
assert(Lex->current_select->linkage != GLOBAL_OPTIONS_TYPE);
6480
Select_Lex *sel= Lex->current_select;
6556
6481
Select_Lex_Unit *unit= sel->master_unit();
6557
6482
Select_Lex *fake= unit->fake_select_lex;
6560
6485
unit->global_parameters= fake;
6561
6486
fake->no_table_names_allowed= 1;
6562
lex->current_select= fake;
6487
Lex->current_select= fake;
6564
6489
YYSession->where= "global ORDER clause";
6643
Select_Lex *child= lex->current_select;
6644
lex->current_select = lex->current_select->return_after_parsing();
6646
lex->current_select->n_child_sum_items += child->n_sum_items;
6566
Select_Lex *child= Lex->current_select;
6567
Lex->current_select= Lex->current_select->return_after_parsing();
6569
Lex->current_select->n_child_sum_items += child->n_sum_items;
6648
6571
A subselect can add fields to an outer select. Reserve space for
6651
lex->current_select->select_n_where_fields+=
6574
Lex->current_select->select_n_where_fields+=
6652
6575
child->select_n_where_fields;