851
851
CREATE CATALOG_SYM catalog_name
853
Lex->statement= new statement::catalog::Create(YYSession, $3);
853
Lex.statement= new statement::catalog::Create(YYSession, $3);
855
855
| CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident
857
Lex->statement= new statement::CreateTable(YYSession, $5, $2);
857
Lex.statement= new statement::CreateTable(YYSession, $5, $2);
859
if (not Lex->select_lex.add_table_to_list(YYSession, $5, NULL,
859
if (not Lex.select_lex.add_table_to_list(YYSession, $5, NULL,
860
860
TL_OPTION_UPDATING,
863
Lex->col_list.clear();
863
Lex.col_list.clear();
865
865
create_table_definition
867
Lex->current_select= &Lex->select_lex;
867
Lex.current_select= &Lex.select_lex;
869
869
| CREATE build_method
871
Lex->statement= new statement::CreateIndex(YYSession, $2);
871
Lex.statement= new statement::CreateIndex(YYSession, $2);
873
873
opt_unique INDEX_SYM ident key_alg ON table_ident '(' key_list ')' key_options
875
if (not Lex->current_select->add_table_to_list(Lex->session, $9,
875
if (not Lex.current_select->add_table_to_list(Lex.session, $9,
877
877
TL_OPTION_UPDATING))
880
parser::buildKey(Lex, $4, $6);
880
parser::buildKey(&Lex, $4, $6);
882
882
| CREATE DATABASE opt_if_not_exists schema_name
884
Lex->statement= new statement::CreateSchema(YYSession);
884
Lex.statement= new statement::CreateSchema(YYSession);
886
886
opt_create_database_options
944
Lex->lock_option= TL_READ;
945
if (Lex->sql_command == SQLCOM_INSERT)
944
Lex.lock_option= TL_READ;
945
if (Lex.sql_command == SQLCOM_INSERT)
947
delete Lex->statement;
948
Lex->statement= new statement::InsertSelect(YYSession);
947
delete Lex.statement;
948
Lex.statement= new statement::InsertSelect(YYSession);
950
else if (Lex->sql_command == SQLCOM_REPLACE)
950
else if (Lex.sql_command == SQLCOM_REPLACE)
952
delete Lex->statement;
953
Lex->statement= new statement::ReplaceSelect(YYSession);
952
delete Lex.statement;
953
Lex.statement= new statement::ReplaceSelect(YYSession);
956
956
The following work only with the local list, the global list
957
957
is created correctly in this case
959
Lex->current_select->table_list.save_and_clear(&Lex->save_list);
961
Lex->current_select->parsing_place= SELECT_LIST;
959
Lex.current_select->table_list.save_and_clear(&Lex.save_list);
961
Lex.current_select->parsing_place= SELECT_LIST;
963
963
select_options select_item_list
965
Lex->current_select->parsing_place= NO_MATTER;
965
Lex.current_select->parsing_place= NO_MATTER;
988
988
custom_database_option:
991
statement::CreateSchema *statement= (statement::CreateSchema *)Lex->statement;
991
statement::CreateSchema *statement= (statement::CreateSchema *)Lex.statement;
992
992
statement->schema_message.mutable_engine()->add_options()->set_name($1.str);
994
994
| REPLICATE opt_equal TRUE_SYM
996
parser::buildReplicationOption(Lex, true);
996
parser::buildReplicationOption(&Lex, true);
998
998
| REPLICATE opt_equal FALSE_SYM
1000
parser::buildReplicationOption(Lex, false);
1000
parser::buildReplicationOption(&Lex, false);
1002
1002
| ident_or_text equal ident_or_text
1004
parser::buildSchemaOption(Lex, $1.str, $3);
1004
parser::buildSchemaOption(&Lex, $1.str, $3);
1006
1006
| ident_or_text equal ulonglong_num
1008
parser::buildSchemaOption(Lex, $1.str, $3);
1008
parser::buildSchemaOption(&Lex, $1.str, $3);
1040
1040
custom_engine_option:
1041
1041
ENGINE_SYM equal ident_or_text
1043
Lex->table()->mutable_engine()->set_name($3.str);
1043
Lex.table()->mutable_engine()->set_name($3.str);
1045
1045
| COMMENT_SYM opt_equal TEXT_STRING_sys
1047
Lex->table()->mutable_options()->set_comment($3.str);
1047
Lex.table()->mutable_options()->set_comment($3.str);
1049
1049
| AUTO_INC opt_equal ulonglong_num
1051
Lex->table()->mutable_options()->set_auto_increment_value($3);
1051
Lex.table()->mutable_options()->set_auto_increment_value($3);
1053
1053
| REPLICATE opt_equal TRUE_SYM
1055
message::set_is_replicated(*Lex->table(), true);
1055
message::set_is_replicated(*Lex.table(), true);
1057
1057
| REPLICATE opt_equal FALSE_SYM
1059
message::set_is_replicated(*Lex->table(), false);
1059
message::set_is_replicated(*Lex.table(), false);
1061
1061
| ROW_FORMAT_SYM equal row_format_or_text
1063
parser::buildEngineOption(Lex, "ROW_FORMAT", $3);
1063
parser::buildEngineOption(&Lex, "ROW_FORMAT", $3);
1065
1065
| FILE_SYM equal TEXT_STRING_sys
1067
parser::buildEngineOption(Lex, "FILE", $3);
1067
parser::buildEngineOption(&Lex, "FILE", $3);
1069
1069
| ident_or_text equal engine_option_value
1071
parser::buildEngineOption(Lex, $1.str, $3);
1071
parser::buildEngineOption(&Lex, $1.str, $3);
1073
1073
| ident_or_text equal ulonglong_num
1075
parser::buildEngineOption(Lex, $1.str, $3);
1075
parser::buildEngineOption(&Lex, $1.str, $3);
1077
1077
| default_collation
1130
1130
field_spec opt_check_constraint
1131
1131
| field_spec references
1133
Lex->col_list.clear(); /* Alloced by memory::sql_alloc */
1133
Lex.col_list.clear(); /* Alloced by memory::sql_alloc */
1138
1138
key_type opt_ident key_alg '(' key_list ')' key_options
1140
parser::buildKey(Lex, $1, $2);
1140
parser::buildKey(&Lex, $1, $2);
1142
1142
| opt_constraint constraint_key_type opt_ident key_alg
1143
1143
'(' key_list ')' key_options
1145
parser::buildKey(Lex, $2, $3.str ? $3 : $1);
1145
parser::buildKey(&Lex, $2, $3.str ? $3 : $1);
1147
1147
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
1149
parser::buildForeignKey(Lex, $1.str ? $1 : $4, $8);
1149
parser::buildForeignKey(&Lex, $1.str ? $1 : $4, $8);
1151
1151
| constraint opt_check_constraint
1153
Lex->col_list.clear(); /* Alloced by memory::sql_alloc */
1153
Lex.col_list.clear(); /* Alloced by memory::sql_alloc */
1155
1155
| opt_constraint check_constraint
1157
Lex->col_list.clear(); /* Alloced by memory::sql_alloc */
1157
Lex.col_list.clear(); /* Alloced by memory::sql_alloc */
1182
parser::buildCreateFieldIdent(Lex);
1182
parser::buildCreateFieldIdent(&Lex);
1184
1184
field_def opt_attribute_comment
1186
statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1186
statement::CreateTable *statement= (statement::CreateTable *)Lex.statement;
1190
Lex->field()->set_name($1.str);
1190
Lex.field()->set_name($1.str);
1193
if (add_field_to_list(Lex->session, &$1, (enum enum_field_types) $3,
1194
Lex->length, Lex->dec, Lex->type,
1193
if (add_field_to_list(Lex.session, &$1, (enum enum_field_types) $3,
1194
Lex.length, Lex.dec, Lex.type,
1195
1195
statement->column_format,
1196
1196
statement->default_value, statement->on_update_value,
1197
1197
&statement->comment,
1198
statement->change, &Lex->interval_list, Lex->charset))
1198
statement->change, &Lex.interval_list, Lex.charset))
1199
1199
DRIZZLE_YYABORT;
1201
Lex->setField(NULL);
1206
1206
TIMESTAMP_SYM opt_attribute_timestamp
1208
$$=parser::buildTimestampColumn(Lex, NULL);
1208
$$=parser::buildTimestampColumn(&Lex, NULL);
1210
1210
| TIMESTAMP_SYM '(' NUM ')' opt_attribute_timestamp
1212
$$=parser::buildTimestampColumn(Lex, $3.str);
1212
$$=parser::buildTimestampColumn(&Lex, $3.str);
1214
1214
| DATETIME_SYM opt_attribute_timestamp
1216
1216
$$=DRIZZLE_TYPE_DATETIME;
1219
Lex->field()->set_type(message::Table::Field::DATETIME);
1219
Lex.field()->set_type(message::Table::Field::DATETIME);
1221
1221
| int_type opt_attribute_number
1225
1225
| CHAR_SYM opt_attribute_string
1227
$$= parser::buildVarcharColumn(Lex, "1");
1227
$$= parser::buildVarcharColumn(&Lex, "1");
1229
1229
| varchar '(' NUM ')' opt_attribute_string
1231
$$= parser::buildVarcharColumn(Lex, $3.str);
1231
$$= parser::buildVarcharColumn(&Lex, $3.str);
1233
1233
| TEXT_SYM opt_attribute_string
1235
1235
$$=DRIZZLE_TYPE_BLOB;
1236
Lex->length=(char*) 0; /* use default length */
1236
Lex.length=(char*) 0; /* use default length */
1239
Lex->field()->set_type(message::Table::Field::BLOB);
1239
Lex.field()->set_type(message::Table::Field::BLOB);
1243
Lex->interval_list.clear();
1243
Lex.interval_list.clear();
1245
1245
'(' string_list ')' opt_attribute_string
1247
1247
$$=DRIZZLE_TYPE_ENUM;
1250
Lex->field()->set_type(message::Table::Field::ENUM);
1250
Lex.field()->set_type(message::Table::Field::ENUM);
1252
1252
| VARBINARY '(' NUM ')' opt_attribute
1254
$$= parser::buildVarbinaryColumn(Lex, $3.str);
1254
$$= parser::buildVarbinaryColumn(&Lex, $3.str);
1256
1256
| real_type opt_attribute_number
1258
1258
assert ($1 == DRIZZLE_TYPE_DOUBLE);
1259
$$= parser::buildDoubleColumn(Lex);
1259
$$= parser::buildDoubleColumn(&Lex);
1261
1261
| DATE_SYM opt_attribute
1263
1263
$$=DRIZZLE_TYPE_DATE;
1266
Lex->field()->set_type(message::Table::Field::DATE);
1266
Lex.field()->set_type(message::Table::Field::DATE);
1268
1268
| TIME_SYM opt_attribute
1270
1270
$$=DRIZZLE_TYPE_TIME;
1273
Lex->field()->set_type(message::Table::Field::TIME);
1273
Lex.field()->set_type(message::Table::Field::TIME);
1275
1275
| BLOB_SYM opt_attribute
1277
$$= parser::buildBlobColumn(Lex);
1277
$$= parser::buildBlobColumn(&Lex);
1279
1279
| DECIMAL_SYM float_options opt_attribute_number
1281
$$= parser::buildDecimalColumn(Lex);
1281
$$= parser::buildDecimalColumn(&Lex);
1283
1283
| NUMERIC_SYM float_options opt_attribute_number
1285
$$= parser::buildDecimalColumn(Lex);
1285
$$= parser::buildDecimalColumn(&Lex);
1287
1287
| FIXED_SYM float_options opt_attribute_number
1289
$$= parser::buildDecimalColumn(Lex);
1289
$$= parser::buildDecimalColumn(&Lex);
1291
1291
| UUID_SYM opt_attribute
1293
$$= parser::buildUuidColumn(Lex);
1293
$$= parser::buildUuidColumn(&Lex);
1295
1295
| BOOLEAN_SYM opt_attribute_boolean
1297
$$= parser::buildBooleanColumn(Lex);
1297
$$= parser::buildBooleanColumn(&Lex);
1301
$$= parser::buildSerialColumn(Lex);
1301
$$= parser::buildSerialColumn(&Lex);
1599
{ Lex->ref_list.clear(); }
1599
{ Lex.ref_list.clear(); }
1600
1600
| '(' ref_list ')'
1604
1604
ref_list ',' ident
1605
{ Lex->ref_list.push_back(new Key_part_spec($3, 0)); }
1605
{ Lex.ref_list.push_back(new Key_part_spec($3, 0)); }
1608
Lex->ref_list.clear();
1609
Lex->ref_list.push_back(new Key_part_spec($1, 0));
1608
Lex.ref_list.clear();
1609
Lex.ref_list.push_back(new Key_part_spec($1, 0));
1613
1613
opt_match_clause:
1615
{ ((statement::CreateTable *)Lex->statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_UNDEFINED; }
1615
{ ((statement::CreateTable *)Lex.statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_UNDEFINED; }
1617
{ ((statement::CreateTable *)Lex->statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_FULL; }
1617
{ ((statement::CreateTable *)Lex.statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_FULL; }
1618
1618
| MATCH PARTIAL
1619
{ ((statement::CreateTable *)Lex->statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_PARTIAL; }
1619
{ ((statement::CreateTable *)Lex.statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_PARTIAL; }
1620
1620
| MATCH SIMPLE_SYM
1621
{ ((statement::CreateTable *)Lex->statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_SIMPLE; }
1621
{ ((statement::CreateTable *)Lex.statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_SIMPLE; }
1624
1624
opt_on_update_delete:
1627
((statement::CreateTable *)Lex->statement)->fk_update_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF;
1628
((statement::CreateTable *)Lex->statement)->fk_delete_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF;
1627
((statement::CreateTable *)Lex.statement)->fk_update_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF;
1628
((statement::CreateTable *)Lex.statement)->fk_delete_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF;
1630
1630
| ON UPDATE_SYM delete_option
1632
((statement::CreateTable *)Lex->statement)->fk_update_opt= $3;
1633
((statement::CreateTable *)Lex->statement)->fk_delete_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF;
1632
((statement::CreateTable *)Lex.statement)->fk_update_opt= $3;
1633
((statement::CreateTable *)Lex.statement)->fk_delete_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF;
1635
1635
| ON DELETE_SYM delete_option
1637
((statement::CreateTable *)Lex->statement)->fk_update_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF;
1638
((statement::CreateTable *)Lex->statement)->fk_delete_opt= $3;
1637
((statement::CreateTable *)Lex.statement)->fk_update_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF;
1638
((statement::CreateTable *)Lex.statement)->fk_delete_opt= $3;
1640
1640
| ON UPDATE_SYM delete_option
1641
1641
ON DELETE_SYM delete_option
1643
((statement::CreateTable *)Lex->statement)->fk_update_opt= $3;
1644
((statement::CreateTable *)Lex->statement)->fk_delete_opt= $6;
1643
((statement::CreateTable *)Lex.statement)->fk_update_opt= $3;
1644
((statement::CreateTable *)Lex.statement)->fk_delete_opt= $6;
1646
1646
| ON DELETE_SYM delete_option
1647
1647
ON UPDATE_SYM delete_option
1649
((statement::CreateTable *)Lex->statement)->fk_update_opt= $6;
1650
((statement::CreateTable *)Lex->statement)->fk_delete_opt= $3;
1649
((statement::CreateTable *)Lex.statement)->fk_update_opt= $6;
1650
((statement::CreateTable *)Lex.statement)->fk_delete_opt= $3;
1773
1773
ALTER_SYM build_method opt_ignore TABLE_SYM table_ident
1775
1775
statement::AlterTable *statement= new statement::AlterTable(YYSession, $5, $2);
1776
Lex->statement= statement;
1777
Lex->duplicates= DUP_ERROR;
1778
if (not Lex->select_lex.add_table_to_list(YYSession, $5, NULL, TL_OPTION_UPDATING))
1776
Lex.statement= statement;
1777
Lex.duplicates= DUP_ERROR;
1778
if (not Lex.select_lex.add_table_to_list(YYSession, $5, NULL, TL_OPTION_UPDATING))
1780
1780
DRIZZLE_YYABORT;
1783
Lex->col_list.clear();
1784
Lex->select_lex.init_order();
1785
Lex->select_lex.db= const_cast<char *>(((TableList*) Lex->select_lex.table_list.first)->getSchemaName());
1783
Lex.col_list.clear();
1784
Lex.select_lex.init_order();
1785
Lex.select_lex.db= const_cast<char *>(((TableList*) Lex.select_lex.table_list.first)->getSchemaName());
1789
1789
| ALTER_SYM DATABASE schema_name
1791
Lex->statement= new statement::AlterSchema(YYSession);
1791
Lex.statement= new statement::AlterSchema(YYSession);
1793
1793
default_collation_schema
1796
if (Lex->name.str == NULL && Lex->copy_db_to(&Lex->name.str, &Lex->name.length))
1796
if (Lex.name.str == NULL && Lex.copy_db_to(&Lex.name.str, &Lex.name.length))
1797
1797
DRIZZLE_YYABORT;
1847
1847
add_column column_def opt_place { }
1848
1848
| ADD_SYM key_def
1850
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1850
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1852
1852
statement->alter_info.flags.set(ALTER_ADD_INDEX);
1854
1854
| add_column '(' field_list ')'
1856
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1856
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1858
1858
statement->alter_info.flags.set(ALTER_ADD_COLUMN);
1859
1859
statement->alter_info.flags.set(ALTER_ADD_INDEX);
1861
1861
| CHANGE_SYM opt_column field_ident
1863
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1863
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1864
1864
statement->change= $3.str;
1865
1865
statement->alter_info.flags.set(ALTER_CHANGE_COLUMN);
1867
1867
field_spec opt_place
1868
1868
| MODIFY_SYM opt_column field_ident
1870
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1871
Lex->length= Lex->dec=0;
1870
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1871
Lex.length= Lex.dec=0;
1873
1873
statement->default_value= statement->on_update_value= 0;
1874
1874
statement->comment= null_lex_str;
1876
1876
statement->alter_info.flags.set(ALTER_CHANGE_COLUMN);
1877
1877
statement->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
1879
Lex->setField(NULL);
1881
1881
field_def opt_attribute_comment
1883
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1883
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1885
if (add_field_to_list(Lex->session,&$3,
1885
if (add_field_to_list(Lex.session,&$3,
1886
1886
(enum enum_field_types) $5,
1887
Lex->length, Lex->dec, Lex->type,
1887
Lex.length, Lex.dec, Lex.type,
1888
1888
statement->column_format,
1889
1889
statement->default_value,
1890
1890
statement->on_update_value,
1891
1891
&statement->comment,
1892
$3.str, &Lex->interval_list, Lex->charset))
1892
$3.str, &Lex.interval_list, Lex.charset))
1893
1893
DRIZZLE_YYABORT;
1896
1896
| DROP opt_column field_ident
1898
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1898
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1900
1900
statement->alter_info.drop_list.push_back(AlterDrop(AlterDrop::COLUMN, $3.str));
1901
1901
statement->alter_info.flags.set(ALTER_DROP_COLUMN);
1903
1903
| DROP FOREIGN KEY_SYM opt_ident
1905
parser::buildAddAlterDropIndex(Lex, $4.str, true);
1905
parser::buildAddAlterDropIndex(&Lex, $4.str, true);
1907
1907
| DROP PRIMARY_SYM KEY_SYM
1909
parser::buildAddAlterDropIndex(Lex, "PRIMARY");
1909
parser::buildAddAlterDropIndex(&Lex, "PRIMARY");
1911
1911
| DROP key_or_index field_ident
1913
parser::buildAddAlterDropIndex(Lex, $3.str);
1913
parser::buildAddAlterDropIndex(&Lex, $3.str);
1915
1915
| DISABLE_SYM KEYS
1917
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1917
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1919
1919
statement->alter_info.keys_onoff= DISABLE;
1920
1920
statement->alter_info.flags.set(ALTER_KEYS_ONOFF);
1922
1922
| ENABLE_SYM KEYS
1924
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1924
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1926
1926
statement->alter_info.keys_onoff= ENABLE;
1927
1927
statement->alter_info.flags.set(ALTER_KEYS_ONOFF);
1929
1929
| ALTER_SYM opt_column field_ident SET_SYM DEFAULT signed_literal
1931
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1931
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1933
1933
statement->alter_info.alter_list.push_back(AlterColumn($3.str,$6));
1934
1934
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
1936
1936
| ALTER_SYM opt_column field_ident DROP DEFAULT
1938
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1938
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1940
1940
statement->alter_info.alter_list.push_back(AlterColumn($3.str, (Item*) 0));
1941
1941
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
1943
1943
| RENAME opt_to table_ident
1945
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1945
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement;
1948
Lex->select_lex.db=$3->db.str;
1949
if (Lex->select_lex.db == NULL &&
1950
Lex->copy_db_to(&Lex->select_lex.db, &dummy))
1948
Lex.select_lex.db=$3->db.str;
1949
if (Lex.select_lex.db == NULL &&
1950
Lex.copy_db_to(&Lex.select_lex.db, &dummy))
1952
1952
DRIZZLE_YYABORT;
2687
2687
{ $$= new (YYSession->mem_root) Item_func_case(* $3, $2, $4 ); }
2688
2688
| CONVERT_SYM '(' expr ',' cast_type ')'
2690
$$= create_func_cast(YYSession, $3, $5, Lex->length, Lex->dec,
2690
$$= create_func_cast(YYSession, $3, $5, Lex.length, Lex.dec,
2693
2693
DRIZZLE_YYABORT;
2695
2695
| DEFAULT '(' simple_ident ')'
2697
$$= new (YYSession->mem_root) Item_default_value(Lex->current_context(),
2697
$$= new (YYSession->mem_root) Item_default_value(Lex.current_context(),
2700
2700
| VALUES '(' simple_ident ')'
2702
$$= new (YYSession->mem_root) Item_insert_value(Lex->current_context(),
2702
$$= new (YYSession->mem_root) Item_insert_value(Lex.current_context(),
2705
2705
| INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
3226
Lex->current_select->in_sum_expr--;
3226
Lex.current_select->in_sum_expr--;
3233
{ $$=ITEM_CAST_CHAR; Lex->charset= &my_charset_bin; Lex->dec= 0; }
3233
{ $$=ITEM_CAST_CHAR; Lex.charset= &my_charset_bin; Lex.dec= 0; }
3235
{ $$=ITEM_CAST_BOOLEAN; Lex->charset= &my_charset_bin; Lex->dec= 0; }
3235
{ $$=ITEM_CAST_BOOLEAN; Lex.charset= &my_charset_bin; Lex.dec= 0; }
3237
{ $$=ITEM_CAST_SIGNED; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
3237
{ $$=ITEM_CAST_SIGNED; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; }
3238
3238
| SIGNED_SYM INT_SYM
3239
{ $$=ITEM_CAST_SIGNED; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
3239
{ $$=ITEM_CAST_SIGNED; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; }
3241
{ $$=ITEM_CAST_SIGNED; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
3241
{ $$=ITEM_CAST_SIGNED; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; }
3243
{ $$=ITEM_CAST_UNSIGNED; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
3243
{ $$=ITEM_CAST_UNSIGNED; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; }
3244
3244
| UNSIGNED_SYM INT_SYM
3245
{ $$=ITEM_CAST_UNSIGNED; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
3245
{ $$=ITEM_CAST_UNSIGNED; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; }
3246
3246
| CHAR_SYM opt_len
3247
{ $$=ITEM_CAST_CHAR; Lex->dec= 0; }
3247
{ $$=ITEM_CAST_CHAR; Lex.dec= 0; }
3249
{ $$=ITEM_CAST_DATE; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
3249
{ $$=ITEM_CAST_DATE; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; }
3251
{ $$=ITEM_CAST_TIME; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
3251
{ $$=ITEM_CAST_TIME; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; }
3253
{ $$=ITEM_CAST_DATETIME; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
3253
{ $$=ITEM_CAST_DATETIME; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; }
3254
3254
| DECIMAL_SYM float_options
3255
{ $$=ITEM_CAST_DECIMAL; Lex->charset= NULL; }
3255
{ $$=ITEM_CAST_DECIMAL; Lex.charset= NULL; }
3345
3345
left-associative joins.
3347
3347
table_ref normal_join table_ref %prec TABLE_REF_PRIORITY
3349
3349
DRIZZLE_YYABORT_UNLESS($1 && ($$=$3));
3350
Lex->is_cross= false;
3350
Lex.is_cross= false;
3352
3352
| table_ref STRAIGHT_JOIN table_factor
3354
DRIZZLE_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1;
3354
DRIZZLE_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1;
3356
3356
| table_ref normal_join table_ref
3359
3359
DRIZZLE_YYABORT_UNLESS($1 && $3);
3360
DRIZZLE_YYABORT_UNLESS( not Lex->is_cross );
3360
DRIZZLE_YYABORT_UNLESS( not Lex.is_cross );
3361
3361
/* Change the current name resolution context to a local context. */
3362
3362
if (push_new_name_resolution_context(YYSession, $1, $3))
3363
3363
DRIZZLE_YYABORT;
3364
Lex->current_select->parsing_place= IN_ON;
3364
Lex.current_select->parsing_place= IN_ON;
3368
3368
add_join_on($3,$6);
3370
Lex->current_select->parsing_place= NO_MATTER;
3370
Lex.current_select->parsing_place= NO_MATTER;
3372
3372
| table_ref STRAIGHT_JOIN table_factor
3459
3459
USING '(' using_list ')'
3461
if (!($$= Lex->current_select->convert_right_join()))
3461
if (!($$= Lex.current_select->convert_right_join()))
3462
3462
DRIZZLE_YYABORT;
3463
add_join_natural($$,$5,$9,Lex->current_select);
3463
add_join_natural($$,$5,$9,Lex.current_select);
3465
3465
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor
3467
3467
DRIZZLE_YYABORT_UNLESS($1 && $6);
3468
add_join_natural($6,$1,NULL,Lex->current_select);
3469
if (!($$= Lex->current_select->convert_right_join()))
3468
add_join_natural($6,$1,NULL,Lex.current_select);
3469
if (!($$= Lex.current_select->convert_right_join()))
3470
3470
DRIZZLE_YYABORT;
3558
3558
/* Handle case of derived table, alias may be NULL if there
3559
3559
are no outer parentheses, add_table_to_list() will throw
3560
3560
error in this case */
3561
Select_Lex *sel= Lex->current_select;
3561
Select_Lex *sel= Lex.current_select;
3562
3562
Select_Lex_Unit *unit= sel->master_unit();
3563
Lex->current_select= sel= unit->outer_select();
3564
if (!($$= sel->add_table_to_list(Lex->session,
3563
Lex.current_select= sel= unit->outer_select();
3564
if (!($$= sel->add_table_to_list(Lex.session,
3565
3565
new Table_ident(unit), $5, 0,
3568
3568
DRIZZLE_YYABORT;
3569
3569
sel->add_joined_table($$);
3572
3572
else if (($3->select_lex && $3->select_lex->master_unit()->is_union()) || $5)
3660
3660
select_derived2:
3662
Lex->derived_tables|= DERIVED_SUBQUERY;
3663
if (not Lex->expr_allows_subselect)
3662
Lex.derived_tables|= DERIVED_SUBQUERY;
3663
if (not Lex.expr_allows_subselect)
3665
3665
parser::my_parse_error(YYSession->m_lip);
3666
3666
DRIZZLE_YYABORT;
3668
if (Lex->current_select->linkage == GLOBAL_OPTIONS_TYPE || new_select(Lex, 1))
3668
if (Lex.current_select->linkage == GLOBAL_OPTIONS_TYPE || new_select(&Lex, 1))
3669
3669
DRIZZLE_YYABORT;
3671
Lex->current_select->linkage= DERIVED_TABLE_TYPE;
3672
Lex->current_select->parsing_place= SELECT_LIST;
3671
Lex.current_select->linkage= DERIVED_TABLE_TYPE;
3672
Lex.current_select->parsing_place= SELECT_LIST;
3674
3674
select_options select_item_list
3676
Lex->current_select->parsing_place= NO_MATTER;
3676
Lex.current_select->parsing_place= NO_MATTER;
3678
3678
opt_select_from
3681
3681
get_select_lex:
3682
/* Empty */ { $$= Lex->current_select; }
3682
/* Empty */ { $$= Lex.current_select; }
3685
3685
select_derived_init:
3688
Select_Lex *sel= Lex->current_select;
3688
Select_Lex *sel= Lex.current_select;
3689
3689
TableList *embedding;
3690
if (!sel->embedding || sel->end_nested_join(Lex->session))
3690
if (!sel->embedding || sel->end_nested_join(Lex.session))
3692
3692
/* we are not in parentheses */
3693
3693
parser::my_parse_error(YYSession->m_lip);
3694
3694
DRIZZLE_YYABORT;
3696
embedding= Lex->current_select->embedding;
3696
embedding= Lex.current_select->embedding;
3697
3697
$$= embedding &&
3698
3698
!embedding->getNestedJoin()->join_list.size();
3699
3699
/* return true if we are deeply nested */
3741
3741
opt_index_hints_list:
3743
| { Lex->current_select->alloc_index_hints(YYSession); } index_hints_list
3743
| { Lex.current_select->alloc_index_hints(YYSession); } index_hints_list
3746
3746
opt_key_definition:
3747
{ Lex->current_select->clear_index_hints(); }
3747
{ Lex.current_select->clear_index_hints(); }
3748
3748
opt_index_hints_list
3751
3751
opt_key_usage_list:
3752
/* empty */ { Lex->current_select->add_index_hint(YYSession, NULL, 0); }
3752
/* empty */ { Lex.current_select->add_index_hint(YYSession, NULL, 0); }
3753
3753
| key_usage_list {}
3756
3756
key_usage_element:
3758
{ Lex->current_select->add_index_hint(YYSession, $1.str, $1.length); }
3758
{ Lex.current_select->add_index_hint(YYSession, $1.str, $1.length); }
3760
{ Lex->current_select->add_index_hint(YYSession, (char *)"PRIMARY", 7); }
3760
{ Lex.current_select->add_index_hint(YYSession, (char *)"PRIMARY", 7); }
3763
3763
key_usage_list:
4108
4108
into_destination:
4109
4109
OUTFILE TEXT_STRING_filesystem
4111
Lex->setCacheable(false);
4112
if (!(Lex->exchange= new file_exchange($2.str, 0)) ||
4113
!(Lex->result= new select_export(Lex->exchange)))
4111
Lex.setCacheable(false);
4112
if (!(Lex.exchange= new file_exchange($2.str, 0)) ||
4113
!(Lex.result= new select_export(Lex.exchange)))
4114
4114
DRIZZLE_YYABORT;
4116
4116
opt_field_term opt_line_term
4117
4117
| DUMPFILE TEXT_STRING_filesystem
4119
if (not Lex->describe)
4119
if (not Lex.describe)
4121
Lex->setCacheable(false);
4122
if (not (Lex->exchange= new file_exchange($2.str,1)))
4121
Lex.setCacheable(false);
4122
if (not (Lex.exchange= new file_exchange($2.str,1)))
4123
4123
DRIZZLE_YYABORT;
4124
if (not (Lex->result= new select_dump(Lex->exchange)))
4124
if (not (Lex.result= new select_dump(Lex.exchange)))
4125
4125
DRIZZLE_YYABORT;
4128
4128
| select_var_list_init
4129
{Lex->setCacheable(false);}
4129
{Lex.setCacheable(false);}
4137
4137
DROP CATALOG_SYM catalog_name
4139
Lex->statement= new statement::catalog::Drop(YYSession, $3);
4139
Lex.statement= new statement::catalog::Drop(YYSession, $3);
4141
4141
| DROP opt_temporary table_or_tables if_exists table_list
4143
4143
statement::DropTable *statement= new statement::DropTable(YYSession);
4144
Lex->statement= statement;
4144
Lex.statement= statement;
4145
4145
statement->drop_temporary= $2;
4146
4146
statement->drop_if_exists= $4;
4148
4148
| DROP build_method INDEX_SYM ident ON table_ident {}
4150
4150
statement::DropIndex *statement= new statement::DropIndex(YYSession);
4151
Lex->statement= statement;
4151
Lex.statement= statement;
4152
4152
statement->alter_info.flags.set(ALTER_DROP_INDEX);
4153
4153
statement->alter_info.build_method= $2;
4154
4154
statement->alter_info.drop_list.push_back(AlterDrop(AlterDrop::KEY, $4.str));
4155
if (not Lex->current_select->add_table_to_list(Lex->session, $6, NULL,
4155
if (not Lex.current_select->add_table_to_list(Lex.session, $6, NULL,
4156
4156
TL_OPTION_UPDATING))
4157
4157
DRIZZLE_YYABORT;
4159
4159
| DROP DATABASE if_exists schema_name
4161
4161
statement::DropSchema *statement= new statement::DropSchema(YYSession);
4162
Lex->statement= statement;
4162
Lex.statement= statement;
4163
4163
statement->drop_if_exists=$3;
4385
4385
UPDATE_SYM opt_ignore table_ident SET_SYM update_list
4388
Lex->statement= new statement::Update(YYSession);
4389
Lex->lock_option= TL_UNLOCK; /* Will be set later */
4390
Lex->duplicates= DUP_ERROR;
4391
if (not Lex->select_lex.add_table_to_list(YYSession, $3, NULL,0))
4388
Lex.statement= new statement::Update(YYSession);
4389
Lex.lock_option= TL_UNLOCK; /* Will be set later */
4390
Lex.duplicates= DUP_ERROR;
4391
if (not Lex.select_lex.add_table_to_list(YYSession, $3, NULL,0))
4392
4392
DRIZZLE_YYABORT;
4394
if (Lex->select_lex.get_table_list()->derived)
4394
if (Lex.select_lex.get_table_list()->derived)
4396
4396
/* it is single table update and it is update of derived table */
4397
4397
my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
4398
Lex->select_lex.get_table_list()->alias, "UPDATE");
4398
Lex.select_lex.get_table_list()->alias, "UPDATE");
4399
4399
DRIZZLE_YYABORT;
4656
4656
table_or_tables
4658
statement::Flush *statement= (statement::Flush*)Lex->statement;
4658
statement::Flush *statement= (statement::Flush*)Lex.statement;
4659
4659
statement->setFlushTables(true);
4661
4661
opt_table_list {}
4662
4662
| TABLES WITH READ_SYM LOCK_SYM
4664
statement::Flush *statement= (statement::Flush*)Lex->statement;
4664
statement::Flush *statement= (statement::Flush*)Lex.statement;
4665
4665
statement->setFlushTablesWithReadLock(true);
4669
statement::Flush *statement= (statement::Flush*)Lex->statement;
4669
statement::Flush *statement= (statement::Flush*)Lex.statement;
4670
4670
statement->setFlushLog(true);
4674
statement::Flush *statement= (statement::Flush*)Lex->statement;
4674
statement::Flush *statement= (statement::Flush*)Lex.statement;
4675
4675
statement->setFlushStatus(true);
4677
4677
| GLOBAL_SYM STATUS_SYM
4679
statement::Flush *statement= (statement::Flush*)Lex->statement;
4679
statement::Flush *statement= (statement::Flush*)Lex.statement;
4680
4680
statement->setFlushGlobalStatus(true);
4719
4719
statement::Load *statement= new statement::Load(YYSession);
4720
Lex->statement= statement;
4720
Lex.statement= statement;
4722
4722
Lex_input_stream *lip= YYSession->m_lip;
4723
4723
statement->fname_start= lip->get_ptr();
4725
4725
load_data_lock INFILE TEXT_STRING_filesystem
4727
Lex->lock_option= $4;
4728
Lex->duplicates= DUP_ERROR;
4730
if (not (Lex->exchange= new file_exchange($6.str, 0, $2)))
4727
Lex.lock_option= $4;
4728
Lex.duplicates= DUP_ERROR;
4730
if (not (Lex.exchange= new file_exchange($6.str, 0, $2)))
4731
4731
DRIZZLE_YYABORT;
4733
4733
opt_duplicate INTO
4735
4735
Lex_input_stream *lip= YYSession->m_lip;
4736
((statement::Load *)Lex->statement)->fname_end= lip->get_ptr();
4736
((statement::Load *)Lex.statement)->fname_end= lip->get_ptr();
4738
4738
TABLE_SYM table_ident
4740
if (!Lex->current_select->add_table_to_list(YYSession,
4740
if (!Lex.current_select->add_table_to_list(YYSession,
4741
4741
$12, NULL, TL_OPTION_UPDATING,
4743
4743
DRIZZLE_YYABORT;
4744
Lex->field_list.clear();
4745
Lex->update_list.clear();
4746
Lex->value_list.clear();
4744
Lex.field_list.clear();
4745
Lex.update_list.clear();
4746
Lex.value_list.clear();
4748
4748
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
4749
4749
opt_load_data_set_spec
4765
/* empty */ { Lex->duplicates=DUP_ERROR; }
4766
| REPLACE { Lex->duplicates=DUP_REPLACE; }
4767
| IGNORE_SYM { Lex->ignore= 1; }
4765
/* empty */ { Lex.duplicates=DUP_ERROR; }
4766
| REPLACE { Lex.duplicates=DUP_REPLACE; }
4767
| IGNORE_SYM { Lex.ignore= 1; }
4770
4770
opt_duplicate_as:
4771
/* empty */ { Lex->duplicates=DUP_ERROR; }
4772
| AS { Lex->duplicates=DUP_ERROR; }
4773
| REPLACE { Lex->duplicates=DUP_REPLACE; }
4774
| IGNORE_SYM { Lex->ignore= true; }
4775
| REPLACE AS { Lex->duplicates=DUP_REPLACE; }
4776
| IGNORE_SYM AS { Lex->ignore= true; }
4771
/* empty */ { Lex.duplicates=DUP_ERROR; }
4772
| AS { Lex.duplicates=DUP_ERROR; }
4773
| REPLACE { Lex.duplicates=DUP_REPLACE; }
4774
| IGNORE_SYM { Lex.ignore= true; }
4775
| REPLACE AS { Lex.duplicates=DUP_REPLACE; }
4776
| IGNORE_SYM AS { Lex.ignore= true; }
4779
4779
opt_field_term:
4790
4790
TERMINATED BY text_string
4792
assert(Lex->exchange != 0);
4793
Lex->exchange->field_term= $3;
4792
assert(Lex.exchange != 0);
4793
Lex.exchange->field_term= $3;
4795
4795
| OPTIONALLY ENCLOSED BY text_string
4797
assert(Lex->exchange != 0);
4798
Lex->exchange->enclosed= $4;
4799
Lex->exchange->opt_enclosed= 1;
4797
assert(Lex.exchange != 0);
4798
Lex.exchange->enclosed= $4;
4799
Lex.exchange->opt_enclosed= 1;
4801
4801
| ENCLOSED BY text_string
4803
assert(Lex->exchange != 0);
4804
Lex->exchange->enclosed= $3;
4803
assert(Lex.exchange != 0);
4804
Lex.exchange->enclosed= $3;
4806
4806
| ESCAPED BY text_string
4808
assert(Lex->exchange != 0);
4809
Lex->exchange->escaped= $3;
4808
assert(Lex.exchange != 0);
4809
Lex.exchange->escaped= $3;
5052
5052
simple_ident_q:
5053
5053
ident '.' ident
5055
$$= parser::buildIdent(Lex, NULL_LEX_STRING, $1, $3);
5055
$$= parser::buildIdent(&Lex, NULL_LEX_STRING, $1, $3);
5057
5057
| '.' ident '.' ident
5059
$$= parser::buildIdent(Lex, NULL_LEX_STRING, $2, $4);
5059
$$= parser::buildIdent(&Lex, NULL_LEX_STRING, $2, $4);
5061
5061
| ident '.' ident '.' ident
5063
$$= parser::buildIdent(Lex, $1, $3, $5);
5063
$$= parser::buildIdent(&Lex, $1, $3, $5);
5072
5072
| ident '.' ident '.' ident
5074
if (not parser::checkFieldIdent(Lex, $1, $3))
5074
if (not parser::checkFieldIdent(&Lex, $1, $3))
5075
5075
DRIZZLE_YYABORT;
5079
5079
| ident '.' ident
5081
if (not parser::checkFieldIdent(Lex, NULL_LEX_STRING, $1))
5081
if (not parser::checkFieldIdent(&Lex, NULL_LEX_STRING, $1))
5082
5082
DRIZZLE_YYABORT;
5087
5087
{ /* For Delphi */
5527
5527
COMMIT_SYM opt_work opt_chain opt_release
5529
Lex->statement= new statement::Commit(YYSession, $3, $4);
5529
Lex.statement= new statement::Commit(YYSession, $3, $4);
5534
5534
ROLLBACK_SYM opt_work opt_chain opt_release
5536
Lex->statement= new statement::Rollback(YYSession, $3, $4);
5536
Lex.statement= new statement::Rollback(YYSession, $3, $4);
5538
5538
| ROLLBACK_SYM opt_work TO_SYM opt_savepoint savepoint_ident
5540
Lex->statement= new statement::RollbackToSavepoint(YYSession, $5);
5540
Lex.statement= new statement::RollbackToSavepoint(YYSession, $5);
5545
5545
SAVEPOINT_SYM savepoint_ident
5547
Lex->statement= new statement::Savepoint(YYSession, $2);
5547
Lex.statement= new statement::Savepoint(YYSession, $2);
5552
5552
RELEASE_SYM SAVEPOINT_SYM savepoint_ident
5554
Lex->statement= new statement::ReleaseSavepoint(YYSession, $3);
5554
Lex.statement= new statement::ReleaseSavepoint(YYSession, $3);